Adds isActive in both User and Profile classes.
authorStéphane Jacob <sj@m4x.org>
Mon, 12 Jul 2010 11:50:42 +0000 (13:50 +0200)
committerStéphane Jacob <sj@m4x.org>
Mon, 12 Jul 2010 13:26:42 +0000 (15:26 +0200)
Signed-off-by: Stéphane Jacob <sj@m4x.org>
classes/profile.php
classes/user.php

index 095d1ef..8c791fa 100644 (file)
@@ -198,6 +198,14 @@ class Profile
         return $this->owner;
     }
 
+    public function isActive()
+    {
+        if ($this->owner()) {
+            return $this->owner->isActive();
+        }
+        return false;
+    }
+
     public function promo()
     {
         return $this->promo;
index db0f675..64991a4 100644 (file)
@@ -260,6 +260,11 @@ class User extends PlUser
                                    WHERE  a.uid = {?}', $this->id());
     }
 
+    public function isActive()
+    {
+        return $this->state == 'active';
+    }
+
     /** Overload PlUser::promo(): there no promo defined for a user in the current
      * schema. The promo is a field from the profile.
      */