Latest Register Log In

+ Advanced Search

Details

Required fields for particular usergroup
By
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:

<?php
if (currenturlcontains('register.php') &amp;&amp; $_REQUEST['filled'] &amp;&amp; $_REQUEST['usergroup'] == 4) $settings->requiredmembers = 'name,password,email';
else if (currenturlcontains('suggest.php?action=addlink') &amp;&amp; $thismember->usergroup == 4) $settings->requiredlinks = 'title,description';
else if (currenturlcontains('suggest.php?action=addcat') &amp;&amp; $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)
Question(s):
 




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

Previous Article | Next Article