Created
January 18, 2017 07:04
-
-
Save dsk52/524668a7931353bf05690eab1b631d37 to your computer and use it in GitHub Desktop.
concrete5で特定のページタイプで著者情報の表示
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* ページの投稿者(所有者)名の取得と表示する | |
*/ | |
$pageType = $c->getCollectionTypeHandle(); | |
$cp = new Permissions($c); | |
if ($pageType == 'blog') { | |
$vo = $c->getVersionObject(); | |
if (is_object($vo)) { | |
$uID = $vo->getVersionAuthorUserID(); | |
$ui = UserInfo::getByID($uID); | |
if (is_object($ui) && $ui) { // ページタイプ編集時のエラー回避 | |
$postedUserName = $ui->getAttribute('user_name'); | |
} | |
} | |
?> | |
<p class="p-article__writer">WRITTEN BY:<? if (isset($postedUserName) && $postedUserName) { echo $postedUserName; } ?></p> | |
<?php | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment