[Fix] Non sanitized user_nicename causes buddypress problems
-
Hi,
I like this plugin a lot. However it does not work with Buddypress, as OpenID users are facing 404 errors. As I found out this is because the wp_users table contains a non-sanitized version of the username in the field user_nicename, which is used in URLs by buddypress. While user_login is sanitized, it is not done for user_nice name. I did a hack to fix that problem, which I would like to share with you. Would be great if you would fix it in a new version, so I could stay up to date with the OpenID plugin.
File: openid/common.php
// Hack: Add nicename to user table
// The field user_nicename in table wp_users should contain a sanatized version of the openID username, as in user_login
// Out of some reason the this is not the case, causing buddypress to crash
// This hack adds the sanitized version of the openid username to user_nicename$user_data[‘user_login’] = $username;
$user_data[‘user_pass’] = substr( md5( uniqid( microtime() ) ), 0, 7);replaced with
$user_data[‘user_login’] = $username;
$user_data[‘user_nicename’] = $username;
$user_data[‘user_pass’] = substr( md5( uniqid( microtime() ) ), 0, 7);I would also like to mention that I had problesm with redirection after login. OpenID users were redirect to a specific post after successfull login. It seems that there is a wrong content in array_key_exists(‘redirect_to’, $_REQUEST). I therfore hacked the following line of code to redirect to index.php.
File: openid/login.php
// Hack: Fix redirect after login
// out of an unknown reason, users are redirect to specific blog post after login
// hack ensures that users are redirected to /index.phpchange
$redirect_to = array_key_exists(‘redirect_to’, $_REQUEST) ? $_REQUEST[‘redirect_to’] : null;
to
$redirect_to = ‘/index.php’;Anyone having a better idea?
- The topic ‘[Fix] Non sanitized user_nicename causes buddypress problems’ is closed to new replies.