當前位置: 首頁>>代碼示例>>PHP>>正文


PHP PhabricatorUser::getIsMailingList方法代碼示例

本文整理匯總了PHP中PhabricatorUser::getIsMailingList方法的典型用法代碼示例。如果您正苦於以下問題:PHP PhabricatorUser::getIsMailingList方法的具體用法?PHP PhabricatorUser::getIsMailingList怎麽用?PHP PhabricatorUser::getIsMailingList使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PhabricatorUser的用法示例。


在下文中一共展示了PhabricatorUser::getIsMailingList方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: buildUserInformationDictionary

 protected function buildUserInformationDictionary(PhabricatorUser $user, $with_email = false, $with_availability = false)
 {
     $roles = array();
     if ($user->getIsDisabled()) {
         $roles[] = 'disabled';
     }
     if ($user->getIsSystemAgent()) {
         $roles[] = 'agent';
     }
     if ($user->getIsMailingList()) {
         $roles[] = 'list';
     }
     if ($user->getIsAdmin()) {
         $roles[] = 'admin';
     }
     $primary = $user->loadPrimaryEmail();
     if ($primary && $primary->getIsVerified()) {
         $email = $primary->getAddress();
         $roles[] = 'verified';
     } else {
         $email = null;
         $roles[] = 'unverified';
     }
     if ($user->getIsApproved()) {
         $roles[] = 'approved';
     }
     if ($user->isUserActivated()) {
         $roles[] = 'activated';
     }
     $return = array('phid' => $user->getPHID(), 'userName' => $user->getUserName(), 'realName' => $user->getRealName(), 'image' => $user->getProfileImageURI(), 'uri' => PhabricatorEnv::getURI('/p/' . $user->getUsername() . '/'), 'roles' => $roles);
     if ($with_email) {
         $return['primaryEmail'] = $email;
     }
     if ($with_availability) {
         // TODO: Modernize this once we have a more long-term view of what the
         // data looks like.
         $until = $user->getAwayUntil();
         if ($until) {
             $return['currentStatus'] = 'away';
             $return['currentStatusUntil'] = $until;
         }
     }
     return $return;
 }
開發者ID:pugong,項目名稱:phabricator,代碼行數:44,代碼來源:UserConduitAPIMethod.php

示例2: makeMailingListUser

 /**
  * @task role
  */
 public function makeMailingListUser(PhabricatorUser $user, $mailing_list)
 {
     $actor = $this->requireActor();
     if (!$user->getID()) {
         throw new Exception(pht('User has not been created yet!'));
     }
     $user->openTransaction();
     $user->beginWriteLocking();
     $user->reload();
     if ($user->getIsMailingList() == $mailing_list) {
         $user->endWriteLocking();
         $user->killTransaction();
         return $this;
     }
     $log = PhabricatorUserLog::initializeNewLog($actor, $user->getPHID(), PhabricatorUserLog::ACTION_MAILING_LIST);
     $log->setOldValue($user->getIsMailingList());
     $log->setNewValue($mailing_list);
     $user->setIsMailingList((int) $mailing_list);
     $user->save();
     $log->save();
     $user->endWriteLocking();
     $user->saveTransaction();
     return $this;
 }
開發者ID:truSense,項目名稱:phabricator,代碼行數:27,代碼來源:PhabricatorUserEditor.php


注:本文中的PhabricatorUser::getIsMailingList方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。