Sidebar Login
Make error messages customizable (3 posts)

  1. Nyhm
    Posted 4 years ago #

    I really like Sidebar Login (and it will be great when this other 2.3 bug is fixed).

    Please make the error messages customizable in the admin settings. In particular:

    <strong>ERROR</strong>: Please enter a username.


    <strong>ERROR</strong>: Please enter your password.

    (My intent is to remove the <strong>ERROR</strong>: part, because proper styling makes it clear there is an error.)

    Many thanks for the great plugin.


  2. Nyhm
    Posted 4 years ago #

    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";

    (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!

  3. Mike
    Posted 4 years ago #

    Good suggestion. Will add.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Sidebar Login
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic