Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
general-topic
Some issues with forum images and some features
Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Dec 7, 2015 - 12:32 pm

No that's not normal. Normal would see a member just be assigned to a different group while keeping the original group membership. And again - we do have a lot of users with this setup. Back t the action hooks... are they being fired correctly?

andy-signature.png
YELLOW
SWORDFISH
Avatar
Yehonal
Member
sp_UserOfflineSmall Offline
Dec 7, 2015 - 1:19 pm

Yellow Swordfish said
No that's not normal. Normal would see a member just be assigned to a different group while keeping the original group membership. And again - we do have a lot of users with this setup. Back t the action hooks... are they being fired correctly?

I think it is a problem of "user role editor" plugin to assign multiple wp roles. However i cannot disable it . [OT] It's a huge limitation for a CMS to not allow flexible ACL by default . I miss joomla in this case [/OT]

However i've a workaround but i'm searching for an function that allows me to add/remove users from a group programmatically. 

Is there anything similar?

Where can i find a documented list of function to avoid bothering you next time?

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Dec 7, 2015 - 2:48 pm

We are slowly getting all of the API documented in the codex but it is slow work and sadly not yet complete.

I think the function you need is:

sp_map_role_to_ug($userid, $role)

if I am wrong there I am sure @mr-papa will ome and post a correction!

This is in the sp-api-users,php file by the way

andy-signature.png
YELLOW
SWORDFISH
Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Dec 7, 2015 - 9:46 pm

wait...  you want to remove/add users to a simple press user group?  then it would be:

sp_add_membership($usergroup_id, $user_id)

and

sp_remove_membership($usergroup_id, $user_id)

the function @yellow-swordfish gave you would take all users for a specific wp user role and give them membership in a usergroup... 

so depends on what you want to do programmatically...

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