Welcome to Geeklog, Anonymous Saturday, July 13 2024 @ 12:16 pm EDT

Geeklog Forums

Custom Userform bug?


josheli

Anonymous
Hi. I'm hacking a custom user registration process in 1.8.3-1 and am puzzled by a few code choices. As I see it, the process is like this:

on new register
send to users.php
call custom_userform('new'Wink;
which posts to users.php?mode=create

on 2nd pass to users.php
call createuser($username,$email)
inside createuser()...
if(is_email) {
if(email not already used) {
create geek user
create custom user
}
else {
call custom_userform('new'Wink;
}
}
else {
call newuserform();
}

shouldn't that last call to newuserform() around line 537 of users.php, inside createuser(), check for a custom_userform?
and again at the bottom of the file, around line 899, inside the switch that's inside the default choice of the main switch, shouldn't there be a check for a custom_userform?
(actually, that whole chunk of code at the bottom of users.php is mysterious to me. what does $msg do at the bottom?

if ($mode != "new" && empty($msg)) {
$msg = $LANG04[31];
}

$display .= COM_siteFooter();
}
break;
}

echo $display;

?>
 Quote

Status: offline

Blaine

Forum User
Moderator
Registered: 07/16/02
Posts: 1232
Location:Canada
I don\'t see an issue. In createuser(), you only want to call the site\'s custom registration form if it exists and is enabled else use newuserform(). The $msg is a message string that will display on the front page above the featured story as in \"Your account has been created\" or \"You have been successfully logged out\". You can look up the $LANG array strings in the language file.
Geeklog components by PortalParts -- www.portalparts.com
 Quote

josheli

Anonymous
I don\'t see an issue. In createuser(), you only want to call the site\'s custom registration form if it exists and is enabled else use newuserform().
i know. that\'s my point. at the lines i noted, there is no check to see if the custom form exists or is enabled, so ONLY newuserform() can be called, even if you have implemented a custum_userform(). from my way of thinking, EVERY call to newuserform should be accompanied by a check for a custom_userform().
The $msg is a message string that will display on the front page above the featured story as in \"Your account has been created\" or \"You have been successfully logged out\". You can look up the $LANG array strings in the language file.
yes, again, i know. but after that point in the script, $msg is never called and displayed.
 Quote

Status: offline

Blaine

Forum User
Moderator
Registered: 07/16/02
Posts: 1232
Location:Canada
confused
The following is the code in users.php for GL 1.3.8
if ($_CONF[\'custom_registration\'] AND (function_exists(custom_userform))) { $retval .= custom_userform (\'new\', \'\', $LANG04[19]); } else { $retval .= newuserform ($LANG04[19]); }
It has the logic to check if the custom function exists and if enabled for the site.
Geeklog components by PortalParts -- www.portalparts.com
 Quote

josheli

Anonymous
one of us is missing something. easily could be me. sorry if it is. anyway... look at createuser() in users.php what happens if (COM_isEmail($email)) returns false? Here\'s what:
} else { $retval .= COM_siteHeader (\'Menu\') . newuserform ($LANG04[18]) . COM_siteFooter(); } return $retval;
look at the \'default:\' choice in the main switch in users.php. it\'s got another switch embedded in it:
if (!empty($passwd) && $mypasswd == md5($passwd)) { ...code... } else { $display .= COM_siteHeader(\'menu\'); $display .= COM_showMessage($msg); switch ($mode) { case \'create\': // Got bad account info from registration process, show error // message and display form again $display .= newuserform(); break; default: // Show login form $display .= loginform(); break; }
thanks for your patience.
 Quote

Status: offline

Blaine

Forum User
Moderator
Registered: 07/16/02
Posts: 1232
Location:Canada
I agree that there may need to be an additional test upon a bad email. I don\'t recall testing that condition nor has the site that\'s been running this for the past 4 months noted it. Not so sure about the second one - as when that condition would occur. There is a test for $mode = create much earlier so don\'t know when this condition would occur as I look at it now.
Geeklog components by PortalParts -- www.portalparts.com
 Quote

Status: offline

josheli

Forum User
Newbie
Registered: 08/16/03
Posts: 7
on the first one, it\'s definitely happening. see this post: http://www.geeklog.net/forum/viewtopic.php?forum=3&showtopic=23494 on the second one, it will never get called. $mode is checked in the first switch, and if it\'s \'create\', it calls createuser(). so $mode=\'create\' can never make it down to the second switch. switch($mode) \'create\': ... default: ...code... switch($mode) \'create\': ...... never happen. did you see my other post about being able to register without a username?
 Quote

Status: offline

Blaine

Forum User
Moderator
Registered: 07/16/02
Posts: 1232
Location:Canada
I\'d suggest this be logged as a bug so we can ensure it gets resolved for the next release and the current CVS snapshot.
Geeklog components by PortalParts -- www.portalparts.com
 Quote

Status: offline

josheli

Forum User
Newbie
Registered: 08/16/03
Posts: 7
Bug logged.
 Quote

All times are EDT. The time is now 12:16 pm.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content