Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
public-topic
Question regarding sp_add_membership()
Avatar
Ryan
Member
sp_UserOfflineSmall Offline
May 23, 2016 - 5:23 pm
sp_QuotePost Quote

Hey,

I already use sp_add_membership and sp_remove_membership but I can't find anywhere a function to do the same thing but by name of the forum group ie "Members" instead of by ID, for example the number 1... 

Also, I can't even find where you'd find the id for the membership, I usually have to do it by the database.

Any idea?

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
May 23, 2016 - 5:55 pm
sp_QuotePost Quote

I already use sp_add_membership and sp_remove_membership but I can't find anywhere a function to do the same thing but by name of the forum group ie "Members" instead of by ID, for example the number 1...  

When you say 'forum group' you are referring to a User Group - correct? If you want a user group ID then you can get it on the Manage User Groups listing. It is over on the left.

andy-signature.png
YELLOW
SWORDFISH
Avatar
Ryan
Member
sp_UserOfflineSmall Offline
May 24, 2016 - 12:52 am
sp_QuotePost Quote

Hey,

Yeah, I am on about the user group. It would be good if the sp_add_membership function supported both integers (user group ids) & text (user group names) or is there an easy way to convert the user group name into a user group ID?

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
May 24, 2016 - 1:27 am
sp_QuotePost Quote

well, as @yellow-swordfish says, you can get the ID for the usergroup name on the forum - usergroup - mange usergroups admin panel...

or you can do a query yourself to get the usergroup id from the name... something like (untested):

$usergroupname = 'xxxxxx';
$id = spdb_table(SFUSERGROUPS, "usergroup_name='$usergroupname'", 'usergroup_id');

just change xxxxxx to your name...

Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 650
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 620
Members: 17365
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10128
Posts: 79626