php forum
php mysql forum
php mysql smarty
 
Topic Options
#315319 - 08/21/07 06:25 PM Rant: Still Frustrated With UBB7.x Groups Setup
Calpy Offline
Power User

Registered: 12/17/02
Posts: 71
Arrgh, ever since I upgraded from UBB 6.5b5 long long ago, the change from having a user's groups listed as a string (ie: -3-5-7-) to a sequence of DB entries has made several of my most important revenue-generating hacks and mods impossible. I was told that this change made it possible to have "more groups", but I personally will never use more than 10, and even if I were using 50 groups, the change has made it impossible for me to do anything with whatever groups I have (aside from UBB's built in group-based forum access permissions).

There is no simple way (ie: UBB6.5's calling U_Groups and searching for the significant one) to make this or that thing conditional to a member belonging to a certain group any more. No more group-specific vanity images (that people were willing to pay for), no more unlimited edit time or other perks for members of a specific paying group. For the longest time now, I've had to handle every one of those things manually, and every time I go back into the code and look at automating it, I end up giving up in frustration because I'm a decent modder, but not a full up php programmer. ARRGH!

Can anyone share a simple snippet of multi-use UBB 7x code that checks for group membership in such a way that results are usable in a basic IF conditional, along the lines of this UBB6.5 gem:
Php Code:
$user = $userob -> authenticate("U_TextCols, U_TextRows, U_Preview,U_Groups");
$Username = $user['U_Username'];

// If they are special - give them longer edit time - by JoshPet
	if (strstr($user['U_Groups'],"-5-")) {
		$config['edittime'] = 99999;
	}  

Top
#315320 - 08/21/07 06:45 PM Re: Rant: Still Frustrated With UBB7.x Groups Setup [Re: Calpy]
Ian Spence Offline
Master Hacker

Registered: 01/25/03
Posts: 3765
Loc: Saint Johns, PA
Code:
$user_group_strings = array();

$query = "
	SELECT	GROUP_ID, USER_ID
	FROM	{$config['TABLE_PREFIX']}GROUPS
	WHERE	USER_ID in ( ? )
	GROUP BY USER_ID
";

$sth_groups = $dbh->do_placeholder_query($query, array($user_ids), __LINE__, __FILE__);

while ($result = $dbh->fetch_array($sth_groups)) {
	if (!isset($user_group_strings["{$result['USER_ID']}"])) {
		$user_group_strings["{$result['USER_ID']}"] = '-';
	}
	
	$user_group_strings[$result['USER_ID'] + 0] .= $result['GROUP_ID'] . '-';
}

// Check if user who is viewing this is in group 7
if (strstr($user_group_strings[$user['USER_ID'] + 0], "-7-")) {
	// Yep	
}


You need to know the user ids of the people you want to search for. So for editing pages, $user_ids is just an array containing $user['USER_ID'], where in showflat.inc.php, you'd want an array containing the user id of everyone who was on that page of the topic
_________________________
Code monkey like Fritos

Top
#315321 - 08/21/07 06:56 PM Re: Rant: Still Frustrated With UBB7.x Groups Setup [Re: Ian Spence]
Calpy Offline
Power User

Registered: 12/17/02
Posts: 71
Thanks, I'll try this.

Top
#315324 - 08/21/07 07:43 PM Re: Rant: Still Frustrated With UBB7.x Groups Setu [Re: Calpy]
sirdude Moderator Offline
Enthusiast

Registered: 11/08/03
Posts: 442
Loc: SoCal
A new mod that allows for some group based features

easy to expand upon that wink

and if you just want a nice snippet for "if user in group x", just open up ian spence's user auth mod (text)

and you will see it there smile
_________________________

Top


Moderator:  sirdude 
Who's Online
0 registered (), 23 Guests and 12 Spiders online.
Key: Admin, Global Mod, Mod
Shout Box

Latest Posts
Wisdom needed
by Gizmo
Today at 10:54 AM
How to hide sub forums from summary page
by blaaskaak
Yesterday at 09:54 AM
Spell Check [beta]
by Bill B
12/01/08 09:16 PM
PhotoPost BB Code Popup
by AllenAyres
12/01/08 09:41 AM
Problems reading a lot of old posts here
by AllenAyres
12/01/08 09:35 AM
Forum 'Trader Ratings'.
by AllenAyres
12/01/08 09:33 AM
Customization needed
by Gizmo
11/12/08 12:28 PM
New Mods
User Authentication Class
by
01/19/07 02:59 PM
Multiple Identity Detector
by
12/30/06 06:39 PM
PhotoPost BB Code Popup
by
11/06/06 05:43 PM
Spell Check [beta]
by
10/17/06 09:24 PM
Newest Members
Truth, David DelMonte, nick1, Begbie, cenk
13364 Registered Users
Top Posters
AllenAyres 25452
JoshPet 11330
Rick 8372
LK 7396
Lord Dexter 6503
Greg Hard 5533
Charles Capps 5438

 

 

 
fusionbb message board php hacks