Membership Pugin - logged out after user profile update

By goodonyx - November 19, 2012

Just using the user profile example page code, I'm able to submit an update; however, I've noticed I have to log back in to view member-protected pages. Is it possible to stay logged in after submitting a user profile update?

Re: [goodonyx] Membership Pugin - logged out after user profile update

By gregThomas - November 20, 2012

Hi goodonyx,

This problem is caused after a user changes their password, as the password stored in the database no longer matches what is stored in the session, so the user is logged out. But you can get around this by doing the following.

Somewhere around line 73 you should see this:

$userNum = mysql_insert_id();

If you add the these two lines after it:

$_SESSION['username'] = $_REQUEST['username'];
$_SESSION['passwordHash'] = md5( $passwordHash );


This will update the session data after the user has updated there profile, and stop them being logged out.

Thanks
Greg Thomas







PHP Programmer - interactivetools.com