• A couple of problems installing this:

    Line 67 uses a short-style PHP opening tag, which doesn’t work on all hosts.

    The saving of the messages needs to unslash the POSTed data:

    update_option( 'wpb_'.$role['name'].'_Msg', sanitize_text_field(wp_unslash($_POST[$role['name'].'-Msg'])));
    

    Also, update_option() can be called on options that don’t already exist, so you don’t need to worry about checking the option’s existance there.

    However, it is necessary to check the existance of $_POST[ $role[‘name’] . ‘-Msg’] (I was getting key-not-defined errors here).

    So that whole section could just be:

    	foreach($roles as $role) {
    		if ( isset( $_POST[ $role['name'] . '-Msg'] ) ) {
    			$msg = sanitize_text_field( wp_unslash( $_POST[ $role['name'] . '-Msg'] ) );
    			update_option( 'wpb_' . $role['name'].'_Msg', $msg, true );
    		}
    	}
    

    Thanks for a useful plugin! 🙂

    https://ww.wp.xz.cn/plugins/admin-screen-messages/

The topic ‘Doesn't quite work for me’ is closed to new replies.