本文整理汇总了PHP中UserModel::getPublicProfileOfUser方法的典型用法代码示例。如果您正苦于以下问题:PHP UserModel::getPublicProfileOfUser方法的具体用法?PHP UserModel::getPublicProfileOfUser怎么用?PHP UserModel::getPublicProfileOfUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserModel
的用法示例。
在下文中一共展示了UserModel::getPublicProfileOfUser方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showProfile
/**
* This method controls what happens when you move to /overview/showProfile in your app.
* Shows the (public) details of the selected user.
* @param $user_id int id the the user
*/
public function showProfile($user_id)
{
if (isset($user_id)) {
$this->View->render('profile/showProfile', array('user' => UserModel::getPublicProfileOfUser($user_id)));
} else {
Redirect::home();
}
}
示例2: saveRoleToDatabase
/**
* Writes the new account type marker to the database and to the session
*
* @param $type
*
* @return bool
*/
public static function saveRoleToDatabase($type)
{
// if $type is not 1 or 2
if (!in_array($type, [1, 2])) {
return false;
}
$user = UserModel::getPublicProfileOfUser(Session::get('user_id'));
$user->setUserAccountType($type);
$user->save();
if ($user) {
Session::set('user_account_type', $type);
return true;
}
return false;
}
示例3: setRememberMeInDatabaseAndCookie
/**
* Write remember-me token into database and into cookie
* Maybe splitting this into database and cookie part ?
*
* @param $user_id
*/
public static function setRememberMeInDatabaseAndCookie($user_id)
{
// generate 64 char random string
$random_token_string = hash('sha256', mt_rand());
// write that token into database
$user = UserModel::getPublicProfileOfUser($user_id);
$user->setUserRememberMeToken($random_token_string);
$user->save();
// generate cookie string that consists of user id, random string and combined hash of both
$cookie_string_first_part = $user_id . ':' . $random_token_string;
$cookie_string_hash = hash('sha256', $cookie_string_first_part);
$cookie_string = $cookie_string_first_part . ':' . $cookie_string_hash;
// set cookie
setcookie('remember_me', $cookie_string, time() + Config::get('COOKIE_RUNTIME'), Config::get('COOKIE_PATH'));
}
示例4: foreach
</tr>
</thead>
<tbody>
<?php
foreach ($res as $note) {
?>
<tr>
<td><?php
echo $note->note_id;
?>
</td>
<td><a href="<?php
echo Config::get('URL') . "profile/showProfile/" . $note->user_id;
?>
"><?php
echo UserModel::getPublicProfileOfUser($note->user_id)->user_name;
?>
</a></td>
<td><?php
echo htmlentities($note->note_text);
?>
</td>
<td><a href="<?php
echo Config::get('URL') . 'note/delete/' . $note->note_id;
?>
">Delete</a></td>
</tr>
<?php
}
?>
</tbody>
示例5:
<tr>
<td><?php
echo $class->class_id;
?>
</td>
<td><?php
echo $class->class_name;
?>
</td>
<td><?php
echo $class->num_paragraphs;
?>
</td>
<td><?php
echo $class->class_key;
?>
</td>
<td><?php
echo UserModel::getPublicProfileOfUser($class->instructor_id)->user_name;
?>
</td>
</tr>
<?php
}
?>
</table>
<input type="submit">
</form>
</div>
</div>