UBB.Dev
Posted By: JoshPet [6.2] User Group Status Flag v1.1 - 12/26/2002 9:50 AM
Mod Name / Version: UserGroupStatusFlag1.1.txt
ver 1.1 - Updated instructions to work with 6.2

Description: This hack will add an image that you supply next to a user's name based on their usergroup (like the mod and admin flag)

Working under: UBB.threads 6.2

Any pre-requisites: none

Author(s): JoshPet www.joshuapettit.com
for discussions and bugs go to www.ubbdev.com

Date: 12/26/02

Credits: kaspar for suggesting it

Files Altered: postlist.php, showflat.php, showthreaded.php

Database Altered: No.

New Files: You supply whatever custom graphic you want.

Screenshot:
[]http://www.pettitfamily.net/josh/groupflagscreen.gif[/]

Attached File
Posted By: sportbikes Re: [6.2] User Group Status Flag 1.1 - 12/30/2002 10:26 AM
Josh,

If I wanted to have 3 levels of supporters (that will later provide access to 3 level of information), I would have three more groups (5,6,7).

Would I just duplicate the "Add Special flag" section changing the group number as necessary in the 6 sections that require it?
Posted By: JoshPet Re: [6.2] User Group Status Flag 1.1 - 12/30/2002 10:59 AM
If you want them all to have different images, yes.... duplicate this section:

// ------------------
// Add the special flag if they are part of the special group - hack by JoshPet
elseif (preg_match("/-5-/",$postergroup)) { // adjust this group number if needed
$UserStatus = "<img src="{$config['images']}/specialflagA.gif" alt="SPECIAL" border="0" />";
elseif (preg_match("/-6-/",$postergroup)) { // adjust this group number if needed
$UserStatus = "<img src="{$config['images']}/specialflagB.gif" alt="SPECIAL" border="0" />";
etc....

Be sure to change the group number and image name each time.
Posted By: sportbikes Re: [6.2] User Group Status Flag 1.1 - 12/30/2002 12:27 PM
Josh,

The first group works fine, as it did before, but the mutliples didn't work. It broke where I added the additional groups. As I commented them out, the process went further and broke at the next occurance, until the additional groups were all commented out.

I have attached the BAD file, just so that you can see that I increased my groups and used seperate images.

FYI, groups were established and images were in place.


Attached File
62958-BADpostlist.txt  (251 downloads)
Posted By: JoshPet Re: [6.2] User Group Status Flag 1.1 - 12/30/2002 8:28 PM
Ack - I'm sorry, I forgot the closing }


So after each elseif statement you need a }

Like this:


// Add the special flag if they are part of the special group - hack by JoshPet
elseif (preg_match("/-5-/",$postergroup)) { // adjust this group number if needed
$UserStatus = "<img src="{$config['images']}/specialflagA.gif" alt="SPECIAL" border="0" />";
}
elseif (preg_match("/-6-/",$postergroup)) { // adjust this group number if needed
$UserStatus = "<img src="{$config['images']}/specialflagB.gif" alt="SPECIAL" border="0" />";
}
etc....

That should do it.

Sorry.

Posted By: sportbikes Re: [6.2] User Group Status Flag 1.1 - 12/31/2002 9:11 AM
Josh,

I took the Showprofile.php and Showprofile.tmpl hack for this from 6.1 and tried it as was and with some estimated changes, none of which worked for me

If you get time it would be nice to tie the loose end on this hack.

Here is what I last tried in showprofile.php which is breaking somewhere in here. Could it be the (elsif) statement (I'm doing 3 levels of support)?

// ------------------------------
// Grab the profile for this user
$User = addslashes($User);

$query = "
SELECT U_Username,U_Fakeemail,U_Name,U_Totalposts,U_Homepage,U_Occupation,
U_Hobbies,U_Location,U_Bio,U_Extra1,U_Extra2,U_Extra3,U_Extra4,U_Extra5,
U_Registered,U_Picture,U_Title,U_Status,U_Number,U_Rating,U_Rates,
U_Picwidth,U_Picheight,U_Groups,U_BirthMonth,U_BirthDay,U_BirthYear
FROM {$config['tbprefix']}Users
WHERE U_Number = '$User'
";
$sth = $dbh -> do_query($query);

// ----------------
// Assign the stuff
list ($CheckUser,$Fakeemail,$Name,$Totalposts,$Homepage,$Occupation,
$Hobbies,$Location,$Bio,$ICQ,$Extra2,$Extra3,$Extra4,$Extra5,
$Registered,$Picture,$Title,$Userstatus,$UNumber,$Rating,$Rates,
$width,$height,$Groups,$BirthMonth,$BirthDay,$BirthYear) = $dbh -> fetch_array($sth);
$dbh -> finish_sth($sth);

//-----------------
//See if they get a status flag - by JoshPet
if(preg_match("/-5-/",$Groups)) {
$UserGroup = "<img src="{$config['images']}/specialflag5.gif" alt="SuperSport Supporter" border="0" />";
}
elseif(preg_match("/-6-/",$Groups))
$UserGroup = "<img src="{$config['images']}/specialflag6.gif" alt="Superbike Supporter" border="0" />";
}
elseif(preg_match("/-7-/",$Groups))
$UserGroup = "<img src="{$config['images']}/specialflag7.gif" alt="GP Supporter" border="0" />";
}
else {
$UserGroup = "";
}
Posted By: JoshPet Re: [6.2] User Group Status Flag 1.1 - 12/31/2002 9:21 AM
So you are trying to get the flags to display in showprofile?

This looks good... what kind of error are you getting?
Posted By: sportbikes Re: [6.2] User Group Status Flag 1.1 - 12/31/2002 9:30 AM
yes, trying to show the specialflag in Showprofile next to name. You made the hack up as an in post addition to it in 6.1 HERE

It broke in line 108 of showprofile.php.
Posted By: JoshPet Re: [6.2] User Group Status Flag 1.1 - 12/31/2002 9:39 AM
Think I found it

In the second and third

elseif(preg_match("/-6-/",$Groups)) {


You are missing the { at the end.

Any time you do any kind of an "if, else, or elseif" statement, the whatever happens if it's true needs to be between { and }

Maybe I left em out somewhere.

I sometimes forget them here and there. Pain to track down sometimes.

I think the file I've attached to THIS post should do it for you.

Let me know.

I've accounted for the Birthday mod as well.


Attached File
63045-profile.txt  (153 downloads)
Posted By: sportbikes Re: [6.2] User Group Status Flag 1.1 - 12/31/2002 9:57 AM
That was it!

As always, thanks for the help and the quick response!!
Posted By: sportbikes Re: [6.2] User Group Status Flag 1.1 - 01/06/2003 8:25 AM
Josh,

I just noticed this and remembered there was no adjustment to the Threaded view?

In threaded view the first and only the first poster is reflected with the supporter icon if any posters are supporters, even if the first is NOT.

I have added an attachement showing the first poster with the icon, when he is not a supporter... only NJSII is.

I also noticed this same thing on your board, Josh.

Not all that worried about it since most of my members use Flat mode, bu thtought I would mention it.



Attached picture 63816-Snap2.jpg
Posted By: JoshPet Re: [6.2] User Group Status Flag 1.1 - 01/06/2003 5:15 PM
Thanks. I'll look at it. Threaded view has always been buggy with admin/mod flags. I think *if* that is fixed, then we should be able to get this to work there too.
Posted By: caymuc Re: [6.2] User Group Status Flag 1.1 - 01/06/2003 6:46 PM
Thanks Josh,
I think this hack is something I can really use! - Now I can flag my artistson the board as "officially approved", so people know those users are no fakers but the real artists.. Very cool!!!! Thank you!!!!
Posted By: chillin Add on for Group Status: Stealth Mode - 02/13/2003 1:26 AM
ok this was a very odd request from one of my users, but nonetheless, i'm sure someone out there might have a use for this as well (especially if they are ashamed of the ammount of time the spend on your message board)

this add-on to Josh's modification makes it so users in a specific group don't have any details show up in showflat or threaded or showprofile.php... by details i mean, registered date, # of posts, it just has their name... stealth mode!

to prepare, you will need to create a group that is a Private Group, and get that group number, in my example, that group number is -5- you will have to replace with your number in order for this to work.

As always, backup your files kids!



//showflat.php//
around line 794 find:

elseif (preg_match("/-6-/",$postergroup)) {
$postrow[$i]['UserStatus'] = "<img src="{$config['images']}/specialflag.gif" alt="SPECIAL" border="0" />";
}
replace with:

elseif (preg_match("/-6-/",$postergroup)) {
$postrow[$i]['UserStatus'] = "<img src="{$config['images']}/specialflag.gif" alt="SPECIAL" border="0" />";
}
elseif (preg_match("/-5-/",$postergroup)) {
$postrow[$i]['TotalPosts'] = "";
$postrow[$i]['Location'] = "";
$postrow[$i]['Registered'] = "";
}

**where "/-5-/" is a new group for "stealth members" change to your group number
close and save, open


showthreaded.php
around line 744 find:

$Registered = "{$ubbt_lang['REGED_ON']} $Registered";

replace with:

$Registered = "{$ubbt_lang['REGED_ON']} $Registered";
//stealth mode
if (preg_match("/-5-/",$postergroup)) {
$Registered = "";
}

and below that find:

$TotalPosts = "{$ubbt_lang['POSTS_TEXT']}: $TotalPosts";


replace with

$TotalPosts = "{$ubbt_lang['POSTS_TEXT']}: $TotalPosts";
//stealth mode
if (preg_match("/-5-/",$postergroup)) {
$TotalPosts = "";
}

showprofile.php
first off you need to add in some variables for user groups:
around line 90 find:

SELECT U_Username,U_Fakeemail,U_Name,U_Totalposts,U_Homepage,U_Occupation,
U_Hobbies,U_Location,U_Bio,U_Extra1,U_Extra2,U_Extra3,U_Extra4,U_Extra5,
U_Registered,U_Picture,U_Title,U_Status,U_Number,U_Rating,U_Rates,U_Picwidth,U_Picheight

change to:

SELECT U_Username,U_Fakeemail,U_Name,U_Totalposts,U_Homepage,U_Occupation,
U_Hobbies,U_Location,U_Bio,U_Extra1,U_Extra2,U_Extra3,U_Extra4,U_Extra5,
U_Registered,U_Picture,U_Title,U_Status,U_Number,U_Rating,U_Rates,U_Picwidth,U_Picheight,U_Groups

and find:

list ($CheckUser,$Fakeemail,$Name,$Totalposts,$Homepage,$Occupation,
$Hobbies,$Location,$Bio,$ICQ,$Extra2,$Extra3,$Extra4,$Extra5,
$Registered,$Picture,$Title,$Userstatus,$UNumber,$Rating,$Rates,
$width,$height) = $dbh -> fetch_array($sth);

and change to:

list ($CheckUser,$Fakeemail,$Name,$Totalposts,$Homepage,$Occupation,
$Hobbies,$Location,$Bio,$ICQ,$Extra2,$Extra3,$Extra4,$Extra5,
$Registered,$Picture,$Title,$Userstatus,$UNumber,$Rating,$Rates,
$width,$height,$postergroup) = $dbh -> fetch_array($sth);

and find:

if ($thisuser['U_Status'] == "Moderator") {
if ( ($config['modedit']) && ($Userstatus == "User") ) {
$useredit = "<img src="{$config['images']}/editicon.gif" align="top" alt="" /> ";
$useredit .= "<a href="{$config['phpurl']}/admin/login.php?Cat=$Cat&User=$User&option=oneuser">{$ubbt_lang['EDIT_T_U']}</a> | ";
}
}

and replace with

if ($thisuser['U_Status'] == "Moderator") {
if ( ($config['modedit']) && ($Userstatus == "User") ) {
$useredit = "<img src="{$config['images']}/editicon.gif" align="top" alt="" /> ";
$useredit .= "<a href="{$config['phpurl']}/admin/login.php?Cat=$Cat&User=$User&option=oneuser">{$ubbt_lang['EDIT_T_U']}</a> | ";
}
}
if (preg_match("/-5-/",$postergroup)) {
$Totalposts = '';
$Registered = '';
$date = '';
}

and your done, you now have STEALTH MODE
Posted By: JoshPet Re: Add on for Group Status: Stealth Mode - 02/13/2003 2:03 AM
LOL

Good idea. Thanks for posting it.
Some users are funny about what gets displayed.
Posted By: chillin Re: Add on for Group Status: Stealth Mode - 02/13/2003 6:04 AM
forgot to add in that i modded user list as well so heaven forbid his register date and post count wouldn't show up there either.

he offered me $ to do it as well!
Posted By: JoshPet Re: [6.2] User Group Status Flag 1.1 - 02/13/2003 8:38 AM
Moved to Finished Mods forum.
Posted By: MattUK Re: [6.2] User Group Status Flag 1.1 - 03/20/2003 8:50 PM
I cannot get this working under 6.2.3

If I set the group to 3, then everyone gets the moderator flag regardless, but any other group, and nothing happens.

Any ideas?
Posted By: JoshPet Re: [6.2] User Group Status Flag 1.1 - 03/20/2003 9:35 PM
3 would be the "User" group, which everyone belongs to.

I think it would have to be a user group 5 or higher.
Posted By: MattUK Re: [6.2] User Group Status Flag 1.1 - 03/20/2003 11:45 PM
Yeah I get that part, but any other number doesn't work.. I've created loads of new groups (which it seems I now cant delete) and it doesnt work with any of them.
Posted By: raziel_dup1 Re: [6.2] User Group Status Flag v1.1 - 03/23/2003 6:22 AM
I installed this hack on 6.2.3 this evening, but I'm having problems with the threaded view. The icons won't show up on the reply list.

I'm assuming this is handled by the code changes around line 150 in showthreaded.php. My hacked area looks like this:

elseif (preg_match("/-5-/",$postergroup)) { // adjust the group number if needed
$UserStatus = "<img src="{$config['images']}/industry.gif" alt="Industry Rep" border="0" />";
}
elseif (preg_match("/-6-/",$postergroup)) { // adjust the group number if needed
$UserStatus = "<img src="{$config['images']}/aodstaff.gif" alt="AoD Staff" border="0" />";
}
elseif (preg_match("/-7-/",$postergroup)) { // adjust the group number if needed
$UserStatus = "<img src="{$config['images']}/va.gif" alt="Voice Actor" border="0" />";
}
elseif (preg_match("/-8-/",$postergroup)) { // adjust the group number if needed
$UserStatus = "<img src="{$config['images']}/retailer.gif" alt="Retailer" border="0" />";
}
Posted By: JoshPet Re: [6.2] User Group Status Flag v1.1 - 03/23/2003 7:14 AM
It's never worked right in the replies of threaded view. It's tacked onto the admin /mod flag thing... and I don't believe that the admin /mod flags have ever worked right in threaded view on replies. I think that's always been a bug.

I always assumed that when the Admin/Mod flag issue gets resolved in threads, this would function properly in that area as well.
Posted By: JoshPet Re: [6.2] User Group Status Flag v1.1 - 03/23/2003 10:15 AM
Well... it appears the admin/mod flags are working properly in the latest version of threads.

I'll have to look at this bit again.... it should work the same as admin/mod flags. It probably wont' be until I get back from vacation until I can look at it though.
Posted By: MattUK Re: [6.2] User Group Status Flag 1.1 - 03/24/2003 12:46 AM
Any ideas Josh? This just does not work..
Posted By: JoshPet Re: [6.2] User Group Status Flag 1.1 - 03/24/2003 1:07 AM
No I use this myself on several production sites, probably for almost a year. No problems.
You've never posted any details of what "doesn't work"... so without more details, I don't really have any answers other than start again with a clean copy of the scripts and make sure you got all the steps.

95% of the problems with hacks, (and this happens when I install them as well) are problems with doing all the steps. When I have trouble.... first I backup and try again and make sure I did't miss a step.

Then if that still doesn't work, then I suspect a conflict with another hack... so then I try with a clean "out of the box" copy of the scripts. That usually helps me narrow it down.
Posted By: MattUK Re: [6.2] User Group Status Flag 1.1 - 03/24/2003 1:14 AM
I'm sure I have!

I have entered the code as requested. However, no users are getting the new little flag.

If I change the setting to group 2 or 3 which would be for Moderators, or Users, then the flags are applied as I would expect.. but using any group that has been created, it ignores it, and you do not see the flag.

I have tried all the steps multiple times, and the same thing happens time and time again.

I have no other hacks installed on version 6.2.3.

It is now set to "5" which is for the group I have created, I have added some users to this group, and there are no flags.

Totally lost now..
Posted By: JoshPet Re: [6.2] User Group Status Flag 1.1 - 03/24/2003 1:23 AM
Do you not get flags anywhere? Or in just a particular script.
Posted By: MattUK Re: [6.2] User Group Status Flag 1.1 - 03/24/2003 1:52 AM
Hi.

No flags anywhere.. the only time I see a flag, is if I change it to group 2 or 3.. very weird!
Posted By: JoshPet Re: [6.2] User Group Status Flag 1.1 - 03/24/2003 1:55 AM
OK

Find the user number of a user in group 5 or whatever.... whoever should have a flag and run this query:

SELECT U_Groups
FROM w3t_Users
WHERE U_Number = 'xxxx'


Posted By: MattUK Re: [6.2] User Group Status Flag 1.1 - 03/24/2003 2:08 AM
[]JoshPet said:
OK

Find the user number of a user in group 5 or whatever.... whoever should have a flag and run this query:

SELECT U_Groups
FROM w3t_Users
WHERE U_Number = 'xxxx'


[/]

Interestingly it only shows -3- and not -5- .. and yet if I goto the mass group manager, and try to add the user again, it does show him as listed
Posted By: JoshPet Re: [6.2] User Group Status Flag 1.1 - 03/24/2003 2:15 AM
I'm not sure why it's not letting you properly change the user's groups.

Might want to reupload the /admin/showgroup.php and /admin/dochangegroup.php scripts. (I think that's what they are called.)

You can test the status flags by doing this:

UPDATE w3t_Users
SET U_Groups = '-5-'
WHERE U_Number = 'xxx'

That'll update that user, and you can see if the flags are working properly.
Posted By: MattUK Re: [6.2] User Group Status Flag 1.1 - 03/24/2003 2:21 AM
Thanks Josh, forcing the membership works.. so I guess the hack IS working, but the group membership side of UBB isnt working Ill have to raise that with Infopop then, could also explain why I have never been able to demote moderators!
Posted By: MattUK Re: [6.2] User Group Status Flag 1.1 - 03/24/2003 2:24 AM
Josh, the previous query now only shows the user in -5- and not -3- any more.. how do I ensure that he is in both groups?
Posted By: JoshPet Re: [6.2] User Group Status Flag 1.1 - 03/24/2003 2:35 AM
Ah....

UPDATE w3t_Users
SET U_Groups = '-3-5-'
WHERE U_Number = 'xxx'

Have you done much hacking? If you haven't done much to the admin section, I would try uploading a clean copy of the /admin directory... then see if the group problem is fixed. It would seem to me that an old script, without the get_input function of 6.2 might be kicking around.
Posted By: MattUK Re: [6.2] User Group Status Flag 1.1 - 03/24/2003 2:41 AM
Thanks very much.. wish I learned SQL!

I've been looking at this a little more, and I think that my group 5, or at least the group I thought was 5, isnt in fact 5.. I've listed (using the above commands) other users that ive added to groups, and they are not listed as being in -5- but numbers up as high as -23- .. seeing as I only have 7 groups, how the hell did they get that high?

How do I find out what numbers my groups are?!

Threads is nice, but the user managment side of it is crap!
Posted By: JoshPet Re: [6.2] User Group Status Flag 1.1 - 03/24/2003 2:45 AM
Groups don't renumber themselves. Thats why there is no way to delte them... deleting them creates issues. Did you delete any along the way?

Try this to see the content of your groups table and what numbers they are:

SELECT *
FROM w3t_Groups

That'll list everything.
Posted By: MattUK Re: [6.2] User Group Status Flag 1.1 - 03/24/2003 3:03 AM
No, never deleted any wouldn't know how if there was no menu item.. can only assume its from the UBB days when we imported it in.

Now I have updated the code with 23, and everything has kicked into life!

So, MANY thanks for your help in getting it working.

<happy bunny>
Posted By: Gardener Re: [6.2] User Group Status Flag 1.1 - 05/11/2003 10:48 PM
I just did a fix for this, it now shows the specialflag correctly in expanded view on postlist as well as in the thread list on showthreaded.

It's for 6.1 though. It's most certainly working differently in later versions.
Posted By: JoshPet Re: [6.2] User Group Status Flag 1.1 - 05/12/2003 4:23 AM
I haven't had a chance to play with this - but would like to re-write this for 6.3 with an admin panel to add images and configure the groups.

So I still need to play with the "fix".

If I can't figure it out - I may ask your guidance.
Posted By: Gardener Re: [6.2] User Group Status Flag 1.1 - 05/12/2003 4:30 AM
What I did was do a join with the Users table to get the correct group value for each post, and had this added to the $tree-array. The way it works now it only checks on $postergroup which is the group for the post you are looking at, which is not the same as what should be shown in the list. Also, inside the show_replies() function it won't even apply as that value is set outside the function.

In 6.2+ the join is already there, so it's mostly a matter of adding U_Groups to the query in all places in both postlist and showthreaded. And passing it along in the $tree array along with all the other values of course.
Posted By: JoshPet Re: [6.2] User Group Status Flag 1.1 - 05/12/2003 4:46 AM
Thanks - probably missed some "clean up" when I updated from 6.1 to 6.2 with this mod.
Posted By: Bradley Noe Re: [6.2] User Group Status Flag 1.1 - 07/02/2003 1:05 PM
Josh, think you'll have it done for 6.3?
Posted By: JoshPet Re: [6.2] User Group Status Flag 1.1 - 07/02/2003 9:32 PM
I need to.

It's on my list.
Posted By: Bradley Noe Re: [6.2] User Group Status Flag 1.1 - 07/02/2003 10:25 PM
[]JoshPet said:

It's on my list. [/]
I have one of those "to do lists" its a mile long, I dont think I ever finish anything, I just add stuff to it
Posted By: Gardener Re: [6.2] User Group Status Flag 1.1 - 07/02/2003 11:13 PM
Yeah, same here, although I've got several todo lists. Sometimes I do stuff instead of adding them to the todo list just because it pains me to look at it since it's so long. =P
Posted By: JoshPet Re: [6.2] User Group Status Flag 1.1 - 07/03/2003 12:58 AM
I definately have to do this one before I update measurection - because we use it there for our supporters. And I do want to get that site updated one of these days soon.... it's still running 6.2.
Posted By: kaspar Re: [6.2] User Group Status Flag 1.1 - 07/23/2003 9:18 PM
Did you get a chance to update this to 6.3.1?
Posted By: AKD96 Re: [6.2] User Group Status Flag 1.1 - 07/24/2003 12:52 AM
Here are updated instructions for 6.3.1

Attached File
Posted By: AKD96 Re: [6.2] User Group Status Flag 1.1 - 08/13/2003 3:02 AM
I have fixed a few typos in the instructions above
Posted By: smilesforu Re: [6.2] User Group Status Flag 1.1 - 01/06/2004 10:43 PM
Anybody running a 6.4 on this one
Posted By: Deejay_dup1 Re: [6.2] User Group Status Flag 1.1 - 05/29/2004 1:43 AM
Im wondering that too.... I just updated to 6.4.2 today... Hope so!! (didn see a new one for 6.4 in the forum yet.. maybe i missed it?)

Deej
Posted By: Deejay_dup1 Re: [6.2] User Group Status Flag v1.1 - 05/29/2004 1:46 AM
Ignore me... I see there is a new mod now that does better than this for 6.4.2... in the current mods area.. thanks josh!
Posted By: coloradok5 Re: [6.2] User Group Status Flag v1.1 - 10/23/2004 9:55 PM
Anybody running this on 6.4.4 ?
Posted By: JoshPet Re: [6.2] User Group Status Flag v1.1 - 10/23/2004 10:06 PM
I've run it on 6.4 and 6.5 - Instructions are pretty close - if I get a chance, I'lll update and repost.
Posted By: coloradok5 Re: [6.2] User Group Status Flag v1.1 - 10/23/2004 11:06 PM
Posted By: JoshPet Re: [6.2] User Group Status Flag v1.1 - 11/16/2004 11:11 AM
I finally reposted this:
https://www.ubbdev.com/forum/showflat.php?Cat=0&Number=123059
© UBB.Developers