Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Why Auth::create_user('....', '....', ...); I got Invalid Method error !
  • I think make an admin panel become mystery for me.

    I create Ormauth process and i have tables in the database, I try to follow the only tut on Admin panel (I doesn't find one in the doc...) made by Ph. Sturgeon but I can't doing the line:

    Auth::create_user('admin', 'password', 'phil@example.com', 100);

    I don't know why ? I got the error:
    Parse Error - Invalid Method: Auth\Auth::create_user

    In fact there is no method like it in the Auth class...

    Can I have some info to make an admin panel and how create the Administrator ?
  • HarroHarro
    Accepted Answer
    Ormauth was introduced in 1.6, so I don't think there's a tutorial on it yet. But it's API is largely compatible with Simpleauth, so methods like create_user() will work the same.

    Are you use the Auth package is loaded, and the correct driver is defined in your auth.php configuration file. You haven't extended anything that interferes with the correct working? You haven't enabled 'multiple_logins' in your config?

    The Auth class works with an __callStatic() magic method to capture calls to static methods, and re-route them to the correct driver subclass (login, group or acl). This only works if there is only one of each, otherwise Auth doesn't know which class to call.

    Which is why it doesn't work if you have set 'multiple_logins' to true.
  • I was not clear to me that you say about 'multiple_login's', i'll try with false...

    Auth is very complex class, i can't understand it by reading the code because i have not much experience on php and at least the feature of this langage change a lot since i learn with...

    It's ok, Auth::create user() going on.

  • HarroHarro
    Accepted Answer
    It is very clearly noted in the docs, see http://fuelphp.com/docs/packages/auth/intro.html#/configuration

    It has nothing to do with users logging in multiple times, it's a driver setting. And it should be false unless you have multiple Login drivers active, and you support multiple driver logins.

    I use that for example in corporate applications, where authentication happens against an Active Directory, but group and ACL info is stored locally, so I need simultaneous login with two drivers.

    Two login drivers active means two classes containing a 'create_user' method, so Auth doesn't know which one to call. Which is why the static methods no longer work, and you will have to use

    \Auth::instance('yourlogindriver')->create_user();

    instead, which calls the method on a specific driver instance.


  • So, Mea maxima culpa, i had misunderstanding about that point, it's look fine now...
    And special bonus for the super_admin, i resume my build...
    Thank's a lot !

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion