本文整理汇总了PHP中Model_User::find_by_id方法的典型用法代码示例。如果您正苦于以下问题:PHP Model_User::find_by_id方法的具体用法?PHP Model_User::find_by_id怎么用?PHP Model_User::find_by_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Model_User
的用法示例。
在下文中一共展示了Model_User::find_by_id方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: author
/**
* 返回帖子创建泽
*
* @return Model_User
*/
public function author()
{
if (is_null($this->_author)) {
$this->_author = Model_User::find_by_id($this->author_id);
}
return $this->_author;
}
示例2: before
public function before()
{
parent::before();
$this->template->logged_in = Tweet::instance()->logged_in();
if ($this->template->logged_in)
{
$this->template->user = Model_User::find_by_id(Session::get('user_id'));
}
}
示例3: action_del
public function action_del()
{
// ban it forever, just mark it
$user_id = $this->request->param('id', null);
$user = Model_User::find_by_id($user_id);
$user->defunct = Model_User::DEFUNCT_YES;
$user->save();
//TODO: use ajax
$this->action_index();
}
示例4: action_send
public function action_send()
{
if ($this->request->is_post()) {
$user_id = $this->get_post('receiver', null);
$receiver = Model_User::find_by_id($user_id);
if ($receiver) {
$title = $this->get_post('title', 'no title');
$content = $this->get_raw_post('content', 'no content');
$mail = new Model_Mail();
$mail->from_user = $this->current_user->user_id;
$mail->to_user = $receiver->user_id;
$mail->content = $content;
$mail->title = $title;
$mail->save();
$this->redirect('/mail/outbox');
} else {
$message = __('common.:user_not_found', array(':user' => $user_id));
throw new Exception_Page($message);
}
}
}
示例5:
<li class="<?php
echo Uri::segment(2) == $section_segment ? 'active' : '';
?>
">
<?php
echo Html::anchor('site/' . $section_segment, $section_title);
?>
</li>
<?php
}
?>
</ul>
<ul class="nav navbar-nav pull-right">
<li class="dropdown">
<a data-toggle="dropdown" class="dropdown-toggle" href="#"><?php
echo Model_User::find_by_id($current_user->id)->fullname;
?>
<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><?php
echo Html::anchor('site/users/view/' . $current_user->id, 'My Profile');
?>
</li>
<li><?php
echo Html::anchor('site/logout', 'Logout');
?>
</li>
</ul>
</li>
</ul>
</div>
示例6: allow_view_code
/**
* @param Model_User|string $user
*
* @return bool
*/
public function allow_view_code($user)
{
if (is_string($user)) {
$user = Model_User::find_by_id($user);
}
// if ( $user->user_id == $this->user_id ) return true;
if ($user->can_view_code($this)) {
return true;
}
return false;
}
示例7: get_user_types
public static function get_user_types($user = null)
{
$userTypes = [];
if (!$user) {
$user = Model_User::find_by_id(Auth::get('id'));
}
foreach (Config::get('simpleauth')['groups'] as $userIdx => $userType) {
if ($userIdx <= $user->group) {
$userTypes[$userIdx] = $userType['name'];
}
}
return $userTypes;
}