Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
coding-topic
User Groups and Forum Access
Avatar
Stan Dahl
Member
Free Members
sp_UserOfflineSmall Offline
Oct 20, 2015 - 4:38 pm

Hi,

I'm working on some custom API coding and have things working as intended.

However, upon examining the database, I see in the sfmemberships table that my test user now belongs to 2 usergroups.

The newest group being the one my custom programming just added them to.

And the original group which is defined as "No Forum Access"

When I login and view the forum on this user I am not seeing anything.

Should I be removing this usergroup assignment in this case?

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Oct 20, 2015 - 4:42 pm

Whether a user can be in one or multiple user groups is controlled by the User Group settings under the 'Map Users to User Group' Admin option. Can I assume you have that setting turned off? Does that help?

andy-signature.png
YELLOW
SWORDFISH
Avatar
Stan Dahl
Member
Free Members
sp_UserOfflineSmall Offline
Oct 20, 2015 - 6:06 pm

Yes, that was turned off - figured out what I was doing wrong - now it works.

is there a way I can check that that option via the API?

Also, what's the difference between these 2 options?


Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Oct 21, 2015 - 12:02 am

the difference is quite simple... if a user has a membership, and you add another membership (using the api vice direct db queries), if the single membership option is checked, all existing memberships are removed before the new one is added...

sorry, check what?  whether you have the single membership option check in your admin or not???  why would you need to check your site admin setting?  its forum wide, not user option... but, yes, you can query for the option if really needed.. something like this:

$sfmemberopts = sp_get_option('sfmemberopts');
$single = $sfmemberopts['sfsinglemembership'];

then $single contains the state of the option...

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: 649
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 616
Members: 17348
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10118
Posts: 79603