Viewing 1 replies (of 1 total)
  • msteel

    (@msteelnapcocom)

    I wanted this too. I hate hacking plugins but decided to on this. Here’s my code in case anyone wants it or the author wants to incorporate it. It’s just a matter of storing all the messages in a variable instead of immediately echoing them, then adding a filter for the output.

    public function show_messages() {
    		$out = '';
    
    		if ( ! empty( $_GET['message'] ) ) {
    			if ( 'clear-locks' == $_GET['message'] ) {
    				if ( empty( $_GET['locks_cleared'] ) || 0 == $_GET['locks_cleared'] )
    					$msg = __( 'There were no locks to clear!', $this->_slug );
    				else
    					$msg = sprintf( _n( 'Successfully cleared %d lock.', 'Successfully cleared %d locks.', $_GET['locks_cleared'], $this->_slug ), $_GET['locks_cleared'] );
    			} elseif ( 'authorized' == $_GET['message'] ) {
    				if ( ! empty( $_GET['authorized'] ) )
    					$msg = sprintf( __( 'Successfully authorized @%s', $this->_slug ), $_GET['authorized'] );
    				else
    					$msg = __( 'There was a problem authorizing your account.', $this->_slug );
    			} elseif ( 'removed' == $_GET['message'] ) {
    				if ( ! empty( $_GET['removed'] ) )
    					$msg = sprintf( __( 'Successfully removed @%s', $this->_slug ), $_GET['removed'] );
    				else
    					$msg = __( 'There was a problem removing your account.', $this->_slug );
    			}
    			if ( ! empty( $msg ) )
    				$out .= "<div class='updated'><p>" . esc_html( $msg ) . '</p></div>';
    		}
    
    		if ( ! empty( $this->_error ) && is_wp_error( $this->_error ) ) {
    			$msg = '<p>' . implode( '</p><p>', $this->_error->get_error_messages() ) . '</p>';
    			$out .= '<div class="error">' . $msg . '</div>';
    		}
    
    		if ( empty( $this->_settings['twp']['consumer-key'] ) || empty( $this->_settings['twp']['consumer-secret'] ) ) {
    			$msg = sprintf( __( 'You need to <a href="%s">set up your Twitter app keys</a>.', $this->_slug ), $this->get_options_url() );
    			$out .= '<div class="error"><p>' . $msg . '</p></div>';
    		}
    
    		if ( empty( $this->_settings['twp-authed-users'] ) ) {
    			$msg = sprintf( __( 'You need to <a href="%s">authorize your Twitter accounts</a>.', $this->_slug ), $this->get_options_url() );
    			$out .= '<div class="error"><p>' . $msg . '</p></div>';
    		}
    
    		$out = apply_filters( 'widget_twitter_admin_notices', $out );
    
    		echo $out;
    	}
Viewing 1 replies (of 1 total)
  • The topic ‘hide You need to set up your Twitter app keys on MU’ is closed to new replies.