Filter and validate user role in registration
You can use wp_dropdown_roles()
You can use wp_dropdown_roles()
First, make sure you have a Page set up with the slug “join”. This page must exist if you expect to point visitors there. Second, using this filter will NOT redirect you to the /join/ page when you directly visit wp-login.php. It only replaces the URL WordPress uses when generating links/URLs to the default signup … Read more
There’s a lot of reasons this isn’t working. The best place to to start is the Widgets API page in the Codex. It outlines a basic class for creating a widget. At a minimum, you need a class with a __construct(), widget(), form(), and update() function. You also need to register your widget correctly. The … Read more
Solved: There was different capitalization on the variable $key ($Key vs $key) Always the simple things you miss eh? 🙂
Ues this function to redirect admin to dashboard function admin_login_redirect( $redirect_to, $request, $user ) { global $user; if( isset( $user->roles ) && is_array( $user->roles ) ) { if( in_array( “administrator”, $user->roles ) ) { return $redirect_to; } } } add_filter(“login_redirect”, “admin_login_redirect”, 10, 3); For more/brief detail read this article. Page ID don’t come in quotes, … Read more
Your hook already gives you user id, you don’t need to $current_user. add_action (‘user_register’, ‘mailboxNumberGenerator’, 10, 1); function mailboxNumberGenerator($user_id) { $initialMailboxNum = 100000; $user_query = new WP_User_Query( array( ‘role’ => ‘Customer’ ) ); $user_query2 = new WP_User_Query( array( ‘role’ => ‘Subscriber’ ) ); $currentMailboxNum = $initialMailboxNum + $user_query->get_total() + $user_query2->get_total(); $newMailboxNum = $currentMailboxNum + 1; … Read more
Dont pass plain text as password, use this function: wp_set_password( $password, $user_id ); Keep in mind that it should only be run on user creation (so just once), otherwise the password might keep changing.
No, hooks have nothing to do here, all the emails you mentioned (WordPress Gravity Forms and WooCommerce) use the same function wp_mail. I strongly believe this is blocked outside of WordPress, and I suggest you use a SMTP server with a real email address, you can use Postman SMTP Mailer/Email Log which will also help … Read more
I don’t use this plugin for a while, don’t you need to customize the shortcode for each form, one should be role=”student” and the other one role=”employer”. You can also use the filter add_filter( ‘simplr_validate_form’, ‘my_simplr_validate_form’, 10, 3 ); A simple example, assuming the page for the registration is 1 for the student and 2 … Read more
To stop unwanted registration on your WordPress site, go to admin panel, go to settings>general, then untick Membership (any one can register option).