Get In Touch
MEDPIKE
info@medpike.com
Work Inquiries
job@medpike.com

change role on the first log in WordPress

add_action( ‘loop_start’, ‘personal_message_when_logged_in6’ );
function personal_message_when_logged_in6() {
if( is_user_logged_in()) {
$current_user = wp_get_current_user();
$user_id = get_current_user_id();
if($current_user->role == ‘role1’) {
$current_user->set_role( ‘rol2’ );
update_user_meta($user_id, ‘role’, ‘rol2’);

global $expire_users;
$expire_settings = $expire_users->admin->settings->get_default_expire_settings();
$expire_data = array(
‘expire_user_date_type’ => $expire_settings[‘expire_user_date_type’],
‘expire_user_date_in_num’ => 1,//1,
‘expire_user_date_in_block’ => ‘months’,//’months’,
‘expire_user_date_on_timestamp’ => $expire_settings[‘expire_timestamp’],
//’expire_user_role’ => $expire_settings[‘expire_user_role’],
‘expire_user_role’ => ‘medicogratis’,
‘expire_user_reset_password’ => $expire_settings[‘expire_user_reset_password’],
‘expire_user_email’ => $expire_settings[‘expire_user_email’],
‘expire_user_email_admin’ => $expire_settings[‘expire_user_email_admin’],
‘expire_user_remove_expiry’ => $expire_settings[‘expire_user_remove_expiry’] );
$user = new Expire_User( $current_user->ID );
$user->set_expire_data( $expire_data );
$user->save_user();
}
}
}

Author avatar
miguel
https://blog.medpike.com

Post a comment

Your email address will not be published. Required fields are marked *

three + two =

  • Tureporti

    Radiology Second Opinions
    Tureporti
    Understanding radiology reports
    HIPAA ready
  • Radiolapp

    AI RIS-PACS On Demand
    Radiolapp
    Pay As You Go RIS-PACS
    AI included
© 2021, MEDPIKE. Made with passion by MEDPIKE.
All right reserved.
We use cookies to give you the best experience.