Previous Thread
Next Thread
Print Thread
Hop To
#223783 03/08/2009 1:23 PM
Joined: Aug 2006
Posts: 583
old hand
old hand
Joined: Aug 2006
Posts: 583
I have modified editbasic.tpl to remove the option for members to pick what group icons are displayed. I have 4 levels of paid service and of course admin and moderator icons to display. I figured out by using a test user how to force the group images I want, for example:
SQL Query
UPDATE prefix_USER_PROFILE AS up, prefix_USER_GROUPS AS ug
SET up.USER_GROUP_IMAGES = 'a:1:{i:0;s:1:"8";}'
WHERE ug.GROUP_ID = '8' AND ug.USER_ID = up.USER_ID

Will set all users in group 8 (Bronze in my system) to display the bronze group icon (a bronze star).

what I don't understand, but want to, is how to interpret what gets set in USER_GROUP_IMAGES field since I did not study latin crazy

For example:

a:1:{i:0;s:1:"9";} will set a member to silver (group 9)

but

a:1:{i:0;s:2:"10";} will set a member to gold. One has s:1 and the other s:2

Then, if I have a moderator who is also a silver member, it would be:

a:2:{i:0;s:1:"3";i:1;s:1:"9";}
but if he is a gold member it is:

a:2:{i:0;s:1:"3";i:1;s:2:"10";} (again, note s:1 versus s:2??)

Can someone explain how to interpret the different parts of this group image code?

Thanks.

Basil #223795 03/08/2009 7:56 PM
Joined: Mar 2008
Posts: 326
D
Enthusiast
Enthusiast
D Offline
Joined: Mar 2008
Posts: 326
That is an example of PHP Serialize. I only read up on it a little to answer your previous question, so I don't know much about it yet so I probably wouldn't do it justice trying to explain it. The link above will lead you to some links in Google that you can peruse, if you like, whilst you wait for a more edumacated person to chime in.

Joined: Apr 2007
Posts: 3,940
Likes: 1
SD Offline
Former Developer
Former Developer
Joined: Apr 2007
Posts: 3,940
Likes: 1
a -- array
a:1 -- array with 1 element (ie: they are in one group)
a:2 -- array with 2 elements (ie: they are in 2 groups, moderator and another group)

s -- string
s:1 -- string with 1 character (ie: 9)
s:2 -- string with 2 characters (ie: 10)

; -- delimeter between array elements

i:0 -- array index 0
i:1 -- array index 1

wink

SD #223799 03/08/2009 10:48 PM
Joined: Aug 2006
Posts: 583
old hand
old hand
Joined: Aug 2006
Posts: 583
THANKS! That makes perfect sense!


Link Copied to Clipboard
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Recent Topics
Bots
by Outdoorking - 04/13/2024 5:08 PM
Can you add html to language files?
by Baldeagle - 04/07/2024 2:41 PM
Do I need to rebuild my database?
by Baldeagle - 04/07/2024 2:58 AM
This is not a bug, but a suggestion
by Baldeagle - 04/05/2024 11:25 PM
Is UBB.threads still going?
by Aaron101 - 04/01/2022 8:18 AM
Who's Online Now
1 members (1 invisible), 471 guests, and 191 robots.
Key: Admin, Global Mod, Mod
Random Gallery Image
Latest Gallery Images
Los Angeles
Los Angeles
by isaac, August 6
3D Creations
3D Creations
by JAISP, December 30
Artistic structures
Artistic structures
by isaac, August 29
Stones
Stones
by isaac, August 19
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20240430)