Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Dec 2002
Posts: 67
Power User
Power User
Joined: Dec 2002
Posts: 67
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;

Sponsored Links
Joined: Jan 2003
Posts: 3,456
Likes: 2
Master Hacker
Master Hacker
Joined: Jan 2003
Posts: 3,456
Likes: 2
$user_group_strings = array();

$query = "
WHERE USER_ID in ( ? )

$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, you'd want an array containing the user id of everyone who was on that page of the topic

Joined: Dec 2002
Posts: 67
Power User
Power User
Joined: Dec 2002
Posts: 67
Thanks, I'll try this.

Joined: Nov 2003
Posts: 482
Joined: Nov 2003
Posts: 482
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

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
Visit us on Facebook
Member Spotlight
Portland, OR, USA
Posts: 5,833
Joined: January 2000
Forum Statistics
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
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-2023 VNC Web Services

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