BuddyDev

Search

How to display default wordpress login error message inside theme


  • Participant
    Level: Master
    Posts: 225
    Tosin on #21649

    Hello,

    Please how can I display the default login error messages that appear in the wp-login.php page in my theme. I have a login form in my theme, when users try to login in my home page with incorrect login credentials the whole page reloads without displaying any reason why the login failed. I want this login error to display on all pages and posts.

    I currently have this code in my functions.php file maybe it might help but now I want the login to show on all pages without using bp_before_directory_members in the code below.

     /**
     * Show error messages from buddydev.
     */
    function buddydev_show_notices() {
    	do_action( 'template_notices' );
    }
    
    add_action( 'bp_before_directory_members', 'buddydev_show_notices' ); 

    Thanks


  • Participant
    Level: Master
    Posts: 225
    Tosin on #21667

    Any feedback sir

    thank you


  • Keymaster
    (BuddyDev Team)
    Posts: 16430
    Brajesh Singh on #21677

    Hi Tosin,
    I am sorry, I am not sure what the question is.

    Please answer me a few questions to help me understand it.

    1. Are you using wp-login.php or not
    2. Is it a custom login page by your theme?

    If it is the second case Please contact theme authors or code providing the login functionality. The above code and login notices are very different and unrelated(unless someone makes code to grab the login error and add it as BuddyPress notice).

    My suggestions to fix the cause of the issue as it should be properly handled by the login code.

    Regards
    Brajesh


  • Participant
    Level: Master
    Posts: 225
    Tosin on #21681

    Hello Brajesh,

    I am using wp-login.php and not a custom login page.

    I am using the Klein theme which has a login button in the theme header and this button appears on all pages and post to logged out users, when the button is clicked a popup login modal box appears.

    When you try to login with the popup login box/form and not wp-login.php page with incorrect login credentials. The whole page reloads without login being successful, now the problem is that after the page reloads there is no error message informing the user why his/her login failed.

    I want to call the same error message that appears in wp-login.php inside the theme, so that users will always see an error message when their login fails irrespective of user login either through wp-login.php or the site’s homepage.

    It is not compulsory for the error message to appear as a buddypress notice I was using this as an example.

    Thanks


  • Keymaster
    (BuddyDev Team)
    Posts: 16430
    Brajesh Singh on #21686

    Hi Tosin,
    You are using a pro theme. Please contact theme developers for help as the functionality is provided by them.

    Regards
    Brajesh

You must be logged in to reply to this topic.

This topic is: not resolved
Subscribe