Author Topic: [MOD] Default usergroup for new users  (Read 9611 times)

0 Members and 1 Guest are viewing this topic.

Offline TIMT

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
[MOD] Default usergroup for new users
« on: March 21, 2005, 12:11:48 PM »
This Theme was discussed before hack

Hi together Is it possible to define a default usergroup for new registered users? As soon as the new user has activated his account, he should be linked to the usergroup "new user". thanks for helping me.
Serge



from Jan:

Try this:

1.) Open register.php and search for Code:

Code: [Select]
$sql = "SELECT ".get_user_table_field("",
"user_name").get_user_table_field(", ",
"user_email").get_user_table_field(", ",
"user_activationkey")."

Replace it with Code:
Code: [Select]
$sql = "SELECT ".get_user_table_field("",
"user_id").get_user_table_field("",
"user_name").get_user_table_field(", ",
"user_email").get_user_table_field(", ",
"user_activationkey")."

2.) Then search for Code:
Code: [Select]
$msg = $lang['activation_success'];

Add the following code below Code:
Code: [Select]
$group_id = [group_id];
$sql = "INSERT INTO ".GROUP_MATCH_TABLE."
         (group_id, user_id, groupmatch_startdate,
groupmatch_enddate)
         VALUES
         ($group_id, ".$row[$user_table_fields['user_id']].",
".time().", 0)";
$site_db->query($sql);

Replace [group_id] with the id of the goup id you want the user link with. To find out the id, go to Control Panel -> Usergroups and point your cursor over the edit link of the usergroup. Then look at the status bar of the browser and check the group_id= parameter in the url. The value of the parameter is the group id.

Jan
Zuletzt bearbeitet von Jan am 10.01.2005, 13:21, insgesamt 2 Male bearbeitet



TIMT wrote:

Hi Jan Now I get the following error-message:

 "DB Error: Bad SQL Query: SELECT user_iduser_name, user_email,
user_activationkey FROM 4images_users WHERE user_activationkey =
'0fa67cf43fd1dd0e1176a1d2ddedbc7b'
Unknown column 'user_iduser_name' in 'field list'"



v@no wrote:

@Jan: that what u get when u put things at the beginning of line, instead of end   j/k

TIMT hat folgendes geschrieben::
Code: [Select]
"DB Error: Bad SQL Query: SELECT user_iduser_name, user_email, $
user_activationkey FROM 4images_users WHERE user_activationkey =
'0fa67cf43fd1dd0e1176a1d2ddedbc7b'
Unknown column 'user_iduser_name' in 'field list'"


@TIMT: First line u changed should looks like this:
Zitat:
Code: [Select]
$sql = "SELECT ".get_user_table_field("",
"user_id").get_user_table_field(", ", "user_name").get_user_table_field(",
", "user_email").get_user_table_field(", ", "user_activationkey")."



Jan wrote:
V@no is right. Forgive me, its monday  


TIMT wrote:
Thank you Jan, Thank you V@no! Now it works perfect!    
« Last Edit: July 25, 2011, 07:17:16 PM by Rembrandt »

Offline getcom

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: [MOD] Default usergroup for new users
« Reply #1 on: November 11, 2007, 09:18:59 PM »
Hi Jan

Is there a way to add or alter this code so it will work when no activation is needed. I would like them to register without the need to activate but still be place in a user group.

Many thanks

Gary