You need to add_action two time for this. One at the time of user registration & second when user tries to login.
function wpse_149067( $user_id ) {
if ( user_can( $user_id, 'tutor' ) )
update_user_meta($user_id, 'verified_user', false);
if ( user_can( $user_id, 'student' ) )
update_user_meta($user_id, 'verified_user', true);
}
add_action( 'wp_login', 'wpse_149067_check_user', 10, 2);
function wpse_149067_check_user($user_login, $user){
$user_id = $user->ID;
if ( current_user_can( $user_id, 'tutor' ) && false == get_user_meta($user_id, 'verified_user') ) {
// Do your stuff here
// eg: echo 'Please verify your account ';
}
}
?>
Related Posts:
- Can I leave off plugin textdomain for terms used in core?
- How to tell if a plugin is multisite compatible?
- Correct way to serialize the data of options table?
- How to force WordPress to temporarily switch locale (using qTranslate)? [closed]
- Custom admin column disappearing when using Quick Edit [duplicate]
- Create page when plugin is activated
- How can I translate the name of my Plugin for other languages?
- Article source link for posts
- WordPress media upload limit?
- Logs to check when the plugin was first installed for the first time
- How to get custom field image url of specific size
- Getting “Fatal error: Call to undefined function wp_cache_get() in option.php” after updating a cache plugin [closed]
- Facebook Like Button On Individual Comments
- Keep user’s privileges on accessing contents in JSON response
- Displaying admin notice dynamically
- Get total number of comment of the posts written by an author
- How to Dequeue All WordPress Assets
- How to replace or display the special characters from JSON API plugin [closed]
- Output HTML only on individual post view
- Why plugin ajax response is -1?
- printf – problem to understand code
- Pass info from functions.php to plugin
- add_query_arg not working
- Elementor\Scheme_Typography’ not found [closed]
- How do I add a custom sub menu menu under Woo-commerce marketing?
- Widget for adding HTML markup to a page
- WordPress filter that hook after each action/filter hook
- When to use action hooks and plugins
- Uncode theme content block header ignoring saved changes/not updating?
- Unique 4 digit number
- One of my plugins broke when I tried to update it, how do I safely uninstall it?
- WooCommerce Checkout Error [closed]
- User Session and Stored Cookies not get removed
- get 404 when accessing wp-admin/plugin-install.php
- Pre booking doesn’t work with custom bootstrap modul in woocommerce [closed]
- WordPress change Language not working
- Bulk updates to post_content
- Advanced AJAX Page Loader ignores other JS code
- WordPress 3.8.3. custom theme – sliders won’t load js/css files
- wp_enqueue_script registers script but does not create html tag
- Multiple domains issue
- Plugin Development Form Self Submission
- How To Extend A WordPress Plugin Without Losing Your Changes [duplicate]
- WordPress call_user_func_array() expects parameter 1 to be a valid callback, class
- Why is my custom post type not being activated on plug-in activation?
- Plugins fail to update: Download failed. A valid URL was not provided
- What is the right way to show reusable content
- Set post tags using tag ID
- How to allow Contributors to publish articles after approval
- WordPress User Post Products
- Making my plugin create a page?
- How to generate an all in one WordPress New content, plugin and theme update report on a website? [closed]
- How can I load the css and jquery explicitly for the login screen
- Overriding an Array in a Plugin’s Class/Function from functions.php
- Canvas | Bouncing balls within a container (with gravity and collisions and background-images on the balls)
- Plugin translation not working on WordPress.org
- Built a second plugin but it overwrote the first one
- How to get CPT category checkbox list and show post of selected(multiply) checkboxes via ajax?
- preg_replace() No ending delimiter ‘.’ found [closed]
- Preview with Custom Post Type Not Working
- How can i summerize posts or news automatically in word press site?
- Insert a Woocomerce product in specific product category
- Edit page header on a custom plugin
- How to disable tinyMCE button added by a plugin?
- Best method of implementing compartmentalized custom post types on a multi-site network
- How to hide the cell properties and row properties in TinyMCE WordPress?
- How to resolve warning for `unstableOnSplit` prop on a DOM element in block editor
- Rename a folder via HTML POST request
- I have English words in Kurdish pages
- How can I add a custom Javascript snippet to display my feedback in footer?
- path of wp-content directory when we are on some plugin
- Blank dashboard with no access
- User upload dashboard
- How to duplicate a product page
- How to solve Blocked a frame with origin from accessing a cross origin frame error in wordpress?
- Add Custom Field to Post Pages via Plugin
- Timing issue with is_amp_endpoint()
- Is there a plugin to have DMCA takedown notice form in WordPress? [closed]
- Can I add content before post content without using the_content filter
- Only allow a plugin to work on a specific page? (Prefer not to use a plugin)
- hide load more button if there are no posts left to display
- Adding link for logged in user? [closed]
- Fatal Error Paid Memberships Pro require includes/localization.php [closed]
- Show image or notification on specific blog in multisite
- Child Theme Changes Are Not Reflecting In Parent Theme
- Changes required to make new plugin from existing
- WordPress Development understanding core
- Input gets deleted/overwritten after changing to different Admin Menu
- Removing this filter added by a plugin
- Infinite Scroll plugin on Ebuy theme
- How do I reset BackWPup?
- Pronamic Info Window
- Trying to Understand Shortcodes.
- Is there a way to combine categories and their hierarchy into the admin listing page?
- How to fix ‘Call to undefined function do_settings()’ error?
- Child Plugin Admin Panel
- Passing an input variable through a switch statement
- How can I make my plugin detect if a certain theme is active?
- Is there a membership plugin which offers the ability to hide content based on css rules?
- How to add an active state class to my info box