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:
- Best way to initiate a class in a WP plugin?
- Best way to include wp-config.php
- Custom Post Type Templates from Plugin Folder?
- Disable update notification for individual plugins
- How can I delete orphan keys in WordPress database tables?
- How to safely sanitize a textarea which takes full HTML input
- How to Remove Certain Screen Options and Meta Boxes from add/edit post type?
- How to not allow users to create new tags, but allow to them to use existing ones
- Why activate_plugin is not working in register_activation_hook
- Woocommerce override mini-cart.php not working [closed]
- Error: call_user_func_array() expects parameter 1 to be a valid callback
- How to prevent a post from being deleted?
- Best Practice for Referencing the Plugin Directory
- Archive list with only years and months
- How can I make an Ajax login form work with FORCE_SSL_ADMIN enabled?
- Managing WP Core & Plugin Updates for Clients
- Query Posts by Custom Field ‘Price’
- How do I create an HTML embed code to publish WP posts on other non-WP websites?
- How do I fix the “sorry, you are not allowed to access this page” error I get on the “plugins > settings” links?
- Selling WordPress sites?
- Plugin: How to make links in admin page open up inside of the admin panel
- Insert query inserts 2 entries, should insert 1
- WP WC CLI – WooCommerce setup store with wp-cli [closed]
- How to make WordPress use protocol indepentent upload files?
- Adding Custom Fields for Img in Posts
- Library plugin for WordPress [closed]
- How to pass JavaScript variable to PHP in wordpress widget?
- Unable to add admin notice on plugin activation
- How to use a Must-Use plugin to hide a regular one and to hide itself?
- Shortcode display outside the div
- How to create a widget or plugin to add custom content to my website?
- How can I let users to access plugin functions based on roles?
- Install plugin remotely
- Fastest way to loop through all posts?
- Is there a way to share content amongst wordpress sites
- WP Plugin for Terms of Use
- Insert code after tag without using functions.php?
- Adding Button to Shop Page in WooCommerce [closed]
- Adding Scripts in the Admin Area
- Is there a good plugin for social bookmarking on site for WordPress [closed]
- Extend the Admin Post/Edit page
- Offering Ads Dependent on Visitor Type?
- Unable to load stylesheets and scripts to plugin settings page
- Correct way to use register_activation_hook
- Popup Maker nav menu item not working
- Can wp_script_is used in pluginA check if a script is being enqueued/registered from pluginB?
- Licensing of freemium plugin
- how can i limit the number of instances for my widget
- WP theme with Backbone
- Can I store WordPress media in different sub-folders?
- How to add rewrite rules and pagination to retrieve attachments files?
- AddFilter option_active_plugins is executed 6 times. Why?
- Include Max mega menu Plugin into theme
- Have plugin require two other plugins
- How to include plugin without activation?
- How can I create a plugin installation link?
- How to trigger an action with a URL
- How to remove all javascript in a theme wordpress?
- Default Plugin Settings Not Writing to Database
- Why do plugins that cause ‘unexpected output’ create AJAX problems?
- Are there any plugins yet that support Facebook Like, Google +1 and allow Social Interaction tracking on Google Analytics
- Create a custom page template inside my wordpress plugin
- Add form fields dynamically on button click
- Custom Post Type Plugin not loading category template and loading 404 instead
- CMB2 installation – cannot get it to work
- WP plugins for building a database?
- Show history of post revisions on front end
- How to pull code snippet from functionality plugin?
- Change the method of a class from child function.php
- Can I use a plugin for a singular page on my website?
- Plugin shortcodes not working in custom theme
- Change the backend language of a single plugin
- Search is not working on plugin directory
- Create digital-virtual-downloadable WooCommerce products from the frontend using Gravity Forms? [closed]
- Is it possible to add a sidebar in a woocommerce hook?
- Best approach to fetch data from wp options to js file or php file
- wordpress site | All-in-one-cufon IE Issue
- How to add Internationalization in WordPress using Javascript/React?
- Do widget options need to be escaped widget()?
- Is there any W3C compatible Share & Follow plugin?
- What plugin should I use for booking events and receiving payments? [closed]
- Creating an online questionnaire form – by Importing the questions from a spreadsheet?
- Plug-in Conflict: Art Direction and Super Cache
- WordPress Shortcode to get URL Parameters $_GET[‘name’] redirects for no reason at all
- How to send an automated email to the customers when product is added woocommerce
- Trying to Get Text Field to Save
- creating html reusable blocks via shortcodes
- The Events Calendar and Easy Digital Downloads adding customer notes to Attendee export
- Modifying a .js Function for Print [QZ Tray, WooCommerce POS]
- getting an installation failed error when trying to load a plugin from a free theme
- woocommerce product countdown not showing in variable product? [closed]
- Finding which plugin uses cloudflare (due to GDPR)
- I want to auto populate data in three fields if one drop down is selected
- How does task scheduler plugin implements cron that is not dependent on page load request? [closed]
- Enabling WP_USE_EXT_MYSQL to support old plugin
- Session destroyed on page redirect
- Fatal error: Call to undefined function cmsms_theme_page_layout_scheme()
- How to insert HTML/JavaScript form into WordPress page? [closed]
- Can I load the textdomain before a plugin is activated?
- How can I position ShareThis buttons manually when using the plug-in? [closed]