Welcome to Geeklog, Anonymous Wednesday, December 04 2024 @ 08:21 am EST

Geeklog Forums

Registration Hack for GL 1.3.7.

Page navigation


Status: offline

Robin

Forum User
Full Member
Registered: 02/15/02
Posts: 725
Here\'s what I did to ease the registration process as my host doesn\'t support email.I modifed the users.php a bit. You can see it in action at amerykanistyka.host.sk. Hope it will make your life easier. Here\'s the code with highlighted changes. You will need to change your language files so they don\'t say about password emailingfunction createuser($username,$email)
{
global $_TABLES, $LANG04, $_CONF;

$ucount = DB_count($_TABLES[\'users\'],\'username\',$username);
$ecount = DB_count($_TABLES[\'users\'],\'email\',$email);
$email = md5($email);

if ($ucount == 0 AND $ecount == 0) {
# if (COM_isEmail($email)) {
$regdate = strftime(\'%Y-%m-%d %H:%M:$S\',time());
DB_save($_TABLES[\'users\'],\'username,passwd,regdate\',\"\'$username\',\'$email\',\'$regdate\'\");
$uid = DB_getItem($_TABLES[\'users\'],\'uid\',\"username = \'$username\'\");

// Add user to Logged-in group (i.e. members) and the All Users group (which includes
// anonymous users
$normal_grp = DB_getItem($_TABLES[\'groups\'],\'grp_id\',\"grp_name=\'Logged-in Users\'\");
$all_grp = DB_getItem($_TABLES[\'groups\'],\'grp_id\',\"grp_name=\'All Users\'\");
DB_query(\"INSERT INTO {$_TABLES[\"group_assignments\"]} (ug_main_grp_id,ug_uid) values ($normal_grp, $uid)\");
DB_query(\"INSERT INTO {$_TABLES[\"group_assignments\"]} (ug_main_grp_id,ug_uid) values ($all_grp, $uid)\");
DB_query(\"INSERT INTO {$_TABLES[\"userprefs\"]} (uid) VALUES ($uid)\");
if ($_CONF[\'emailstoriesperdefault\'] == 1) {
DB_query(\"INSERT INTO {$_TABLES[\"userindex\"]} (uid) VALUES ($uid)\");
} else {
DB_query(\"INSERT INTO {$_TABLES[\"userindex\"]} (uid,etids) VALUES ($uid, \'-\')\");
}
DB_query(\"INSERT INTO {$_TABLES[\"usercomment\"]} (uid) VALUES ($uid)\");
DB_query(\"INSERT INTO {$_TABLES[\"userinfo\"]} (uid) VALUES ($uid)\");
if ($_CONF[\'usersubmission\'] == 1) {
$queueUser = true;
if (!empty ($_CONF[\'allow_domains\'])) {
$allowed = explode (\',\', $_CONF[\'allow_domains\']);
// Note: We already made sure $email is a valid address
$domain = substr ($email, strpos ($email, \'@\') + 1);
if (in_array ($domain, $allowed)) {
$queueUser = false;
}
}
if ($queueUser) {
$passwd = md5(\'\');
DB_change($_TABLES[\'users\'],\'passwd\',\"$passwd\",\'username\',$username);
$msg = 48;
} else {
# emailpassword($username, 1);
$msg = 1;
}
if (isset ($_CONF[\'notification\']) && in_array (\'user\', $_CONF[\'notification\'])) {
sendNotification ($username, $email, $uid, $queueUser);
}
} else {
# emailpassword($username, 1);
$msg = 1;
if (isset ($_CONF[\'notification\']) && in_array (\'user\', $_CONF[\'notification\'])) {
sendNotification ($username, $email, $uid, false);
}
}
DB_change($_TABLES[\'usercomment\'],\'commentmode\',$_CONF[\'comment_mode\'],\'uid\',$uid);
DB_change($_TABLES[\'usercomment\'],\'commentlimit\',$_CONF[\'comment_limit\'],\'uid\',$uid);

return COM_refresh($_CONF[\'site_url\'] . \'/index.php?msg=\' . $msg);
} else {
# $retval .= COM_siteHeader(\'Menu\') . newuserform($LANG04[18]) . COM_siteFooter();
}
# } else
{
$retval .= COM_siteHeader(\'Menu\') . newuserform($LANG04[19]) . COM_siteFooter();
}
return $retval;
}


Geeklog Polish Support Team
 Quote

Anonymous

Anonymous
Thanks I'm sure that will help a few others in the same situation as you.
 Quote

Anonymous

Anonymous
I tried to check out the registration page but was given this error. Template Error: set_root: /mnt/host-users/amerykanistyka/layout/cleanusers is not a directory. Halted. Just wanted to let you know.
 Quote

Status: offline

Robin

Forum User
Full Member
Registered: 02/15/02
Posts: 725
Thanks a lot! I fixed it (a typo in config:-). Go ahead and try it now.
Geeklog Polish Support Team
 Quote

WannaFIsh39

Anonymous
stressed
I NEED this to work for 1.3.8!!!! Anyone??? PLEASE!!!
 Quote

Status: offline

Robin

Forum User
Full Member
Registered: 02/15/02
Posts: 725
(un)Fortunately www.host.sk switched email on and I switched off this hack.
Geeklog Polish Support Team
 Quote

Status: offline

D1

Forum User
Chatty
Registered: 08/27/03
Posts: 55
I\'ll like to try your registration codes Robin, is this the code above or you have and updated version?
What an old man can see, a young man will never see even though he is standing at the top of the highest mountain.
 Quote

Status: offline

D1

Forum User
Chatty
Registered: 08/27/03
Posts: 55
Hi Robin Just tried your script and below is the result of what I get... 1136: Column count doesn\'t match value count at row 1 So what next?
What an old man can see, a young man will never see even though he is standing at the top of the highest mountain.
 Quote

Status: offline

WannaFish39

Forum User
Newbie
Registered: 08/22/03
Posts: 12
What do you have to edit in the language files adn eh users.thtml files? It doesn\'t spedify. Thanks so much in advance, MacFanatic39
 Quote

Status: offline

Robin

Forum User
Full Member
Registered: 02/15/02
Posts: 725
OK sorry for a little bit confusing instruction. 1. Copy the above function createuser to users.php over the existing function (or manually add the changes in bold). 2. Language changes: after clicking Sign up as a New User you get two fields User Name and Email -> change the latest to Password and remove the message \"Your password will be sent to the email address you enter.\". After clicking \"Register Now\" you get this message about emailing (which actually doesn\'t mail right) so change this message to whatever e.g. Congrats you can now login and stuff. All the above lang changes sit in english.php (I guess) Cheers
Geeklog Polish Support Team
 Quote

Status: offline

WannaFish39

Forum User
Newbie
Registered: 08/22/03
Posts: 12
THANK YOU SOOOO MUCH ROBIN! You have been the biggest help. One more thing though...Anyone know of a way to get the email address field to coexist with the username and password ones? It would be nice to get all three of those done at registration in case I need to email them for whatever reason. Thanks to all you you, especially Robin, WannaFish39
 Quote

Status: offline

m311b

Forum User
Newbie
Registered: 09/08/03
Posts: 9
I have successfully used the hack so that users can enter in their password and username w/o having a confirmation letter sent to them, allowing them to log in right away. Now it would be nice for them to also have a field where they can enter in their email address still and have it save it to the database. The first step looks like modifying the registrationform.thtml to add another form, which I have. The form is titled \"email2\" (for now as I am not nearly ready to start modifying the php code and existing form names as I am very new to this all). So going off of the added form \"email2\" for submitting the email address to the database, any suggestions for the code to accomplish this? Thanks in advance for your help!
 Quote

Status: offline

m311b

Forum User
Newbie
Registered: 09/08/03
Posts: 9
Nevermind - after a few hours of trial and error its been accomplished!
 Quote

Status: offline

m311b

Forum User
Newbie
Registered: 09/08/03
Posts: 9
OK - it was working, I was able to have the new user type in their desired username, password and email address, and it was saving it in the database. but after logging in, if you were to click on anyone's name to view their user profile this error was returned: Parse error: parse error, unexpected $end in d:\208.187.163.136\users.php on line 901 What exactly is a parse error?
 Quote

darkork

Anonymous
Not working for me Frown

I get parse error when I try to create a new account.

Probably the code of the new version is different ??
 Quote

Status: offline

Robin

Forum User
Full Member
Registered: 02/15/02
Posts: 725
Very much probably.
Sorry for not updating the hack but as I mentioned earlier my host switched phpmail on.
However very recently they disabled this again (moody bastards ;-) so I will take a look at the latest code to see how this hack could be achieved.
Geeklog Polish Support Team
 Quote

Status: offline

Blaine

Forum User
Moderator
Registered: 07/16/02
Posts: 1232
Location:Canada
You may fine the new COM_mail() which uses the PEAR mail class offers you what you need.

If not, the COM_mail() now checks for a CUSTOM_mail() and if it exists - it will be used instead.
Geeklog components by PortalParts -- www.portalparts.com
 Quote

Raja

Anonymous
confused
I had the problem of my users not getting their passwords sent to them because they typed in the wrong email address. So I implimented this great hack and managed to get it to work with little effort.

But now.... My users can't put in an email address at all and I keep getting bounced emails everytime one of these newer users get a pm.

How can I have new users sign up immediately by choosing their own password and still enter their email adress in as well????
 Quote

Status: offline

rjrufo

Forum User
Regular Poster
Registered: 06/14/03
Posts: 95
I'm trying this on GL 1.3.9 with no luck. It seems that the system still generates a random password, even though I'm entering in my own. I've uncommented the debug line, and it shows that it's attempting to create the user with the password I select, but when I try logging in with the info I entered, it won't go. Anyone have any ideas?

Edit: I have the email password part successfully canceled, so I - or anyone else - will not be able to get the generated password. It's on my "development" site, one that is not accessible from the internet, so I'm not concerned about new people registering and not being able to log in, but I'd like to implement this on the "live" site as soon as possible.

Thanks
 Quote

InDio

Anonymous
Any progreess?

The thing is I can't figure out the structure of the code used to output the newuser form, and the code to get the data to the database. It's no big deal INSERTing data from a form into mysql, but geeklog's code structure is a little more complicated than ifs and thens.....

Anyone gone any further with deactivating the email passwd? I think the devel team should give us a hand here...
 Quote

Page navigation

All times are EST. The time is now 08:21 am.

  • 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