Registration page as homepage

You can create a shortcode for displaying a registration form and add it to a page or create a custom template with registration page layout. Once the page will be there, you can choose that page to display in home page from Setting >> Reading >> Front Page Display ( as in image ) From … Read more

Grab user_id inside a function

Your function requires an input argument $user in order to work. If you simply call wp_user_id() without any argument it will return an error. The solution is giving $user a default value, making the argument optional. function wp_user_id( $user = NULL ) { // Give $user a default value of NULL if ( empty($user) ) … Read more

How to restrict Admin from creating new users from Add new user screen in dashboard to only of one domain?

You can hook into registration_error and check if the user’s email is under your specified domain or not: add_filter( ‘registration_errors’, ‘user_email_checker’, 10, 3 ); function user_email_checker( $errors, $sanitized_user_login, $user_email ) { if ( !preg_match(‘#[@.]gmail.com$#i’, $user_email ) { $errors->add( ‘invalid_email’, __( ‘ERROR: Only “gmail.com” email address allowed.’ ) ); } return $errors; } This way you … Read more

In admin manage users page, how can I stop users with certain privileges from editing users with other privileges?

It sounds like you want to remove the following permissions from the ‘liaison’ role: create_users delete_users edit_users promote_users remove_users Keep “list_users” so they can see the list, but not edit anything. The easiest way to remove these permissions is to use a Role Editor plugin. Several are available; you’ll select the ‘liaison’ role, and then … Read more