本文整理汇总了PHP中PFUser::isActive方法的典型用法代码示例。如果您正苦于以下问题:PHP PFUser::isActive方法的具体用法?PHP PFUser::isActive怎么用?PHP PFUser::isActive使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PFUser
的用法示例。
在下文中一共展示了PFUser::isActive方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: account_add_user_obj_to_group
/**
* Add a new user into a given project
*
* @param Integer $group_id Project id
* @param PFUser $user User to add
*
* @return Boolean
*/
function account_add_user_obj_to_group($group_id, PFUser $user)
{
//user was found but if it's a pending account adding
//is not allowed
if (!$user->isActive() && !$user->isRestricted()) {
$GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('include_account', 'account_notactive', $user->getUserName()));
return false;
}
//if not already a member, add it
$res_member = db_query("SELECT user_id FROM user_group WHERE user_id=" . $user->getId() . " AND group_id='" . db_ei($group_id) . "'");
if (db_numrows($res_member) < 1) {
//not already a member
db_query("INSERT INTO user_group (user_id,group_id) VALUES (" . db_ei($user->getId()) . "," . db_ei($group_id) . ")");
//if no unix account, give them a unix_uid
if ($user->getUnixStatus() == 'N' || !$user->getUnixUid()) {
$user->setUnixStatus('A');
$um = UserManager::instance();
$um->assignNextUnixUid($user);
$um->updateDb($user);
}
// Raise an event
$em = EventManager::instance();
$em->processEvent('project_admin_add_user', array('group_id' => $group_id, 'user_id' => $user->getId(), 'user_unix_name' => $user->getUserName()));
$GLOBALS['Response']->addFeedback('info', $GLOBALS['Language']->getText('include_account', 'user_added'));
account_send_add_user_to_group_email($group_id, $user->getId());
group_add_history('added_user', $user->getUserName(), $group_id, array($user->getUserName()));
return true;
} else {
$GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('include_account', 'user_already_member'));
}
return false;
}
示例2: user_can_search
public function user_can_search()
{
return $this->user->isActive();
}
示例3: user_to_soap
/**
* User can get information about other users if they are active, retricted or suspended
*
* Suspended is needed to be coherent with the GUI where the suspended users are displayed
* like active users to people (otherwise it breaks Mylyn on trackers due to workflow manager)
*
* @param string $identifier
* @param PFUser $user
* @param PFUser $current_user
* @return array
*/
function user_to_soap($identifier, PFUser $user = null, PFUser $current_user)
{
if ($user !== null && ($user->isActive() || $user->isRestricted() || $user->isSuspended())) {
if ($current_user->canSee($user)) {
return array('identifier' => $identifier, 'username' => $user->getUserName(), 'id' => $user->getId(), 'real_name' => $user->getRealName(), 'email' => $user->getEmail(), 'ldap_id' => $user->getLdapId());
}
}
}