• Resolved derevan007

    (@derevan007)


    I have another plugin (Page Restriction) that intercepts and does some additional user validation during the login process. Those errors are not showing up even when the error is added and ur_notice_count() returns 1. When “User Registration” has a login error on its own, it uses the error.php template to create a nice red box with the error (user_registration_error class). How can I customize my other plugin to throw an error to the “User Registration” login window?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi @derevan007,

    If you trying to throw an error from a third-party plugin to the User Registrations’ login form error section then there are two ways that you can use.

    First, you can modify the error.php file and write custom code there by yourself and achieve this. But since this includes code modifying, we will not be able to assist you on this and we do not recommend code editing too since it might cause the plugin to misbehave. You can only do this if you are familiar with working with PHP and have a good grasp of it.

    Second, you can use a filter to change the error message. You can use this filter apply_filters( 'user_registration_add_' . $notice_type, $message );

    The $notice_type needs either the error or success as a value that needs to be passed and the $message will have the message. The error message can be based on conditions that you will need to define while writing the code.

    I hope it helps.
    Regards!

    Thread Starter derevan007

    (@derevan007)

    Thanks for the help. Unfortunately, I’ve tried both of the options you suggested to no avail. I added debug messages to error.php and I can see that it DOES have the proper message. It just does not show up on the form (ie, it did not insert the user-registration-error class into the form). The form URL does show with ?login-error at the end.

    <ul class=”user-registration-error”>
    <?php foreach ( $messages as $message ) : ?>

    • <?php echo wp_kses_post( $message ); ?>
    • <?php endforeach; ?>

    Thread Starter derevan007

    (@derevan007)

    I found a solution to my problem. In the 3rd party plugin, I added a call to the following:

    ur_print_notices();

    The error message is now showing up.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Displaying errors on login screen’ is closed to new replies.