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.

Wordpress 2.7 Integration

edited February 2009 in Vanilla 1.0 Help
I have followed all the steps to integrate the latest version of vanilla and wordpress and have followed the directions...
...here and here.

I have the two talking together and sharing the same database. The issue is authentication which seems to be the case for most trying to integrate the two. So are there any updates to this issue?

Thanks in advance for your help!

Comments

  • edited January 2009
    Are you having the same issue as expressed in this thread? http://lussumo.com/community/discussion/7694/integrating-vanilla-with-wordpress-themes/#Item_0 EDIT: FIXED THE LINK
  • edited January 2009
    That thread is no longer available apparently noyz319. It has nothing to do with themes. Wordpress and Vanilla are sharing the same user tables, the users are just having to log in to the forum as well as on the wordpress site. Hope that clarifies a little bit.
  • For Wordpress 2.7 authentication I used Silkjaer's WordpressAuthenticator file from this thread. It only compatible up to WP 2.5 though, so you need to revert your WP 2.7 wp-config file to how it was in the WP 2.5 days.

    Instead of the following definitions:
    define('AUTH_KEY', 'put your unique phrase here');
    define('SECURE_AUTH_KEY', 'put your unique phrase here');
    define('LOGGED_IN_KEY', 'put your unique phrase here');

    Use this instead:
    define('SECRET_KEY', 'put your unique phrase here');
  • hey noyz thanks for spinning the idea of reverting the config file back to like it was during 2.5. That's something I seriously didn't consider. There must have been a cognitive disconnect somewhere. Question for you though. Where on the Vanilla side was this secret key defined also? I am having a hard time recalling this. Thanks again!
  • edited January 2009
    Just follow the posts in this thread: http://lussumo.com/community/discussion/8056/2/wordpress-25-bridge/ You add the secret key config along with all the other wordpress calls in Vanilla's database.php file: // Wordpress Integration // ===================== // Map to the wordpress user table $DatabaseTables['User'] = 'wp_users'; // Map existing wordpress columns to Vanilla $DatabaseColumns['User']['UserID'] = 'ID'; $DatabaseColumns['User']['Name'] = 'user_login'; $DatabaseColumns['User']['Password'] = 'user_pass'; $DatabaseColumns['User']['Email'] = 'user_email'; $DatabaseColumns['User']['DateFirstVisit'] = 'user_registered'; // Also map the Wordpress columns into Vanilla $DatabaseColumns['User']['user_nicename'] = 'user_nicename'; $DatabaseColumns['User']['user_url'] = 'user_url'; $DatabaseColumns['User']['user_activation_key'] = 'user_activation_key'; $DatabaseColumns['User']['user_status'] = 'user_status'; $DatabaseColumns['User']['display_name'] = 'display_name'; // Wordpress Secret Keys $Configuration['WP_SECRET_KEY'] = 'your wordpress secret key'; // Enable Wordpress Functions require_once('/var/www/vhosts/yourdomain.com/httpdocs/wp-blog-header.php');
  • Have you guys successfully integrated Wordpress 2.7? I've followed all the threads here & have everything working except login integration. If you haven't with WP 2.7, has anyone successfully integrated with WP 2.6.2 or 2.5?
  • This works for me at WordPress 2.7 flavoured with Vanilla 1.1.5a, I auth via WordPress API and try to use no SQL-Queries. It needs no reference for $wpdb, but needs the other things as mentioned at the example Wordpress Integration. class Authenticator { var $Context; var $PasswordHash; var $CookiePath; var $VerificationKey; var $WP_UserData; // Helpers which for example auth the user with use of WordPress API function Load_UserData_WP($username){ $this->WP_UserData = get_object_vars(get_userdatabylogin($username)); } function CheckPass_GetHash_WP($password){ if($ret = wp_check_password($password,$this->WP_UserData["user_pass"],$this->WP_UserData["ID"])){ return $this->WP_UserData["user_pass"]; } } // End of Helpers function AssignSessionData($user_login, $user_pass, $PersistentSession = '0') { if(!wp_check_password($user_pass,$this->WP_UserData["user_pass"],$this->WP_UserData["ID"])){ wp_set_auth_cookie($this->WP_UserData["ID"],$PersistentSession); } } // This method is used in various places in Vanilla to sign someone into a session function AssignSessionUserID($UserID) { if (!$this->WP_UserData){$this->WP_UserData = get_object_vars(get_userdata($UserID));} $this->AssignSessionData($this->WP_UserData["user_login"], $this->WP_UserData["user_pass"]); } // Returning '0' indicates that the username and password combination weren't found. // Returning '-1' indicates that the user does not have permission to sign in. // Returning '-2' indicates that a fatal error has occurred while querying the database. function Authenticate($Username, $Password, $PersistentSession) { // Validate the username and password that have been set $UserManager = $this->Context->ObjectFactory->NewContextObject($this->Context, 'UserManager'); $Username = FormatStringForDatabaseInput($Username); $Password = FormatStringForDatabaseInput($Password); $this->Load_UserData_WP($Username); $WP_PassHash = $this->CheckPass_GetHash_WP($Password); $UserID = 0; $User = $UserManager->GetUserCredentials(0, $Username); if (!$User === null) { $UserID = -2; } elseif ($User) { if ($User->VerificationKey == '') $User->VerificationKey = DefineVerificationKey(); } if ($this->PasswordHash->CheckPassword($User, $Password)){ if (!$User->PERMISSION_SIGN_IN) { $UserID = -1; } else { $UserID = $User->UserID; //die(var_dump($UserID)." ".var_dump($this->WP_UserData["ID"])); $this->VerificationKey = $User->VerificationKey; // 1. Update the user's information $UserManager->UpdateUserLastVisit($this->WP_UserData["ID"], $this->VerificationKey); // 2. Log the user's IP address $UserManager->AddUserIP($this->WP_UserData["ID"]); // If it has now been found, set up the session. $this->AssignSessionUserID($this->WP_UserData["ID"]); } } return $UserID; } function Authenticator(&$Context) { $this->Context = &$Context; $this->CookiePath=COOKIEPATH; $this->PasswordHash = $this->Context->ObjectFactory->NewContextObject($this->Context, 'PeoplePasswordHash'); } function DeAuthenticate() { wp_clear_auth_cookie(); if (session_id()) session_destroy(); return true; } function GetIdentity() { $UserID = 0; if(wp_validate_auth_cookie('','logged_in')){ $UserID = wp_validate_auth_cookie('','logged_in'); } else{ if (session_id()) session_destroy(); } if (!session_id()){ session_set_cookie_params(0, $this->CookiePath); session_start(); } return $UserID; } function LogIp($UserID) { if ($this->Context->Configuration['LOG_ALL_IPS']) { $UserManager = $this->Context->ObjectFactory->NewContextObject( $this->Context, 'UserManager'); $UserManager->AddUserIP($UserID); } } function UpdateLastVisit($UserID, $VerificationKey = '') { $UserManager = $this->Context->ObjectFactory->NewContextObject( $this->Context, 'UserManager'); $UserManager->UpdateUserLastVisit($UserID, $VerificationKey); } }
Sign In or Register to comment.