Added isGuest() isConfirmed() to BaseUser for wrapping this type of check into
[core.git] / inc / classes / main / user / member / class_Member.php
index a0bec17..1b939c2 100644 (file)
@@ -40,6 +40,7 @@ class Member extends BaseUser implements ManageableMember, Registerable {
         * @param       $userName               Username we need a class instance for
         * @return      $userInstance   An instance of this user class
         * @throws      UsernameMissingException        If the username does not exist
         * @param       $userName               Username we need a class instance for
         * @return      $userInstance   An instance of this user class
         * @throws      UsernameMissingException        If the username does not exist
+        * @throws      UnexpectedGuestAccountException         If the user status is 'guest'
         */
        public static final function createMemberByUsername ($userName) {
                // Get a new instance
         */
        public static final function createMemberByUsername ($userName) {
                // Get a new instance
@@ -52,7 +53,10 @@ class Member extends BaseUser implements ManageableMember, Registerable {
                if ($userInstance->ifUsernameExists() === FALSE) {
                        // Throw an exception here
                        throw new UsernameMissingException(array($userInstance, $userName), self::EXCEPTION_USERNAME_NOT_FOUND);
                if ($userInstance->ifUsernameExists() === FALSE) {
                        // Throw an exception here
                        throw new UsernameMissingException(array($userInstance, $userName), self::EXCEPTION_USERNAME_NOT_FOUND);
-               } // END - if
+               } elseif ($userInstance->isGuest()) === TRUE) {
+                       // User should not be a guest here
+                       throw new UnexpectedGuestAccountException(array($userInstance, $userName), self::EXCEPTION_USERNAME_NOT_FOUND);
+               }
 
                // Return the instance
                return $userInstance;
 
                // Return the instance
                return $userInstance;
@@ -130,8 +134,8 @@ class Member extends BaseUser implements ManageableMember, Registerable {
                $updateInstance = ObjectFactory::createObjectByConfiguredName('update_criteria_class');
 
                // And add our both entries
                $updateInstance = ObjectFactory::createObjectByConfiguredName('update_criteria_class');
 
                // And add our both entries
-               $updateInstance->addCriteria("last_activity", date("Y-m-d H:i:s", time()));
-               $updateInstance->addCriteria("last_action", $lastAction);
+               $updateInstance->addCriteria('last_activity', date('Y-m-d H:i:s', time()));
+               $updateInstance->addCriteria('last_action', $lastAction);
 
                // Add the search criteria for searching for the right entry
                $updateInstance->setSearchInstance($searchInstance);
 
                // Add the search criteria for searching for the right entry
                $updateInstance->setSearchInstance($searchInstance);