Latest Register Log In

+ Advanced Search


Required fields for particular usergroup
Aug 10, 2006 (Edited Feb 02, 2014)

Note: This is an advanced task involving some simple programming.

Sometimes, you may want members in a particular usergroup to be required to fill in different fields than the rest of the members. To do this, create a file named requiredchanges.php and save it to your /modifications/ subdirectory (if /modifications/ doesn't exist yet, create it). Here's sample content you can use for the file:

if (currenturlcontains('register.php') && $_REQUEST['filled'] && $_REQUEST['usergroup'] == 4) $settings->requiredmembers = 'name,password,email';
else if (currenturlcontains('suggest.php?action=addlink') && $thismember->usergroup == 4) $settings->requiredlinks = 'title,description';
else if (currenturlcontains('suggest.php?action=addcat') && $thismember->usergroup == 4) $settings->requiredcategories = 'name,description';

The first line requires name, password and email for usergroup #4 on the registration page. The second line requires title and description for listing submitters in usergroup #4 on the submit listing page. The third line requires the name and description fields for group #4 on the submit category page. Change the fields as appropriate to your purpose. Note that this overrides (removes) all previous required fields so you need to add everything to your list even if it's already required for everyone else.

Make sure you don't have any spaces or line breaks before the <?php or after the ?> as that will break cookies.

Did this article fail to fully answer your questions? If so, please ask for clarification.

Your E-mail:
(needed so that you can get your answer!)
Confirm E-mail:
(same as above to prevent typos)

Description Setting different required fields for a particular usergroup compared to others.
Views 733 views. Averaging 0 views per day.

Previous Article | Next Article