Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Looking for Users Online package/code
  • Hello,

    Is there a Users Online package that shows a view or returns the current user list of active sessions?

    Thanks
  • HarroHarro
    Accepted Answer
    No, at the moment there is no relation between sessions and users.

    If you want that you need to extend the session driver you use (anyone by Cookie), and have it add the current logged-in userid when a session record is saved. And save as 0 if not logged in.

    You can then query the sessions, and use the last update timestamp to determine who is logged in or not (typically users active in the last 15 or 30 minutes is used).
  • Thanks Harro, right now I am having an issue getting database sessions to work.
    When I try and login, I see no errors, but cannot login.


    // if no session type is requested, use the default
        'driver'            => 'db',

    // specific configuration settings for database based sessions
        'db'            => array(
            'cookie_name'        => 'fueldid',                // name of the session cookie for database based sessions
            'database'            => 'fuel_dev',                    // name of the database name (as configured in config/db.php)
            'table'                => 'users_sessions',                // name of the sessions table
            'gc_probability'    => 5,                        // probability % (between 0 and 100) for garbage collection
                            ),

  • If you have your sessions in your default db, you don't need to specify "database", that is only if you need to share sessions across multiple apps in the same domain.

    You did create the table (there's an oil task for it, "oil refine session")? If so, do you see records appear in the table?
  • I used oil and it created users, users_sessions, users_sessionsscopes
    But after I log in, users_sessions has no records.

  • HarroHarro
    Accepted Answer
    that is not the session table, those are auth tables.

    "session" is a separate oil task, you run it using "oil refine session"
  • Thanks Harro

Howdy, Stranger!

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

In this Discussion