Вывод в блоге только опубликованных статей
This commit is contained in:
parent
0be5e530ed
commit
e1c4610713
|
|
@ -33,8 +33,11 @@ class UserController extends Controller
|
|||
self::addStyle('/css/bootstrap-theme.min.css');
|
||||
self::addStyle('http://cdnjs.cloudflare.com/ajax/libs/fotorama/4.6.3/fotorama.css');
|
||||
|
||||
|
||||
$articles = Article::model()->getAll(array('where'=>'`author`='.(int)$user->id));
|
||||
if (App::$user && App::$user->id == $id) {
|
||||
$articles = Article::model()->getAll(array('where'=>'`author`='.(int)$user->id));
|
||||
} else {
|
||||
$articles = Article::model()->getAll(array('where'=>'`author`='.(int)$user->id . ' AND `status` = "published" '));
|
||||
}
|
||||
|
||||
$randomPoint = Point::model()->getRandom();
|
||||
$randomPoint->description = mb_substr($randomPoint->description, 0, 400, 'UTF-8');
|
||||
|
|
@ -43,6 +46,7 @@ class UserController extends Controller
|
|||
self::render('user/index.php', array(
|
||||
'user' => $user,
|
||||
'articles' => $articles,
|
||||
'imAuthor' => App::$user && App::$user->id == $id,
|
||||
'randomPoint' => $randomPoint,
|
||||
));
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue