*

Burton

  • ***
  • 128
Removing Registration Code Requiring Individual Couples Names
« on: January 30, 2015, 02:12:31 PM »
If a new user registers as a Couple or Group their individual Usernames are required, 2 or more Usernames are required.

Error Message: Individual usernames of members forming couple should be entered.

So to get around this, I have changed some code, and deleted lines of code in the following .tpl and .php files

I am not a coder, so if you know a better cleaner way please comment.

1st look for this line of code in the following 3 templates:

if (fld.value == 'C' || fld == 'C' || fld.value == 'G' || fld == 'G') {ldelim}

this code makes the drop down appear when you choose Couple or Group at Registration.

change to this:

if (fld.value == 'A' || fld == 'A' || fld.value == 'B' || fld == 'B') {ldelim}

templates/default/signup.tpl Line 120 change 'C' and 'G'  to 'A' and 'B"

templates/default/edituser.tpl Line 76 change 'C' and 'G'  to 'A' and 'B"

templates/default/admin/profileedit.tpl Line 6 change 'C' and 'G'  to 'A' and 'B"

Next the system will still check to see if you have entered those Usernames.

So we need to delete the following lines of code-these are the line numbers in my .php files

You are looking for this code:  if a Couple is selected must have Usernames (my translation lol)

Quote
if ($err == '0' && $gender == 'C' ) {
   if (trim($couple_usernames) == '' or substr_count($couple_usernames,',') <= 0 or !isset($couple_usernames) ) {
      $err = COUPLE_USERNAMES_MISSING;
   } else {
      $userok = 0;
      $usrs = 0;
      foreach(explode(',',$couple_usernames) as $k => $uname) {
         if (trim($uname) != '') {
            $user = $osDB->getOne('select username from ! where username = ?', array(USER_TABLE, trim($uname)) );
            $usrs++;
            if ($user != trim($uname)) {$userok++;}
         }
      }
      if ($userok > 0 ) {$err = 129; }
      if ($usrs < 2) {$err = COUPLE_USERNAMES_MISSING;}
   }
}

savesignup.php  removed Lines 263 - 279

modifyuser.php  removed Lines 193 - 209

admin/modifyprofile.php  removed Lines 198 - 214

Remember these are the Line numbers in my files, it is possible your will be different,

Look for the code in "quotes"above,

Ok thats it :)
« Last Edit: January 30, 2015, 02:31:34 PM by Burton »