本文整理汇总了PHP中Member::findByUsername方法的典型用法代码示例。如果您正苦于以下问题:PHP Member::findByUsername方法的具体用法?PHP Member::findByUsername怎么用?PHP Member::findByUsername使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Member
的用法示例。
在下文中一共展示了Member::findByUsername方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: manageSubscriptions
public function manageSubscriptions($vars, $enable)
{
$temp = new Member();
$member = $temp->findByUsername($vars['username']);
$memberId = $member->id;
// update subscription (keep old assignments through negating if disabling)
// members_tags_subscribed
// members_threads_subscribed
if ($enable) {
$newSubscriberId = $memberId;
$oldSubscriberId = -1 * $memberId;
} else {
$newSubscriberId = -1 * $memberId;
$oldSubscriberId = $memberId;
}
$query = "\r\n UPDATE\r\n members_tags_subscribed\r\n SET\r\n IdSubscriber = " . $newSubscriberId . "\r\n WHERE\r\n IdSubscriber = " . $oldSubscriberId;
$this->dao->query($query);
$query = "\r\n UPDATE\r\n members_threads_subscribed\r\n SET\r\n IdSubscriber = " . $newSubscriberId . "\r\n WHERE\r\n IdSubscriber = " . $oldSubscriberId;
$this->dao->query($query);
$query = "\r\n UPDATE\r\n membersgroups\r\n SET\r\n IdMember = " . $newSubscriberId . "\r\n WHERE\r\n IdMember = " . $oldSubscriberId . "\r\n AND IacceptMassMailFromThisGroup = 'Yes'\r\n ";
$this->dao->query($query);
}
示例2: confirmSignup
/**
* confirmProcess: check the given key and username
*/
public function confirmSignup($username, $key)
{
// The TB WAY:
$userId = APP_User::userId($username);
if (!$userId) {
return $error = 'NoSuchMember';
}
$keyDB = APP_User::getSetting($userId, 'regkey');
if (!$keyDB) {
return $error = 'NoStoredKey';
}
if ($keyDB->value != $key) {
return $error = 'WrongKey';
}
$memberEntity = new Member();
$member = $memberEntity->findByUsername($username);
$query = '
SELECT members.Status AS Status
FROM members
WHERE members.id = \'' . $member->id . '\'
';
$s = $this->dao->query($query);
if ($s->numRows() != 1) {
return $error = 'NoMember';
}
$Status = $s->fetch(PDB::FETCH_OBJ)->Status;
if ($Status != 'MailToConfirm') {
return $error = 'Status' . $Status;
}
APP_User::activate($userId);
$query = "\r\nUPDATE members\r\nSET Status = 'Active'\r\nWHERE id=" . $member->id;
// The email is confirmed > make the status Active
$s = $this->dao->query($query);
if (!$s) {
// TODO: always integrate this check?
throw new PException('Could not determine if email is in use!');
}
$View = new SignupView($this);
define('DOMAIN_MESSAGE_ID', 'bewelcome.org');
// TODO: config
$View->sendActivationMail($member);
return false;
// no error
}
示例3: composeMessage
public function composeMessage()
{
$username = $this->route_vars['username'];
$request = $this->request_vars[2];
$memberEntity = new Member();
$member = $memberEntity->findByUsername($username);
if ($member) {
switch ($request) {
case 'local':
$this->model->localGreetingSent($member);
break;
case 'global':
$this->model->globalGreetingSent($member);
break;
}
$this->redirectAbsolute('/messages/compose/' . $username);
} else {
$this->redirectAbsolute('/members/' . $username);
}
}
示例4: remove
public function remove()
{
$this->checkRights('Flags');
$flagId = $this->route_vars['id'];
$username = $this->route_vars['username'];
// Check if flag and user exist and if flag is assigned to user at all; redirect if not
$flag = new Flag($flagId);
if (!$flag) {
$this->redirectAbsolute($this->router->url('admin_flags_overview'));
}
$temp = new Member();
$member = $temp->findByUsername($username);
if (!$member) {
$this->redirectAbsolute($this->router->url('admin_flags_overview'));
}
$assigned = $flag->getFlagForMember($member);
if (!$assigned) {
$this->redirectAbsolute($this->router->url('admin_flags_overview'));
}
$page = new AdminFlagsRemovePage();
$flags = $this->model->getFlags(true);
$page->flags = $flags;
$redirectTo = '';
if (isset($_SERVER['HTTP_REFERER'])) {
if (strpos($_SERVER['HTTP_REFERER'], "/list/members") !== false) {
$redirectTo = 'members';
}
if (strpos($_SERVER['HTTP_REFERER'], "/list/member/") !== false) {
$redirectTo = 'member';
}
if (strpos($_SERVER['HTTP_REFERER'], "/list/Flags") !== false) {
$redirectTo = 'Flags';
}
if (strpos($_SERVER['HTTP_REFERER'], "/list/flag/") !== false) {
$redirectTo = 'flag';
}
}
$vars = array('username' => $username, 'flag' => $flagId, 'level' => $assigned->Level, 'scope' => $assigned->Scope, 'comment' => $assigned->Comment, 'redirect' => $redirectTo);
$page->vars = $vars;
return $page;
}
示例5: remove
public function remove()
{
$this->checkRights('Rights');
$rightId = $this->route_vars['id'];
$username = $this->route_vars['username'];
// Check if right and user exist and if right is assigned to user at all; redirect if not
$right = new Right($rightId);
if (!$right) {
$this->redirectAbsolute($this->router->url('admin_rights_overview'));
}
$temp = new Member();
$member = $temp->findByUsername($username);
if (!$member) {
$this->redirectAbsolute($this->router->url('admin_rights_overview'));
}
$assigned = $right->getRightForMember($member);
if (!$assigned) {
$this->redirectAbsolute($this->router->url('admin_rights_overview'));
}
$page = new AdminRightsRemovePage();
$rights = $this->model->getRights(true);
$page->rights = $rights;
$redirectTo = '';
if (isset($_SERVER['HTTP_REFERER'])) {
if (strpos($_SERVER['HTTP_REFERER'], "/list/members") !== false) {
$redirectTo = 'members';
}
if (strpos($_SERVER['HTTP_REFERER'], "/list/member/") !== false) {
$redirectTo = 'member';
}
if (strpos($_SERVER['HTTP_REFERER'], "/list/rights") !== false) {
$redirectTo = 'rights';
}
if (strpos($_SERVER['HTTP_REFERER'], "/list/right/") !== false) {
$redirectTo = 'right';
}
}
$vars = array('username' => $username, 'right' => $rightId, 'level' => $assigned->Level, 'scope' => $assigned->Scope, 'comment' => $assigned->Comment, 'redirect' => $redirectTo);
$page->vars = $vars;
return $page;
}
示例6: remove
/**
* Removes a right from a member
* Keeps the history by setting the level to 0 and updating the comment
* with a note when the removal happened and by whom
*
* @param $vars
* @return bool
*/
public function remove($vars)
{
$temp = new Member();
$member = $temp->findByUsername($vars['username']);
$loggedInMember = $this->getLoggedInMember();
$comment = $vars['comment'] . "\n\nRemoved by " . $loggedInMember->Username . " on " . date('Y-m-d');
$query = "\n UPDATE\n rightsvolunteers\n SET\n Level = '0',\n Scope = '" . $this->dao->escape($vars['scope']) . "',\n Comment = '" . $this->dao->escape($comment) . "',\n Updated = NOW()\n WHERE\n IdMember = " . $member->id . "\n AND IdRight = " . $this->dao->escape($vars['rightid']) . "\n ";
$this->dao->query($query);
return true;
}
示例7: remove
/**
* Removes a flag from a member
* Keeps the history by setting the level to 0 and updating the comment
* with a note when the removal happened and by whom
*
* @param $vars
* @return bool
*/
public function remove($vars)
{
$temp = new Member();
$member = $temp->findByUsername($vars['username']);
$loggedInMember = $this->getLoggedInMember();
$comment = $vars['comment'] . "\n\nRemoved by " . $loggedInMember->Username . " on " . date('Y-m-d');
$query = "\n UPDATE\n flagsmembers fm\n SET\n fm.Level = '0',\n fm.Scope = '" . $this->dao->escape($vars['scope']) . "',\n fm.Comment = '" . $this->dao->escape($comment) . "',\n fm.Updated = NOW()\n WHERE\n fm.IdMember = " . $member->id . "\n AND fm.IdFlag = " . $this->dao->escape($vars['flagid']) . "\n ";
$this->dao->query($query);
return true;
}