示例#1
0
function topica_users_register(&$pObject)
{
    global $gBitSystem;
    if ($gBitSystem->isPackageActive('topica')) {
        $topica = new LibertyTopica($pObject->mContentId);
        $topica->load();
        if (isset($topica->mInfo['first_name']) || isset($topica->mInfo['last_name'])) {
            $prefs = array('prefs' => 'y', 'real_name' => ($topica->mInfo['first_name'] ? $topica->mInfo['first_name'] . " " : "") . ($topica->mInfo['last_name'] ? $topica->mInfo['last_name'] : ""));
            require_once USERS_PKG_PATH . 'BitUser.php';
            $tempUser = new BitUser($pObject->mUserId);
            $tempUser->load(TRUE);
            $tempUser->store($prefs);
        }
        if (isset($topica->mInfo['pump'])) {
            if ($topica->mInfo['pump'] == 'y') {
                $topica->pumpTopica();
            }
        }
    }
}
示例#2
0
 /**
  * store 
  * 
  * @param array $pParamHash 
  * @access public
  * @return TRUE on success, FALSE on failure - mErrors will contain reason for failure
  */
 function store(&$pParamHash)
 {
     global $gBitSystem;
     // keep track of newUser before calling base class
     $newUser = !$this->isRegistered();
     $this->StartTrans();
     if (BitUser::store($pParamHash) && $newUser) {
         $defaultRoles = $this->getDefaultRole();
         $this->addUserToRole($this->mUserId, $defaultRoles);
         if ($gBitSystem->isFeatureActive('users_eponymous_roles')) {
             // Create a role just for this user, for permissions assignment.
             $roleParams = array('user_id' => $this->mUserId, 'name' => $pParamHash['user_store']['login'], 'desc' => "Personal role for " . (!empty($pParamHash['user_store']['real_name']) ? $pParamHash['user_store']['real_name'] : $pParamHash['user_store']['login']));
             if ($this->storeRole($roleParams)) {
                 $this->addUserToRole($this->mUserId, $roleParams['role_id']);
             }
         }
         $this->load(TRUE);
         // store any uploaded images, this can stuff mErrors, so we want to do this as the very last thing.
         $pParamHash['upload']['thumbnail'] = FALSE;
         // i don't think this does anything - perhaps replace it by setting thumbnail_sizes
         $this->storeImages($pParamHash);
     }
     $this->CompleteTrans();
     return count($this->mErrors) == 0;
 }