Tag Info

Hot answers tagged

3

Here is an idea that you can implement. I think it will work just fine. Save the expiration time in user meta. Say the meta name is change_role. What you save in the meta is unix time. If you want to change them back in 14 days. Set the meta value to time() + 60 * 60 * 24 *14 code example update_user_meta($user_id, 'change_role', time() + 60 * 60 * 24 ...


2

The core functions: is_super_admin(), grant_super_admin(), revoke_super_admin() fetch the super admins data from the wp_sitemeta table with: $super_admins = get_site_option( 'site_admins', array( 'admin' ) ); It's stored as a serialized array of user logins, for each site, like: a:1:{i:0;s:6:"louiev";} It's possible to override it with the ...


2

You can use the set_user_role hook, that will only fire when the user role changes: add_action( 'set_user_role', function( $user_id, $role, $old_roles ) { // Your code ... }, 10, 3 ); If you want to restrict this to a profile update, you can use: add_action( 'set_user_role', function( $user_id ) { add_action( 'profile_update', function( ...


1

Arrrrg a WooCommerce question... quick burn him at the stake! There's a couple of problems with your callback function above: you are not declaring global $woocommerce so you do not have access to the $woocommerce global variable. and $woocommerce->customer holds the state of the WC_Customer class however this class does not contain a get_role() ...



Only top voted, non community-wiki answers of a minimum length are eligible