Welcome Guest, Not a member yet? Register   Sign In
Ion Auth - Lightweight Auth System based on Redux Auth 2

[eluser]JonoB[/eluser]
[quote author="DephNet[Paul]" date="1307384740"]
I have noticed that a default Ion Auth install uses $this->ion_auth->errors() which reads the language file for displaying the error in the correct language. How can I make use of $this->ion_auth->errors() within my script to call the correct error message from the language file.

Sorry if this is a noobish question, this is my first time using a pre written library for CI.

--Paul[/quote]
$this->ion_auth->errors() is a method used to obtain messages generated by the ion_auth library (application/libraries/ion_auth).

If you look in that file, you will see various bits of code like
Code:
$this->set_error('activate_unsuccessful');
which corresponds to the language file:
Code:
$lang['activate_unsuccessful'] = 'Unable to Activate Account';

Finally, all the messages are output via:
Code:
public function errors()
{
    $_output = '';
    foreach ($this->errors as $error)
    {
        $_output .= $this->error_start_delimiter . $this->ci->lang->line($error) . $this->error_end_delimiter;
    }

    return $_output;
}

Long story short, if you want to output just a single message without using the lib, you can do something like:
Code:
$this->ci->lang->load('ion_auth');
echo $this->ci->lang->line('activate_unsuccessful');


Messages In This Thread
Ion Auth - Lightweight Auth System based on Redux Auth 2 - by El Forum - 06-06-2011, 07:52 AM



Theme © iAndrew 2016 - Forum software by © MyBB