Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Replace Vanilla login context with Wordpress login context

edited April 2007 in Vanilla 1.0 Help
I followed Mark's instructions for integrating Wordpress and Vanilla, and now I'd like to do something I think should be pretty simple but that I'm really not sure how to begin. I've read through the docs about the PostBack class, and I guess that this could be done by writing a new Control element, but I think it might actually be simpler than that:

Essentially, what I'd like to do is to stop using the Vanilla login and signup method. I want to do this because when you create an account through Vanilla, it doesn't update wp_usermeta the way that Wordpress does, and I'd like to be able to have users handle everything on their own without my having to modify the user account manually. (If you create an account through Vanilla, it doesn't set a user role on the Wordpress side, which means that users can't modify their own profiles until a role is set.)

I'm not quite sure where I need to start with this. I could go one of two routes with it:
  1. I could rewrite the actual login form in people_signin_form_nopostback.php and change the form itself so that it points to the WP login form action.
  2. I could change the links themselves to point to /wp-login.php, /wp-login.php?action=register, wp-login.php?action=logout, etc.
There are benefits and detriments to each option.
  • With the first, I can keep the Vanilla theming but have one backend. This means less styling but more PHP work, which I'm more wary of doing, mainly because I'm more familiar with Wordpress's structure and almost completely unfamiliar with Vanilla's.
  • With the latter option, I would lose the Vanilla login and signup pages, but that may be for the best, given that the Wordpress account signup process is the easier to follow (enter a username, enter an email address—it emails you a password and you go set up your profile).
In either case, it would mean that I'd have to rewrite the Wordpress login function so that it redirects after processing the login based on where you were before. I don't think that'll be too too difficult, but in general I'm more worried about messing with the template files in Vanilla.

Anybody know where I might start? Maybe somebody that's done something similar? Thanks!


  • I've gone with option #2 and just leave login, logout, signup to wordpress.

    To redirect upon login, you'll want something similar to the following:

    wordpress: themes/[your custom theme name]/sidebar.php
    <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?redirect_to=<?php echo get_option('siteurl').$_SERVER['REQUEST_URI'] ?>">login</a>
    vanilla: themes/[your custom theme name]/menu.php
    echo $this->Context->GetDefinition('NotSignedIn').' (<a href="'.AppendUrlParameters($this->Context->Configuration['SIGNIN_URL'], 'redirect_to='.GetRequestUri()).'">'.$this->Context->GetDefinition('SignIn').'</a>)';
  • Oh, interesting: I didn't realize that Wordpress already has a redirect option in its login function. I'll have to take a closer look at that. That makes the second option much easier, I think.
  • bschultz: Your suggestion was PERFECT! Thank you so much! Adding SIGNIN_URL and SIGNOUT_URL configuration options enabled me to do exactly what you suggested, and I didn't have to modify any code whatsoever in order to get it done.
This discussion has been closed.