*/
function blog_get_page_content_read($owner_guid = NULL, $guid = NULL) {
global $CONFIG;
-
+
if ($guid) {
$blog = get_entity($guid);
} else {
elgg_push_breadcrumb($blog->title, $blog->getURL());
$content = elgg_view_entity($blog, TRUE);
+ $content .= elgg_view_comments($blog);
}
} else {
$content = elgg_view('page_elements/content_header', array(
'type' => 'blog',
'all_link' => "{$CONFIG->site->url}pg/blog"
));
-
+
$options = array(
'type' => 'object',
'subtype' => 'blog',
$loggedin_userid = get_loggedin_userid();
if ($owner_guid) {
$options['owner_guid'] = $owner_guid;
-
+
if ($owner_guid != $loggedin_userid) {
// do not show content header when viewing other users' posts
$content = elgg_view('page_elements/content_header_member', array('type' => 'blog'));
*/
function blog_get_page_content_archive($owner_guid, $lower=0, $upper=0) {
global $CONFIG;
-
+
$now = time();
elgg_push_breadcrumb(elgg_echo('blog:archives'));
*/
function blog_get_page_content_friends($user_guid) {
global $CONFIG;
-
+
elgg_push_breadcrumb(elgg_echo('friends'));
-
+
$content = elgg_view('page_elements/content_header', array(
'context' => 'friends',
'type' => 'blog',
'all_link' => "{$CONFIG->site->url}pg/blog"
));
-
+
if (!$friends = get_user_friends($user_guid, ELGG_ENTITIES_ANY_VALUE, 0)) {
$content .= elgg_echo('friends:none:you');
} else {
'full_view' => FALSE,
'order_by_metadata' => array('name'=>'publish_date', 'direction'=>'DESC', 'as'=>'int'),
);
-
+
foreach ($friends as $friend) {
$options['container_guids'][] = $friend->getGUID();
}
-
+
// admin / owners can see any posts
// everyone else can only see published posts
if (!(isadminloggedin() || (isloggedin() && $owner_guid == get_loggedin_userid()))) {
array('name' => 'status', 'value' => 'published')
);
}
-
+
$list = elgg_list_entities_from_metadata($options);
if (!$list) {
$content .= elgg_echo('blog:none');
$content .= $list;
}
}
-
+
return array('content' => $content);
}
function blog_make_excerpt($text, $words=60) {
$text = strip_tags($text);
preg_match("/([\S]+\s*){0,$words}/", $text, $matches);
-
+
$trimmed = trim($matches[0]);
if ($trimmed != $text) {
return "$trimmed …";
}
-
+
return $trimmed;
}