Login Errors - system_message and register_error?

Hi there

I'm building a plugin that has a custom login screen.  How do I get hold of the error messages for users on login fail? e.g. "We could not log you in. Please check your username/email and password."

I have tried accessing the data in system_message and register_error with a var_dump but have not been able to find these errors.  Can anyone please help?

 

Thanks in advance

  • Use Custom index plugin for Custom login screen,

    You can rename custom index login page

  • Thanks Deepan.  I'm pretty much the whole way through building my custom screens, so I don't want to head down another path.  Is there anyway programatically to get hold of the error messages for users on login fail? e.g. "We could not log you in. Please check your username/email and password."

    Thanks

  • What exactly do you mean by "get hold of"? Do you want to modify the text output or do you want to suppress the output of the messages? In case of modifying the text output look into the language files (I guess main language file will contain the text of these messages - 'login:empty'). There you will find the language strings that define the content of these messages. I think it should work to add these strings to the language files of your own plugin with a modified text.

    In case you want to suppress the output of the error messages (though I don't know what sense this would make...) you need to overwrite the login action file with a modified version without the error message output in your own plugin.

  • Hi iionly,

    I actually want to display the error messages but am not sure how they are made available. I have tried register_error() and system_messages() but the error messages are not contained within them. Any idea how to obtain the error messages so that I can display them.

    Ps - I am aware on the ability to change wording in languages, however that's not what I'm looking for here.

    Thanks.

  • I looked through the code and found the error messages to be created by session handling (engine/lib/sessions.php). There's the function _elgg_session_boot() that initiates a session and this function calls a pam handler function pam_auth_userpass(). Within pam_auth_userpass() the error messages are created via LoginException().

    Well, that's new code to me, too. I don't think that you can circumvent/ modify the error messages by simply customizing the login page as session handling is surely a deeper level that the login process sits on top of.

  • Thanks iionly. I will check it out and respond. Given the MVC nature of the app, I am assuming that the error codes are separate from any view that is displaying them so hopefully I can still display the errors in my custom login. Thanks again. 

Beginning Developers

Beginning Developers

This space is for newcomers, who wish to build a new plugin or to customize an existing one to their liking