本文整理汇总了PHP中Application_Model_User::getDataByUsername方法的典型用法代码示例。如果您正苦于以下问题:PHP Application_Model_User::getDataByUsername方法的具体用法?PHP Application_Model_User::getDataByUsername怎么用?PHP Application_Model_User::getDataByUsername使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Application_Model_User
的用法示例。
在下文中一共展示了Application_Model_User::getDataByUsername方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: connectYourAccountAction
public function connectYourAccountAction()
{
//get referer sender user Id from session
$usersNs = new Zend_Session_Namespace("app");
$sender_id = $usersNs->sender_id;
//echo "sssss=".$sender_id;
$facebook = $this->view->facebook();
$session = $facebook->getSession();
//echo "<pre>";
//print_r($session);
if (!$session) {
$this->_helper->redirector("register", "index", "default");
}
$uid = $facebook->getUser();
$me = $facebook->api('/me');
//echo "<pre>";
//print_r($me);
//exit;
$params['email'] = $me['email'];
$arrBday = explode("/", $me['birthday']);
$params['year'] = $arrBday[2];
$params['month'] = $arrBday[0];
$params['day'] = $arrBday[1];
$params['firstName'] = $me['first_name'];
$params['lastName'] = $me['last_name'];
if (isset($me['gender']) && $me['gender'] != "") {
$params['sex'] = $me['gender'];
}
$form = new Application_Form_Register();
$form->populate($params);
$elements = $form->getElements();
$form->clearDecorators();
foreach ($elements as $element) {
$element->removeDecorator('label');
}
$this->view->fbmsg = $this->_getParam("fbmsg");
$this->view->form = $form;
$this->view->successMsg = "";
$this->view->sender = $this->_getParam('sender');
if ($this->getRequest()->isPost()) {
$params = $this->getRequest()->getPost();
$params['firstName'] = $me['first_name'];
$params['lastName'] = $me['last_name'];
if (isset($me['gender']) && $me['gender'] != "") {
$params['sex'] = $me['gender'];
}
if ($form->isValid($params)) {
$params['facebookId'] = $uid;
$params['dob'] = $params['year'] . "-" . $params['month'] . "-" . $params['day'];
$params['status'] = 'inactive';
$params['userLevelId'] = 1;
$password = $params['password'];
$params['password'] = md5($params['password']);
$params['status'] = "active";
/*----find gapper id ---*/
$gapper_id = 0;
if ($params['gapperOrFriend'] == "friend") {
$gapperM = new Application_Model_User();
$gapper = $gapperM->getDataByUsername($params['usernameOfGapper']);
if (false !== $gapper) {
$gapper_id = $gapper->getId();
}
}
$params['gapperId'] = $gapper_id;
/*----------------------*/
$user = new Application_Model_User($params);
$user_id = $user->save();
if ($user_id > 0) {
//If user has checked Newsletter, then insert in subscribe table
if ($params['newsletter'] == "yes") {
$user->newsletterSubscribe($user_id);
}
/*---- default permission settings ----*/
$user->setDefaultPermissions($user_id);
$user->setDefaultJournal($user_id);
/*-------------------------------------------*/
/*---------add a friend -------------*/
//$sender_id = base64_decode($this->_getParam('sender'));
//$senderM=new Application_Model_Friend();
//$senderM->addAsFriend($sender_id,$user_id);
$sender_id = $usersNs->sender_id;
if ($sender_id > 0) {
$senderM = new Application_Model_Friend();
$senderM->addAsFriend($sender_id, $user_id);
$senderM->addAsFriend($user_id, $sender_id);
}
/*-------------------------------------*/
$params['activate_link'] = Zend_Registry::get('siteurl') . "/index/activate/id/" . base64_encode($user_id);
$params['password'] = $password;
$usersNs->registration_id = $user_id;
//$mail=new Base_Mail();
//$mail->sendRegistrationMail($params);
$usersNs = new Zend_Session_Namespace("app");
$usersNs->facebookId = $uid;
$this->_helper->redirector('invite', 'index', "default");
}
}
}
}
示例2: photosAction
public function photosAction()
{
/*--------------- MODELS ----------------------*/
$objModelUser = new Application_Model_User();
$objModelAlbum = new Album_Model_Album();
$objModelPhotoTag = new Album_Model_PhotoTag();
$objModelSetting = new Admin_Model_GlobalSettings();
/*---------------------------------------------*/
$username = $this->_getParam('username');
$user = $this->getLeftPanel($username);
$this->view->userName = $username;
$this->view->userObject = $user;
$userRecord = $objModelUser->getDataByUsername($username);
$user_id = $userRecord->getId();
$this->view->user_id = $user_id;
$userNs = new Zend_Session_Namespace('members');
$this->view->loggedInUserId = $userNs->userId;
/*------------- GET ALBUM -------------*/
$pageSize = $objModelSetting->settingValue('album_public_page_size');
$whereAlbum = "user_id='{$user_id}' AND status='1'";
$orderAlbum = "addedon DESC";
$offsetAlbum = 0;
$arrAlbum = $objModelAlbum->fetchAll($whereAlbum, $orderAlbum, $pageSize, $offsetAlbum);
$this->view->arrAlbum = $arrAlbum;
$this->view->countAlbum = count($arrAlbum);
/*------------------------ GET NEXT ALBUM DETAIL -------------------------------*/
$nextOffsetAlbum = $offsetAlbum + $pageSize;
$nextPageSize = 1;
$arrNextalbum = $objModelAlbum->fetchAll($whereAlbum, $orderAlbum, $nextPageSize, $nextOffsetAlbum);
$this->view->nextAlbumCount = count($arrNextalbum);
$this->view->nextOffsetAlbum = $nextOffsetAlbum;
}
示例3: taggedPhotoAction
public function taggedPhotoAction()
{
$photoId = $this->_getParam('id');
$objModelUser = new Application_Model_User();
/*---------------------------------------------*/
$username = $this->_getParam('username');
$user = $this->getLeftPanel($username);
$this->view->userName = $username;
$this->view->userObject = $user;
$userRecord = $objModelUser->getDataByUsername($username);
$userId = $userRecord->getId();
$userNs = new Zend_Session_Namespace('members');
$this->view->loggedInUserId = $loggedInUserId = $userNs->userId;
$this->view->userFullName = $username;
$this->view->userId = $userId;
/*-------------------------------------------------*/
$this->getTaggesPhotoInfo($photoId, $userId);
}