'widget_wp_user_avatar', 'description' => sprintf( /* translators: [avatar_upload] shortcode */ __( 'Insert %s', 'one-user-avatar' ), '[avatar_upload]' ), ); parent::__construct( 'wp_user_avatar_profile', __( 'One User Avatar', 'one-user-avatar' ), $widget_ops ); } /** * Add [avatar_upload] to widget * @since 1.9.4 * @param array $args * @param array $instance * @uses object $wp_user_avatar * @uses bool $wpua_allow_upload * @uses object $wpua_shortcode * @uses add_filter() * @uses apply_filters() * @uses is_user_logged_in() * @uses remove_filter() * @uses wpua_edit_shortcode() * @uses wpua_is_author_or_above() */ public function widget($args, $instance) { global $wp_user_avatar, $wpua_allow_upload, $wpua_shortcode; extract( $args ); $instance = apply_filters( 'wpua_widget_instance', $instance ); $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); $text = apply_filters( 'widget_text', empty( $instance['text'] ) ? '' : $instance['text'], $instance ); // Show widget only for users with permission if ( $wp_user_avatar->wpua_is_author_or_above() || ( 1 == (bool) $wpua_allow_upload && is_user_logged_in() ) ) { echo $before_widget; if ( ! empty( $title ) ) { echo $before_title . esc_html( $title ) . $after_title; } if ( ! empty( $text ) ) { echo '
'; echo wp_kses_post( ! empty( $instance['filter'] ) ? wpautop( $text ) : $text ); echo '
'; } // Remove profile title add_filter( 'wpua_profile_title', '__return_null' ); // Get [avatar_upload] shortcode echo $wpua_shortcode->wpua_edit_shortcode( '' ); // Add back profile title remove_filter('wpua_profile_title', '__return_null'); } } /** * Set title * @since 1.9.4 * @param array $instance * @uses wp_parse_args() */ public function form( $instance ) { $instance = wp_parse_args( (array) $instance, array( 'title' => '', 'text' => '', ) ); ?>

/>