Welcome to the forum. If this is your first time you can browse around and see what you like. You will need to be registered in order to post!
Join our community and talk about tech, gaming, get support for computer problems and even sale your own product.
Considering supporting us by subscribing.
Join our community and talk about tech, gaming, get support for computer problems and even sale your own product.
Considering supporting us by subscribing.
Validation for WP Roles at Registration
Validation for WP Roles at Registration
What is WP Roles at Registration?
Someone asked if they can check if a user has selected a role while they register. So here I whipped out a simple code which will check against default role selection and throws in an error message upon selection.
You can change which role to target by changing contributor to your own. Also error messages are customizable.
This guide was based off: https://stackoverflow.com/questions/102 ... -down-list
What is this?This plugin asks the user to choose his role in the website during registration from a list of selected roles. It works with BuddyPress also. It provides an interface from where the admin can choose which roles to display during registration for the user to choose from.
Someone asked if they can check if a user has selected a role while they register. So here I whipped out a simple code which will check against default role selection and throws in an error message upon selection.
Code: Select all
// Code taken from http://chatngo.co/bb/viewtopic.php?f=10&t=279
add_filter( 'registration_errors', 'select_user_role_error', 10, 3 );
function select_user_role_error( $errors, $sanitized_user_login, $user_email ) {
if(isset($_REQUEST['wp_rar_user_role']) && $_REQUEST['wp_rar_user_role'] == 'contributor') :
$errors->add( 'policy_error', "<strong>ERROR</strong>: Please select an option." );
return $errors;
endif;
return $errors;
}
This guide was based off: https://stackoverflow.com/questions/102 ... -down-list

PC: Custom Built Gaming PC
Monitor: Samsung S24D390H, Asus VE248H
Who is online
Users browsing this forum: No registered users and 1 guest
Topic Subscribers
1 user subscribed to this topic: kachan64