Jump to:

23487 Posts in 18996 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » Using ss member class to authenticate external php app

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 870 Views
  • martbarr
    Community Member
    46 Posts

    Using ss member class to authenticate external php app Link to this post

    Can I do this easily?

    I have a need to authenticate users in my own app where users must already be logged into ss.
    I just need to do something like IsUserLoggedIn($Usr) and get a 0 or 1 returned depending whether SS user is logged in.
    I'll maintain my own user table and allowed actions in my app.
    Just need a Yes or No from SS

    I can see the Member class - how do I call it from a non SS app?
    Or do I think again?


  • Willr
    Forum Moderator
    5508 Posts

    Re: Using ss member class to authenticate external php app Link to this post

    I don't believe you can check to see if a member is logged in on the site as it involves cookies / session data on their side. You can implement your own functionality for this however. One way would be to add a field to member IsLoggedIn and a couple of functions as a decorator.


    class TrackedMember extends DataObjectDecorator {

    function extraStatics() {
    return array('db' => array('IsLoggedIn' => 'Boolean'));

    function memberLoggedIn() {
    $this->owner->IsLoggedIn = true;

    function memberLoggedOut() {
    $this->owner->IsLoggedIn = false;

    Then you can directly query the Members table in the database for IsLoggedIn. Its not perfect, if the session expires then loggedout will never fire so perhaps a check on the last visited date would work.

Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.