How to sync roles across Multisite?

There’s an action hook in the set_role function. It’s a matter of detecting if this is happening in the main site, and, if it does, get all blogs of the user and change all roles. More details in code comments. add_action( ‘set_user_role’, ‘sync_user_roles_wpse_91745’, 10, 2 ); function sync_user_roles_wpse_91745( $user_id, $role ) { // is_multisite() used … Read more

Synchronize Data every minute with set_transient

To my understanding, *_transient() is basically *_option() wrapped in a cache-timer. What that means in this context, is that set_transient( ‘…’, true, * MINUTE_IN_SECONDS ); will not run/re-evaluate every minute. Instead it will run/re-evaluate when the page has loaded by a visitor/user, and the data therein is older than 60 seconds. This is not ideal … Read more