Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
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[/]
Attachments
62515-UserGroupStatusFlag1.1.txt (0 Bytes, 278 downloads)

Sponsored Links
Joined: Oct 2002
Posts: 165
Member
Member
Offline
Joined: Oct 2002
Posts: 165
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?

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
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.

Joined: Oct 2002
Posts: 165
Member
Member
Offline
Joined: Oct 2002
Posts: 165
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.
Attachments
62958-BADpostlist.txt (0 Bytes, 251 downloads)

Last edited by sportbikes; 12/30/2002 5:32 AM.
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
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.


Sponsored Links
Joined: Oct 2002
Posts: 165
Member
Member
Offline
Joined: Oct 2002
Posts: 165
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 = "";
}

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
So you are trying to get the flags to display in showprofile?

This looks good... what kind of error are you getting?

Joined: Oct 2002
Posts: 165
Member
Member
Offline
Joined: Oct 2002
Posts: 165
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.

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
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.
Attachments
63045-profile.txt (0 Bytes, 153 downloads)

Joined: Oct 2002
Posts: 165
Member
Member
Offline
Joined: Oct 2002
Posts: 165
That was it!

As always, thanks for the help and the quick response!!

Sponsored Links
Joined: Oct 2002
Posts: 165
Member
Member
Offline
Joined: Oct 2002
Posts: 165
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.

Attachments
63816-Snap2.jpg (0 Bytes, 158 downloads)

Last edited by sportbikes; 01/06/2003 1:32 AM.
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
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.

Joined: Jan 2001
Posts: 374
Enthusiast
Enthusiast
Offline
Joined: Jan 2001
Posts: 374
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!!!!

Joined: Jan 2003
Posts: 125
Journeyman
Journeyman
Joined: Jan 2003
Posts: 125
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

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
LOL

Good idea. Thanks for posting it.
Some users are funny about what gets displayed.

Joined: Jan 2003
Posts: 125
Journeyman
Journeyman
Joined: Jan 2003
Posts: 125
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!

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Moved to Finished Mods forum.

Joined: Nov 2001
Posts: 134
Journeyman
Journeyman
Offline
Joined: Nov 2001
Posts: 134
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?

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
3 would be the "User" group, which everyone belongs to.

I think it would have to be a user group 5 or higher.

Joined: Nov 2001
Posts: 134
Journeyman
Journeyman
Offline
Joined: Nov 2001
Posts: 134
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.

Joined: Mar 2003
Posts: 1
Lurker
Lurker
Offline
Joined: Mar 2003
Posts: 1
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" />";
}

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
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.

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
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.

Joined: Nov 2001
Posts: 134
Journeyman
Journeyman
Offline
Joined: Nov 2001
Posts: 134
Any ideas Josh? This just does not work..

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
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.

Joined: Nov 2001
Posts: 134
Journeyman
Journeyman
Offline
Joined: Nov 2001
Posts: 134
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..

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Do you not get flags anywhere? Or in just a particular script.

Joined: Nov 2001
Posts: 134
Journeyman
Journeyman
Offline
Joined: Nov 2001
Posts: 134
Hi.

No flags anywhere.. the only time I see a flag, is if I change it to group 2 or 3.. very weird!

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
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'



Joined: Nov 2001
Posts: 134
Journeyman
Journeyman
Offline
Joined: Nov 2001
Posts: 134
[]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

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
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.

Joined: Nov 2001
Posts: 134
Journeyman
Journeyman
Offline
Joined: Nov 2001
Posts: 134
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!

Joined: Nov 2001
Posts: 134
Journeyman
Journeyman
Offline
Joined: Nov 2001
Posts: 134
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?

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
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.

Joined: Nov 2001
Posts: 134
Journeyman
Journeyman
Offline
Joined: Nov 2001
Posts: 134
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!

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
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.

Joined: Nov 2001
Posts: 134
Journeyman
Journeyman
Offline
Joined: Nov 2001
Posts: 134
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>

Joined: May 1999
Posts: 1,715
Addict
Addict
Joined: May 1999
Posts: 1,715
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.

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
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.

Joined: May 1999
Posts: 1,715
Addict
Addict
Joined: May 1999
Posts: 1,715
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.

Page 1 of 2 1 2

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
isaac
isaac
California
Posts: 1,157
Joined: July 2001
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
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 20221218)