Registration area + reserved area

Paste this into your functions.php file and edit according to comments. add_filter(‘login_redirect’, ‘redirect_user’, 10); function redirect_user(){ global $user; //where you want to redirect users too $redirect = home_url() . ‘/where-do-we-go-from-here/’; /* * each role listed in this array will be redirect to above URL * if you only have one user role to redirect then … Read more

Register form how to get Total Control of it

Copy this function and modify it as per your needs. function custom_register_new_user( $user_login, $user_email ) { $errors = new WP_Error(); $sanitized_user_login = sanitize_user( $user_login ); $user_email = apply_filters( ‘user_registration_email’, $user_email ); // Check the username if ( $sanitized_user_login == ” ) { $errors->add( ’empty_username’, __( ‘<strong>ERROR</strong>: Please enter a username.’ ) ); } elseif ( … Read more

Filter for users on custom post type

Check this code do_action(‘user_register’, $user_id); add_action (‘user_register’, “test”); function test($user_id) { $user = new WP_User($user_id); $role_of_user = $user->roles[0]; if($role_of_user == ‘your role’){ $my_post = array( ‘post_title’ => ‘My post’, ‘post_content’ => ‘This is my post.’, ‘post_status’ => ‘publish’, ‘post_author’ => $user_id ); wp_insert_post( $my_post ); } } It will create a post when a user … Read more

Restrict partially matching usernames

There’s a validate_username filter hook that is used by validate_user() which is in turn used by register_new_user(). So you can disallow usernames containing admin or other prohibited terms: add_filter( ‘validate_username’, ‘wpse257667_check_username’, 10, 2 ); function wpse257667_check_username( $valid, $username ) { // This array can grow as large as needed. $disallowed = array( ‘admin’, ‘other_disallowed_string’ ); … Read more

Disable New User Registration Email sent to WordPress admin email on 4.9.5

the function wp_new_user_notification is one of the Pluggable Functions. In the documention you can read: Pluggable functions were introduced in WordPress 1.5.1 These functions let you override certain core functions via plugins. The most up-to-date list of core functions that WordPress allows plugins to override is available at wp-includes/pluggable.php. WordPress loads the built-in functions only … Read more

Generate long hashed user ID

The WordPress wp_users table uses an ID that is an auto-increment integer for unique user ID. There is no way to change that without making significant changes to the way WordPress works, and even if you do that, you will break most plugins that depend on the integer value for user ID. I don’t see … Read more

register user only with specific Host name

I think the User Domain Whitelist plugin is exactly what you want: The User Domain Whitelist/Blacklist plugin limits user registration to only registrants with an email address from the domain white list below OR prevents registrants with an email address from the domain black list below from registering.

How do I set user account inactive?

how about just setting user meta. Something like ‘my_inactive’ and set it to true, then you can evaluate by something like if( get_user_meta( $user, ‘my_inactive’ ) === true ) and have a quick way to check that without destroying any of the user privileges or anything. This will allow you to hook login and just … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)