clef / clef-wordpress

The official Clef plugin for WordPress.
http://wordpress.org/plugins/wpclef
44 stars 24 forks source link

Remove empty div #247

Closed lolux closed 8 years ago

lolux commented 8 years ago

This was displaying as an empty div class=message upon completing the setup wizard on some hosts (e.g., WP Engine) but not others (e.g., GoDaddy).

Appears to be unused. . . .

jessepollak commented 8 years ago

@lolux do other error messages still show up with this removed?

lolux commented 8 years ago

@jessepollak to make sure I'm tracking with you:

First, the problem I'm trying to solve is to remove the empty message bubble (screenshot) that appears when completing the plugin setup wizard. I'm not yet sure why, but this bubble only appears on certain hosting setups. If this is a bug, it is minor: not affecting performance, and it disappears on subsequent loads of the settings page.

Second, if you mean other WP errors (admin notices), yes, verified with the following test.

Test 1: admin notices

function sample_admin_notice__error() {
    $class = 'notice notice-error';
    $message = __( 'This is a non-Clef test error message.', 'sample-text-domain' );
    printf( '<div class="%1$s"><p>%2$s</p></div>', $class, $message ); 
}
add_action( 'admin_notices', 'sample_admin_notice__error' );

Test 2: add_settings_error()

Third, if you mean other Clef settings errors, I think it should be, but my test is returning errors.

I think the div in the settings.tpl is redundant since settings_errors(), which we call here, outputs its own div.

However, when I attempt to run a test error by adding add_settings_error( 'wpclef', 'test_error', 'This is a Clef test error message.', 'error' ); to the ClassSettings constructor, the results are as follows:

Is there a better way to test the Clef settings errors than what I have going in Test 2?

jessepollak commented 8 years ago

@lolux I'm thinking about case (2), i.e. when our settings save or another AJAX action returns an error. I think the best way to simulate this is to just return a WP_Error in an AJAX function, an example of which you can find here.

lolux commented 8 years ago

Closing after further discussion: this div is in fact used.