Latest Register Log In

+ Advanced Search

Required fields for particular usergroup

Required fields for particular usergroup
By
08/10/06 (Edited 02/02/14)

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') && $_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.





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