News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Managing permissions for an addon

Started by JAAulde, September 13, 2004, 09:25:58 AM

Previous topic - Next topic

JAAulde

Hello,

I am programming a site that has SMF as the forums, as well as the system that checks user login/information throughout the rest of the site (via SSI.php).

There are several features on this site that I want all members to have rights to upon sign up, but should they abuse a feature, I can block them from it without blocking them from anything else.

Let's discuss it in terms of a single feature for now.  How do I allow all members access to this feature until I determine they have abused it?  Should I create a member group and check to see if they belong to that group before continuing with the feature program?  If not, what else is available?

If the member group is the way to go, how do I ensure all members are added to the group immediately upon sign up?  I also don't want the adding of this user group to affect any of the standard permissions a user should have on the boards upon sign up--they should not have any special privileges on the board because they are in the group--I just want to check if they are in the group before I give them access to this feature outside the boards.

I hope this makes sense.  All the permission stuff and member groups always confuse me.   :-[

Thanks to anyone who offers help!

Jim

Elissen

Using membergroups is the way to go if you don't want to modify the source of SMF I think. And you can do it the other way around, if they are a member of a certain group then deny it :). And if you don't want other members to see if a person has been "restricted" you can select that membergroup under "additional membergroups" in their profile. Only admins can see that.

<?php
        
global $user_info;
        if (!in_array(9$user_info['groups'])) {
        // the extras
        }
?>
Where 9 is the id of the excluded membergroup

JAAulde

Excellent!  I thank you kindly and will look into your suggestion.  Seems it's the way to go.

[Unknown]

Permissions are nice too ;).  I'll be writing a full-fledged tutorial on them in not too long...

-[Unknown]

Elissen


[Unknown]

Well, as an example, you could say:

if (allowedTo('who_view'))
  echo 'You\'re so awesome, we\'ve allowed you to view who\'s online!!';

-[Unknown]

Elissen

I know that principle, but my worries are more with upgrading. I'm hesitant to make changes to the source files of SMF becouse of it. I know the package manager should be able to reapply them, but when I tried to make a package of some other changes I ran into some problem that the package manager failed to apply the mod. Probaly an error on my part.

But that is an entirely different topic :)

Advertisement: