getApplicantCount() 공개 메소드

Get the current number of applicants waiting to be approved.
public getApplicantCount ( boolean $Force = false ) : integer
$Force boolean Whether or not to force a cache refresh.
리턴 integer Returns the number of applicants or 0 if the registration method isn't set to approval.
예제 #1
0
 /**
  * Get the current number of applicants waiting to be approved.
  *
  * @return int Returns the number of applicants or 0 if the registration method isn't set to approval.
  */
 public function getApplicantCount()
 {
     $roleModel = new RoleModel();
     $result = $roleModel->getApplicantCount();
     return $result;
 }
예제 #2
0
 /**
  *
  *
  * @param SiteNavModule $sender
  */
 public function siteNavModule_init_handler($sender)
 {
     // GLOBALS
     // Add a link to the community home.
     $sender->addLinkToGlobals(t('Community Home'), '/', 'main.home', '', -100, array('icon' => 'home'), false);
     $sender->addGroupToGlobals('', 'etc', '', 100);
     $sender->addLinkToGlobalsIf(Gdn::session()->isValid() && IsMobile(), t('Full Site'), '/profile/nomobile', 'etc.nomobile', '', 100, array('icon' => 'resize-full'));
     $sender->addLinkToGlobalsIf(Gdn::session()->isValid(), t('Sign Out'), SignOutUrl(), 'etc.signout', '', 100, array('icon' => 'signout'));
     $sender->addLinkToGlobalsIf(!Gdn::session()->isValid(), t('Sign In'), SigninUrl(), 'etc.signin', '', 100, array('icon' => 'signin'));
     // DEFAULTS
     if (!Gdn::session()->isValid()) {
         return;
     }
     $sender->addLinkIf(Gdn::session()->isValid(), t('Profile'), '/profile', 'main.profile', 'profile', 10, array('icon' => 'user'))->addLinkIf('Garden.Activity.View', t('Activity'), '/activity', 'main.activity', 'activity', 10, array('icon' => 'time'));
     // Add the moderation items.
     $sender->addGroup(t('Moderation'), 'moderation', 'moderation', 90);
     if (Gdn::session()->checkPermission('Garden.Users.Approve')) {
         $RoleModel = new RoleModel();
         $applicant_count = (int) $RoleModel->getApplicantCount();
         if ($applicant_count > 0 || true) {
             $sender->addLink(t('Applicants'), '/user/applicants', 'moderation.applicants', 'applicants', array(), array('icon' => 'user', 'badge' => $applicant_count));
         }
     }
     $sender->addLinkIf('Garden.Moderation.Manage', t('Spam Queue'), '/log/spam', 'moderation.spam', 'spam', array(), array('icon' => 'spam'))->addLinkIf('Garden.Settings.Manage', t('Dashboard'), '/settings', 'etc.dashboard', 'dashboard', array(), array('icon' => 'dashboard'));
     $user = Gdn::controller()->data('Profile');
     $user_id = val('UserID', $user);
     //EDIT PROFILE SECTION
     // Users can edit their own profiles and moderators can edit any profile.
     $sender->addLinkToSectionIf(hasEditProfile($user_id), 'EditProfile', t('Profile'), userUrl($user, '', 'edit'), 'main.editprofile', '', array(), array('icon' => 'edit'))->addLinkToSectionIf('Garden.Users.Edit', 'EditProfile', t('Edit Account'), '/user/edit/' . $user_id, 'main.editaccount', 'Popup', array(), array('icon' => 'cog'))->addLinkToSection('EditProfile', t('Back to Profile'), userUrl($user), 'main.profile', '', 100, array('icon' => 'arrow-left'));
     //PROFILE SECTION
     $sender->addLinkToSectionIf(c('Garden.Profile.ShowActivities', true), 'Profile', t('Activity'), userUrl($user, '', 'activity'), 'main.activity', '', array(), array('icon' => 'time'))->addLinkToSectionIf(Gdn::controller()->data('Profile.UserID') == Gdn::session()->UserID, 'Profile', t('Notifications'), userUrl($user, '', 'notifications'), 'main.notifications', '', array(), array('icon' => 'globe', 'badge' => Gdn::controller()->data('Profile.CountNotifications')))->addLinkToSectionIf(strcasecmp(c('Garden.Registration.Method'), 'invitation') === 0, 'Profile', t('Invitations'), userUrl($user, '', 'invitations'), 'main.invitations', '', array(), array('icon' => 'ticket'))->addLinkToSectionIf(hasEditProfile($user_id), 'Profile', t('Edit Profile'), userUrl($user, '', 'edit'), 'Profile', 'main.editprofile', '', array(), array('icon' => 'edit'));
 }
예제 #3
0
 /**
  * Handle a user application.
  *
  * @since 2.0.0
  * @access private
  * @see UserModel::decline, UserModel::approve
  *
  * @param string $Action Approve or Decline.
  * @param int $UserID Unique ID.
  * @return bool Whether handling was successful.
  */
 private function handleApplicant($Action, $UserID)
 {
     $this->permission('Garden.Users.Approve');
     if (!in_array($Action, array('Approve', 'Decline')) || !is_numeric($UserID)) {
         $this->Form->addError('ErrorInput');
         $Result = false;
     } else {
         $UserModel = new UserModel();
         if (is_numeric($UserID)) {
             try {
                 $this->EventArguments['UserID'] = $UserID;
                 $this->fireEvent("Before{$Action}User");
                 $Email = new Gdn_Email();
                 $Result = $UserModel->{$Action}($UserID, $Email);
                 // Re-calculate applicant count
                 $RoleModel = new RoleModel();
                 $RoleModel->getApplicantCount(true);
                 $this->fireEvent("After{$Action}User");
             } catch (Exception $ex) {
                 $Result = false;
                 $this->Form->addError(strip_tags($ex->getMessage()));
             }
         }
     }
     return $Result;
 }
예제 #4
0
파일: class.hooks.php 프로젝트: R-J/vanilla
 /**
  *
  *
  * @param SiteNavModule $sender
  */
 public function siteNavModule_default_handler($sender)
 {
     if (Gdn::session()->isValid()) {
         $sender->addLink('main.profile', array('text' => t('Profile'), 'url' => '/profile', 'icon' => icon('user'), 'sort' => 10));
     }
     if (Gdn::session()->checkPermission('Garden.Activity.View')) {
         $sender->addLink('main.activity', array('text' => t('Activity'), 'url' => '/activity', 'icon' => icon('time'), 'sort' => 10));
     }
     // Add the moderation items.
     $sender->addGroup('moderation', array('text' => t('Moderation'), 'sort' => 90));
     if (Gdn::session()->checkPermission('Garden.Users.Approve')) {
         $RoleModel = new RoleModel();
         $applicant_count = (int) $RoleModel->getApplicantCount();
         if ($applicant_count > 0 || true) {
             $sender->addLink('moderation.applicants', array('text' => t('Applicants'), 'url' => '/user/applicants', 'icon' => icon('user'), 'badge' => countString($applicant_count)));
         }
     }
     if (Gdn::session()->checkPermission('Garden.Modertion.Manage')) {
         $sender->addLink('moderation.spam', array('text' => 'Spam Queue', 'url' => '/log/spam', 'icon' => icon('spam')));
         //         $sender->addLink('moderation.queue', array('text' => 'Moderaton Queue', 'url' => '/log/moderation', 'icon' => icon('report')));
     }
     if (Gdn::session()->checkPermission('Garden.Settings.Manage')) {
         $sender->addLink('etc.dashboard', array('text' => t('Dashboard'), 'url' => '/settings', 'icon' => icon('dashboard')));
     }
 }