本文整理汇总了PHP中Members::findFirstById方法的典型用法代码示例。如果您正苦于以下问题:PHP Members::findFirstById方法的具体用法?PHP Members::findFirstById怎么用?PHP Members::findFirstById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Members
的用法示例。
在下文中一共展示了Members::findFirstById方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addAction
public function addAction($id = null)
{
$this->view->disable();
$userSession = $this->session->get("userSession");
if ($this->request->isGet() && isset($id)) {
$members = Members::findFirstById($id);
if (!$members) {
return $this->response->redirect($this->request->getHTTPReferer());
}
}
if ($this->request->isGet()) {
$friendRequest = new FriendRequests();
$friendRequest->created = date('Y-m-d H:i:s');
$friendRequest->modified = date('Y-m-d H:i:s');
$friendRequest->member_id = $id;
$friendRequest->requester_id = $userSession['id'];
$friendRequest->status = 'Requested';
if ($friendRequest->create()) {
//error_log('ID :'.$id);
$this->flash->success('<button type="button" class="close" data-dismiss="alert">×</button>You\'re friend request has been submitted.');
return $this->response->redirect($this->request->getHTTPReferer());
}
}
}
示例2: pageAction
public function pageAction($id = null)
{
$userSession = $this->session->get('userSession');
$member = Members::findFirstById($id);
$this->view->setVar('member', $member);
$reviews = Reviews::find(array('member_id = "' . $id . '"', 'order' => 'id DESC'));
$this->view->setVar('reviews', $reviews);
$claimRequests = ClaimRequests::find(array('member_id = "' . $id . '"', 'order' => 'id DESC'));
$this->view->setVar('claimrequest', $claimRequests);
}
示例3: resetPasswordAction
public function resetPasswordAction($userId = null, $email = null, $activationToken = null, $resetPasswordId = null)
{
if ($this->request->isPost()) {
$error = 0;
if (empty($this->request->getPost('new_password')) || empty($this->request->getPost('confirm_password'))) {
$this->flash->warning('<button type="button" class="close" data-dismiss="alert">×</button>All fields required. Please try again.');
$error = 1;
}
if ($this->request->getPost('new_password') != $this->request->getPost('confirm_password')) {
$this->flash->warning('<button type="button" class="close" data-dismiss="alert">×</button>Password fields does not match. Please try again.');
$error = 1;
}
if ($error == 0) {
if (isset($resetPasswordId)) {
$member = Members::findFirstById($userId);
$member->modified = date('Y-m-d H:i:s');
$member->password = $this->security->hash($this->request->getPost('new_password'));
if ($member->update()) {
$resetPassword = ResetPasswords::findFirstById($resetPasswordId);
$resetPassword->modified = date('Y-m-d H:i:s');
$resetPassword->used = 'Y';
if ($resetPassword->update()) {
$this->flash->success('<button type="button" class="close" data-dismiss="alert">×</button>Password has been updated. You can now login');
return $this->response->redirect();
}
}
}
}
} else {
$tomorrow = new DateTime('tomorrow');
$resetPassword = ResetPasswords::findFirst(array('columns' => '*', 'conditions' => 'user_id = ?1 AND email=?2 AND token = ?3 AND used = ?4 AND modified BETWEEN ?5 AND ?6', 'bind' => array(1 => $userId, 2 => $email, 3 => $activationToken, 4 => 'N', 5 => date('Y-m-d 00:00:00'), 6 => $tomorrow->format('Y-m-d 00:00:00'))));
if ($resetPassword) {
$this->view->setVar('referer', $this->config->application->baseUri . 'member/resetPassword/' . $userId . '/' . $email . '/' . $activationToken . '/' . $resetPassword->id);
//$this->view->setVar('resetPassword', $resetPassword);
} else {
$this->flash->error('<button type="button" class="close" data-dismiss="alert">×</button>Reset password link you use is either incorrect or no longer valid. Please, try again.');
return $this->response->redirect();
}
}
}