Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Sep 2002
Posts: 7
Lurker
Lurker
Offline
Joined: Sep 2002
Posts: 7
Hello,

Sorry for the newbie question

I am looking for a way to enable my users to change groups themselves.

I have read the excellent reply by Dave (I think) to the Age Groups question - and this enables users to join a certain group, upon signing up to the forums.

However I would like for the users to be able to select a groups from a set list, and change their selection, as and when they choose. I guess that this would also apply in the previous scenario, where a child grew too old for one group, and wanted to select the next group up.

Any assistance would be gratefully received. I have had a little play around, and assume that any option would be based in the editdisplay.php, and would be based on the edit by admin of groups. However I and (I guess) the previous enquirer would only want one selection to be made from a list of 3 or 4 choices. It would also have to take into account that many users would have a selection made yet.

Thankyou,

Sally

Sponsored Links
Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Offline
Joined: Jun 2001
Posts: 3,273
This too isn't that hard of a modification. (unless we want to get real intricate and add admin online configuration)

When I get some time to sit down in front of these keys today for more than a moment I'll put something together. (unless someone beats me to it)

Joined: Sep 2002
Posts: 7
Lurker
Lurker
Offline
Joined: Sep 2002
Posts: 7
Hello Dave

Thank you for looking at this for me. Very kind.

Not sure what you mean by 'unless we want to get real intricate and add admin online configuration'?

Sally

Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Offline
Joined: Jun 2001
Posts: 3,273
I ment that the groups would be hard coded and have to be added/edited manually and not controlled from the admin area.


Ok, now in your editdisplay.php file find this:

SELECT U_Bio,U_Sort,U_Display,U_View,U_PostsPer,U_TextCols,U_TextRows,U_StyleSheet,U_Post_Format,U_Preview,U_PictureView,U_PicturePosts,U_Language,U_FlatPosts,U_TimeOffset,U_FrontPage,U_ActiveThread,U_StartPage,U_ShowSigs,U_Template

and change it to this:

SELECT U_Bio,U_Sort,U_Display,U_View,U_PostsPer,U_TextCols,U_TextRows,U_StyleSheet,U_Post_Format,U_Preview,U_PictureView,U_PicturePosts,U_Language,U_FlatPosts,U_TimeOffset,U_FrontPage,U_ActiveThread,U_StartPage,U_ShowSigs,U_Groups


Find this:

list($Bio,$Sort,$Display,$View,$PostsPer,$TextCols,$TextRows,$StyleSheet,$Post_Format,$Preview,$PictureView,$PicturePost,$chosenlanguage,$FlatPosts,$TimeOffset,$FrontPage,$activethreads,$startpage,$sigview) = $dbh -> fetch_array($sth);

and change it to this:

list($Bio,$Sort,$Display,$View,$PostsPer,$TextCols,$TextRows,$StyleSheet,$Post_Format,$Preview,$PictureView,$PicturePost,$chosenlanguage,$FlatPosts,$TimeOffset,$FrontPage,$activethreads,$startpage,$sigview,$ugroups) = $dbh -> fetch_array($sth);


Find this:

if (!$Display){
$html -> not_right("{$ubbt_lang['NO_PROF']} '$Username'",$Cat);
}

and change it to this:

if (!$Display){
$html -> not_right("{$ubbt_lang['NO_PROF']} '$Username'",$Cat);
}
$mygroups[0]['groups'] = "-3-5-7-8-";
$mygroups[0]['description'] = "change to red group";
$mygroups[1]['groups'] = "-3-6-8-9-";
$mygroups[1]['description'] = "change to blue group";
$mygroups[2]['groups'] = "-3-5-10-11-";
$mygroups[2]['description'] = "change to green group";
$groupoptions = "";
$gotgroup = 0;
for ($i=0; $i<sizeof($mygroups); $i++) {
if ($ugroups == $mygroups[$i]['groups']) {
$groupoptions .= "<option value="{$mygroups[$i]['groups']}" selected="selected">{$mygroups[$i]['description']}</option>";
$gotgroup = 1;
}
else {
$groupoptions .= "<option value="{$mygroups[$i]['groups']}">{$mygroups[$i]['description']}</option>";
}
}
if ($gotgroup) {
$groupselection = "<select name="mygroups">$groupoptions</select>";
}
else {
$groupselection = "<select name="mygroups"><optioin value="$ugroups" selected="selected">don't change</option>$groupoptions</select>";
}




In your editdisplay.tmpl file in your templates/default directory find this:

<br />
<br />
{$ubbt_lang['PROF_STYLE']}<br />

and change it to this:

<br />
<br />
My groups:
<br />
{$groupselection}
<br />
<br />
{$ubbt_lang['PROF_STYLE']}<br />






Now in your changedisplay.php file find this:

// -----------------------
// Format the query words
$ubbt_language_q = addslashes($chosenlanguage);

and change it to this:

// -----------------------
// Format the query words
$mygroups_q = addslashes($mygroups);
$ubbt_language_q = addslashes($chosenlanguage);


Find this:

// --------------------------
// Update the User's profile
$query = "
UPDATE {$config['tbprefix']}Users
SET U_Sort = '$sort_order_q',

and change it to this:

// --------------------------
// Update the User's profile
$query = "
UPDATE {$config['tbprefix']}Users
SET U_Sort = '$sort_order_q',
U_Groups = '$mygroups_q',









Ok I think that will do it. You'll have to test and find out though.

Just modify the groups and descriptions accordingly for your site.




Joined: Sep 2002
Posts: 7
Lurker
Lurker
Offline
Joined: Sep 2002
Posts: 7
Very kind. Thank you.

I will try it .

Sally

Sponsored Links
Joined: Sep 2002
Posts: 7
Lurker
Lurker
Offline
Joined: Sep 2002
Posts: 7
One quick question - would this affect members who were already members of different groups, for example guests, moderators, administrators, or other groups that we did not want people joining?

Sally

Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Offline
Joined: Jun 2001
Posts: 3,273
I only gave examples of group numbers, you will have to figure out what numbers you want them to be able to join. Admins are group 1 and Moderators are group 2. Users are group 3 and guests are group 4. Groups you create are above 4.

This can affect anyone that edits their display prefs to select a group to belong to.

Joined: Sep 2002
Posts: 7
Lurker
Lurker
Offline
Joined: Sep 2002
Posts: 7
Thank you. I was a little worried that as the groups were shown as say 5-7-9 it would mean that a member of say the moderators group, or even users - would no longer belong to that group - and would only belong say to 5, 7 & 9. And not now to 2 & 3.

Sally.


Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Offline
Joined: Jun 2001
Posts: 3,273
That's what the "no change" option is for. That way an admin or moderator doesn't have to change their groups when editing their display prefs.

Otherwise yes, they could de-moderate/de-admin themselves... lol


Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
Posts: 70
Joined: January 2007
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20240430)