Membership Signup (account disabled by default)

3 posts by 3 authors in: Forums > CMS Builder: Plugins & Add-ons
Last Post: July 18, 2012   (RSS)

By kdub718 - July 17, 2012

So when a user signs up I want there account to be disabled until I give them permission. I found this in the user_signup.php

mysql_query("INSERT INTO `{$TABLE_PREFIX}" . @$GLOBALS['WSM_ACCOUNTS_TABLE'] . "` SET
fullname = '".mysql_escape( $_REQUEST['fullname'] )."',
email = '".mysql_escape( $_REQUEST['email'] )."',
username = '".mysql_escape( $_REQUEST['username'] )."',
password = '".mysql_escape( $passwordHash )."',
businessname = '".mysql_escape( $_REQUEST['businessname'] )."',
disabled = '1',
createdDate = NOW(),
updatedDate = NOW(),
createdByUserNum = '0',
updatedByUserNum = '0'")
or die("MySQL Error Creating Record:<br/>\n". htmlspecialchars(mysql_error()) . "\n");
$userNum = mysql_insert_id();


I changed disabled to "1" from 0 thinking it would default it to disabled. It seems to work but when I login to the admin and look at the temp member I created the box isn't checked disabled but It also won't let me login. So it acts like the account is disabled. So am I doing this correct?

Also is there a way that the user can set there own password from the start? VS having to get the temporary password and having to change it so something they choose?

Re: [kdub718] Membership Signup (account disabled by default)

By gkornbluth - July 17, 2012

Hi Kdub718,

See the post at http://www.interactivetools.com/iforum/P94188#94188 for a detailed answer to the first part.

You can't have users initially set their password for security reasons, but you can use their email address as their user name to eliminate one step.

Best,

Jerry Kornbluth
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

Re: [kdub718] Membership Signup (account disabled by default)

By Jason - July 18, 2012

Hi,

The code you have looks correct. It's strange that the check box isn't showing as checked, but the behavior seems to be there. If you create more than 1 account, does this happen each time?

Jerry is right in that emailing them the password initially is a good practice for further user verification. However, you can customize the sign up form to allow a user to create a password instead of one being randomly generated.

Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/