Support » Plugin: Sidebar Login » [Plugin: Sidebar Login] Make error messages customizable

Viewing 2 replies - 1 through 2 (of 2 total)
  • I see now that you are following the WP convention of including <strong>ERROR</strong>: at the beginning of your messages. This is probably best practice.

    New request: Create a filter. Here’s what I have tried:

    foreach ($login_errors->get_error_messages() as $error) {
      $error = apply_filters('sidebar_login_error', $error);
      echo '<div class="login_error">' . $error . "</div>\n";
      break;
    }

    (Maybe that break should be removed, and an ul of errors be created. I suppose for simple sidebar login it is sufficient to show only the first error.)

    Then I add this filter to my functions.php:

    function change_login_error_message($message)
    {
        return str_replace('<strong>ERROR</strong>: ', '', $message);
    }
    add_filter('sidebar_login_error', 'change_login_error_message');

    A bit hacky to be string replacing, but works since you followed convention!

    Mike

    (@jolley_small)

    Good suggestion. Will add.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: Sidebar Login] Make error messages customizable’ is closed to new replies.