• Resolved DamirCalusic

    (@webkreativ)


    Hi,

    I am checking for th proper age of a user with the function login_with_vipps_authenticate_user and it works great where I deny access to the user with returning false in the function.

    Now I would like to add a custom (Age not proper for an example) error message to the login screen and replace the current emssage I get whih is 'Could not find any user with your registered email. Cannot log in.' .

    What filter/hook/action could I use for that?

    • This topic was modified 1 year, 9 months ago by DamirCalusic.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Iver Odin Kvello

    (@iverok)

    Hm, there isn’t a hook that would allow you to do this directly (yet).

    However, you can control a bit how errors are handled anyway. First, is this for WooCommerce, for the standard WP screen or for another type of application?

    Basically, you can redirect to a different page using the 'continue_with_vipps_error_login_redirect' or 'continue_with_vipps_error_woocommerce_login_redirect' filters; and manipulate an internal session object by using several other hooks. However there is a WooCommerce action that receives and prints out the standard error messages unless you un-hook it so if you are using WooCommerce, there is a bit of code to handle.

    Would you prefer to have a filter to directly manipulate the error message for when there is no user (and the user cannot register )? Something along the lines of

    apply_filters('login_with_vipps_invalid_user_message', $msg, $userinfo, $session);

    — just let me know and I can add something like this.

    Thread Starter DamirCalusic

    (@webkreativ)

    Hi,

    A filter like apply_filters('login_with_vipps_invalid_user_message', $msg, $userinfo, $session); would be really great where you pass the userinfwhere we can target the birthDay (and others) like I was able in the authenticate filter when I denied access to users below a certain age.

    It would be awesome to then print out custom error messages for specific custom purposes.

    Is this something you could as soon as possible

    Plugin Author Iver Odin Kvello

    (@iverok)

    I’ve just published version 1.2.5 with this filter:

    ?$msg = apply_filters('login_with_vipps_invalid_user_message', $msg, $userinfo, $session);

    There is also now a more general filter,

    apply_filters('continue_with_vipps_login_errordescription', $errordesc, $error, $sessiondata, $application);

    — but the first is more specific for your case.

    Thread Starter DamirCalusic

    (@webkreativ)

    Thank you very much @iverok, the filter works perfectly!

    • This reply was modified 1 year, 9 months ago by DamirCalusic.
    • This reply was modified 1 year, 9 months ago by DamirCalusic.
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Display custom error message’ is closed to new replies.