Community Documentation

v3 Knowledgebase

User groups management (Musician accounts and special privileges and behaviors)

User Groups

Phpfox v2 introduces a rich user group system. Every member belongs to a user group and special permissions (or limitations) are set for each user group. Additionally special input fields can be set for desired user groups.

Managing Existing User Groups

We start with this topic to have a quick survey of what the script offers by default, we dont want you trying to add something that is already there.

It all happens on the AdminCP, so if you go there and mouse over the Users -> User Group Manager -> click on Manage User Groups you will be shown the list of user groups available. To the left of each of them you can find an icon which when you click displays a menu. Click the one next to Registered User and then click on Manage User Group. You will now see a list of the modules available and the permissions they offer. Lets say you want to change how many points they get when uploading photos, you click on the Photo module and then look for "Points received when uploading a new image". Another popular setting is "Can upload photos?" and "For a photo that is marked as "Mature (Strict)" define the age limit?"

Adding User Groups

You can create new user groups in very easy way. Again go to the AdminCP -> Users -> User Group Manager -> Create New User Group. You need to specify a name for this user group and choose from which user group it inherits permissions but the other inputs are optional. Inheriting permissions allows you to copy the current set of permissions (like shown in the previous section) from another group into the new one.

Adding User Group Settings

This section is only for developers, when they are creating a new option (via a plug in or a module) they can add special permissions from here.


Phpfox allows you to set subscriptions, which is basically a mechanism for changing users from one to another user group. You can use this to promote certain features, for example you may want to allow only a special user group the privilege of posting in the forum. This also serves as a way for your site to generate some direct income as you can charge for this change of user group. From this point on we will assume you have at least 2 user groups because the subscription requires it, one as a "On success" user group and one as a "On failure" user group. The on failure group will be the new user group when their order is not completed, this includes recurrent payments.

Create Subscription Packages

You can create a subscription package by going to the AdminCP -> Modules -> Subscribe -> Create New Package. If you want to have different user groups in your registration page this is the place to do it, just make sure you choose "Add to registration" -> Yes.

Full Example

Given the popular need for this I think its best if we tackle on a real live example, hopefully this will clear any question and help you get your site the way you want it.

Create a new User Group

Simply go to the AdminCP -> Users -> User Group Manager -> Create User Group. Here the only required field is the "Name", in our example we will create a new user group called "Photographer" so thats what we put there. The other fields are optional but perhaps you will be interested in the "Inherit" field, this field allows you to copy the current user group settings from another user group. Suppose you only allow models to upload photos, but the about-to-be-created-usergroup also needs to upload photos so maybe its better to copy the full array of settings from the models user group than from the Registered user group. The Registered user group is the default one and if this is the first user group you would be wise to inherit from Registered. Click on "Add user group" and this part is done.

Adding Custom Fields

This is where most people get confused, so if you had problems here dont feel bad.

Create the database tables

The script stores information in the database, but every user group needs its own couple of tables, nothing fancy but we need to make them by hand at this point (2.0.4). This is planned to be automatic in a future release but meanwhile lets get to it. The following two queries would apply for the photographer user group we are creating, you will most likely change the name to something else but this is a good template:

CREATE TABLE `phpfox_photographer_value` (`user_id` int(10) unsigned NOT NULL,UNIQUE KEY `user_id` (`user_id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;
CREATE TABLE `phpfox_photographer` (`user_id` int(10) unsigned NOT NULL,UNIQUE KEY `user_id` (`user_id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1

What to do with this mambo-jambo? pretty easy, just go to Phpmyadmin, select your database, click on SQL, copy the codes above and paste there, click submit and that should create the 2 tables needed for you. If you have any problem here (dont have Phpmyadmin), go to your hosting company, they are the ones who manage your databases and they for sure know what to do with this. If you are not working with our example be sure to change the names to something more appropriate, you would do that by changing the word "photographer" in the SQL code above

Creating a Product

To create a Product (if you dont already have one) just go to AdminCP -> Extensions -> Product -> Create New Product. The product Id can be the name of your website and you can leave product url and version check url blank. Why do we need to create a product? Its more a matter of keeping everything organized, if you create a product for your website and your new languages, themes, modules and user group fields belong to that product you can later on easily migrate it to another project, or even sell it if thats in your interest.

Enabling custom fields

Even when we have created the tables and the user group we need to tell the script that this user group can have custom fields, so we just go to AdminCP -> Users -> User Group Manager. Next to your Photographer user group theres an icon (a little gray arrow), click it and click on Manage User Settings. Look for "Custom" (this is the "custom" module fyi) and make sure "Can have special custom fields?" is set to Yes, then on "Custom field database table name?" write: photographer This is related to the database tables that we created before (phpfox_photographer and phpfox_photographer_value). Thats it here

Creating user group fields

We already have a product and the tables so now we can create user group fields for this. Just go to the AdminCP -> Users -> Custom Fields -> Add Custom Field. In the Product you chose your own product (the one we created on 3.2.2), the module we should choose "user" here, this means that if this module is disabled this custom field will also be disabled, then on "user group" you choose "photographer" (because thats the one we're doing now).

Adding to registration

Suppose you want your users to choose which user group they get when they register, we can do this by first:

Enabling Subscriptions

Easy as going to the AdminCP -> Settings -> System Settings -> Manage Settings. Click on "Subscribe" and set "Enable Subscription Packages" to true.

Creating a Subscription

Just go to AdminCP -> Modules -> Subscribe -> Create New Package. Here the Name is important because this is what will be shown to the users when they are in the registration page, so if you are making this user group free its a good idea to name it: (Free) Photographer The User Group on Success should be "photographer" as per our example and the User Group on Failure we can leave to Registered. If you are making this a charged user group the user group on failure would be the one they get when they stop paying if its a recurrent fee (some may want to set this to Banned). You have to put something in the price, so if its free just put zeros there. Click Submit and you're good to go.