roles ) ) { $block = true; } else { $block = false; } $block = apply_filters( 'pmpro_block_dashboard', $block ); /** * Allow filtering whether to block Dashboard access. * * @param bool $block Whether to block Dashboard access. */ return apply_filters( 'pmpro_block_dashboard', $block ); } /** * Initialize our Site Health integration and add hooks. * * @since 2.6.2 */ function pmpro_init_site_health_integration() { $site_health = PMPro_Site_Health::init(); $site_health->hook(); } add_action( 'admin_init', 'pmpro_init_site_health_integration' ); /** * Compare stored and current site URL and decide if we should go into pause mode * * @since 2.10 */ function pmpro_site_url_check() { if ( pmpro_is_paused() ) { //We are paused, show a notice. add_action( 'admin_notices', 'pmpro_pause_mode_notice' ); } } add_action( 'admin_init', 'pmpro_site_url_check' ); /** * Allows a user to deactivate pause mode and update the last known URL * * @since 2.10 */ function pmpro_handle_pause_mode_actions() { // Can the current user view the dashboard? if ( current_user_can( 'pmpro_manage_pause_mode' ) ) { //We're attempting to reactivate all services. if( ! empty( $_REQUEST['pmpro-reactivate-services'] ) ) { delete_option( 'pmpro_last_known_url' ); } } } add_action( 'admin_init', 'pmpro_handle_pause_mode_actions' ); /** * Display a notice about pause mode being enabled * * @since 2.10 */ function pmpro_pause_mode_notice() { global $current_user; if ( isset( $_REQUEST[ 'show_pause_notification' ] ) ) { $pmpro_show_pause_notification = (bool)$_REQUEST['show_pause_notification']; } else { $pmpro_show_pause_notification = false; } // Remove notice from dismissed user meta if URL parameter is set. $archived_notifications = get_user_meta( $current_user->ID, 'pmpro_archived_notifications', true ); if ( ! is_array( $archived_notifications ) ) { $archived_notifications = array(); } if ( array_key_exists( 'hide_pause_notification', $archived_notifications ) ) { $show_notice = false; if ( ! empty( $pmpro_show_pause_notification ) ) { unset( $archived_notifications['hide_pause_notification'] ); update_user_meta( $current_user->ID, 'pmpro_archived_notifications', $archived_notifications ); $show_notice = true; } } else { $show_notice = true; } if ( pmpro_is_paused() && ! empty( $show_notice ) ) { // Site is paused. Show the notice. ?>
Warning: We have detected that your site URL has changed. All PMPro-related cron jobs and automated services have been disabled. Paid Memberships Pro considers %s to be the site URL.', 'paid-memberships-pro' ), '' . esc_url( get_option( 'pmpro_last_known_url' ) ) . '' ) ); ?>
' class='button button-secondary'>
pmpro_manage_pause_mode capability are able to deactivate pause mode.', 'paid-memberships-pro' ) ); ?>