Error when user create an account user the membership plugin

By JeffC - November 22, 2023

Hi

I am getting the error below when a user creates an account using the membership plugin

userUsernames is set to False

Line 62 is: $colsToValues['username'] = $_REQUEST['username'] ?: $_REQUEST['email'];

#320 - Warning: Undefined array key "username"
/home/domainname/public_html/create-account-trr.php on line 62
https://domainname.com/create-account

Vers: 3.63 and 1.14

Error was also happening with 3.59

Thanks
Jeff

Jeff

By Dave - November 22, 2023

Hi Jeff, 

That looks like a bug, can you try this fix?

In /cmsb/plugins/websiteMembership/wsm_codeGenerator.php around line 346, replace this line: 

$colsToValues['username'] = $_REQUEST['username'] ?: $_REQUEST['email']; // email is saved as username if usernames not supported

With this line: 

$colsToValues['username'] = $useUsernames ? $_REQUEST['username'] : $_REQUEST['email'];

And you can also apply that fix to your generated account create page. 

Let me know if that works for you.

Dave Edis - Senior Developer
interactivetools.com