XF 2 Tip Using Custom user fields with User group promotions

BattleKing

Spirit of darkness
Staff member
Administrator
Moderator
+Lifetime VIP+
S.V.I.P Member
Collaborate
Registered
Joined
May 24, 2020
Messages
3,519
Points
523

Reputation:

This guide will show how easy it is to allow your members to choose which additional user groups they wish to be members of and subsequently affect their forum experience.

For an explanation of both features, see the following pages of the Manual:
Custom User Fields
User Group Promotions


Custom user fields in conjunction with user group promotions allow your users to choose to become members of user groups from their account preferences page. Some uses could be:

  • Special interest forums which only a subset of members are interested in
  • Off topic forum - some members may not want to see threads from that forum in the various feeds
  • Access to a NSFW or 18 and over forum - useful for when browsing in a public place (or at work ... )

There are three simple steps involved.


Step 1: Create The User Group
The first step is to create the user group which will be used for the promotion.
1638714158500.png

You can configure the user group as required in terms of permissions, features, styling, node specific permissions, etc.

In this example, the View node permission has been changed to No for the Off Topic forum for the Registered and Unregistered / Unconfirmed user groups, and set to Yes for the Off Topic Access user group.
1638714170600.png

1638714197100.png

Step 2: Create The Custom User Field
The next step is to create the custom user field.
The following images show that we are creating a custom user field with an ID of offtopic and a Title of Off Topic Access.





Ensure the Check boxes option is selected for the Field type.

Configure the Options for choice fields and General options sections as follows:
1638714218000.png

1638714230600.png

1638714241100.png

You can of course name the fields however you like.


Step 3: Create The User Group Promotion
The final step is to create the user group promotion.
Ensure the user group you created in the first step is checked.
1638714262500.png

Then on the User field criteria tab, check the option for the custom user field.




Account Preferences
Members will now see an additional check box on their account preferences page.
1638714287100.png

1638714305100.jpg

With it unchecked, no changes will be made to the user groups they are a member of.

On checking the box and saving, once the User group promotions cron task runs (every 20 minutes), they will be automatically added to the user group.

If the member unchecks the box, they will be automatically removed from the user group (when the cron task next runs).


If you found this tutorial useful, donations of positive emojis and reviews are gladly received.
 
Top