Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix usage of admin notices #589

Closed
shadyvb opened this issue Jul 1, 2014 · 0 comments

Comments

Projects
None yet
1 participant
@shadyvb
Copy link
Contributor

commented Jul 1, 2014

Checking this add_action( 'all_admin_notices', array( __CLASS__, 'admin_notices' ) ); and seeing that the callback function admin_notices( $message, $is_error = true ) actually needs argument to display messages, makes the action registration pointless.

However, that same callback is used directly like in :

    public static function fail_php_version() {
        add_action( 'plugins_loaded', array( __CLASS__, 'i18n' ) );
        self::notice( __( 'Stream requires PHP version 5.3+, plugin is currently NOT ACTIVE.', 'stream' ) );
    }

defined here

    public static function notice( $message, $is_error = true ) {
        if ( defined( 'WP_CLI' ) ) {
            $message = strip_tags( $message );
            if ( $is_error ) {
                WP_CLI::warning( $message );
            } else {
                WP_CLI::success( $message );
            }
        } else {
            self::admin_notices( $message, $is_error );
        }
    }

I recall there was some logic to retain messages locally in the class and then outputting in via the callback registered to that action. Anyway, we need to fix that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.