'widget_pmpro_member_login', 'description' => __( 'Display a login form and optional "Logged In" member content.', 'paid-memberships-pro' ), ); parent::__construct( 'pmpro-member-login', esc_html__( 'Log In - PMPro', 'paid-memberships-pro' ), $widget_ops ); $this->alt_option_name = 'widget_pmpro_member_login'; add_action( 'save_post', array( $this, 'flush_widget_cache' ) ); add_action( 'deleted_post', array( $this, 'flush_widget_cache' ) ); add_action( 'switch_theme', array( $this, 'flush_widget_cache' ) ); } function widget( $args, $instance ) { $cache = array(); if ( ! $this->is_preview() ) { $cache = wp_cache_get( 'widget_pmpro_member_login', 'widget' ); } if ( ! is_array( $cache ) ) { $cache = array(); } if ( ! isset( $args['widget_id'] ) ) { $args['widget_id'] = $this->id; } if ( isset( $cache[ $args['widget_id'] ] ) ) { echo wp_kses_post( $cache[ $args['widget_id'] ] ); return; } ob_start(); ?> is_preview() ) { $cache[ $args['widget_id'] ] = ob_get_flush(); wp_cache_set( 'widget_pmpro_member_login', $cache, 'widget' ); } else { ob_end_flush(); } } function update( $new_instance, $old_instance ) { $instance = $old_instance; $instance['display_if_logged_in'] = isset( $new_instance['display_if_logged_in'] ) ? (bool) $new_instance['display_if_logged_in'] : false; $instance['show_menu'] = isset( $new_instance['show_menu'] ) ? (bool) $new_instance['show_menu'] : false; $instance['show_logout_link'] = isset( $new_instance['show_logout_link'] ) ? (bool) $new_instance['show_logout_link'] : false; $this->flush_widget_cache(); $alloptions = wp_cache_get( 'alloptions', 'options' ); if ( isset( $alloptions['widget_pmpro_member_login'] ) ) { delete_option( 'widget_pmpro_member_login' ); } return $instance; } function flush_widget_cache() { wp_cache_delete( 'widget_pmpro_member_login', 'widget' ); } function form( $instance ) { $display_if_logged_in = isset( $instance['display_if_logged_in'] ) ? (bool) $instance['display_if_logged_in'] : false; $show_menu = isset( $instance['show_menu'] ) ? (bool) $instance['show_menu'] : false; $show_logout_link = isset( $instance['show_logout_link'] ) ? (bool) $instance['show_logout_link'] : false; ?>

id="get_field_id( 'display_if_logged_in' ) ); ?>" name="get_field_name( 'display_if_logged_in' ) ); ?>" />

id="get_field_id( 'show_logout_link' ) ); ?>" name="get_field_name( 'show_logout_link' ) ); ?>" />

id="get_field_id( 'show_menu' ) ); ?>" name="get_field_name( 'show_menu' ) ); ?>" />

array ( 'href' => array(), 'target' => array(), 'title' => array(), ), ); echo '

' . sprintf( wp_kses( __( 'Customize this menu per level using the Nav Menus Add On. Assign the menu under Appearance > Menus.', 'paid-memberships-pro' ), $allowed_nav_menus_link_html ), 'https://www.paidmembershipspro.com/add-ons/pmpro-nav-menus/?utm_source=plugin&utm_medium=pmpro-membershiplevels&utm_campaign=add-ons&utm_content=nav-menus' ) . '

'; } } /* End Member Login Widget */ /** * Register the Widgets */ function pmpro_register_widgets() { register_widget( 'PMPro_Widget_Member_Login' ); } add_action( 'widgets_init', 'pmpro_register_widgets' );