aboutsummaryrefslogtreecommitdiff
path: root/mod/blog/start.php
diff options
context:
space:
mode:
Diffstat (limited to 'mod/blog/start.php')
-rw-r--r--mod/blog/start.php54
1 files changed, 35 insertions, 19 deletions
diff --git a/mod/blog/start.php b/mod/blog/start.php
index fa57e7b96..eb4e11086 100644
--- a/mod/blog/start.php
+++ b/mod/blog/start.php
@@ -125,6 +125,7 @@ function blog_page_handler($page) {
$params = blog_get_page_content_archive($user->guid, $page[2], $page[3]);
break;
case 'view':
+ case 'read': // Elgg 1.7 compatibility
$params = blog_get_page_content_read($page[1]);
break;
case 'add':
@@ -136,7 +137,11 @@ function blog_page_handler($page) {
$params = blog_get_page_content_edit($page_type, $page[1], $page[2]);
break;
case 'group':
- $params = blog_get_page_content_list($page[1]);
+ if ($page[2] == 'all') {
+ $params = blog_get_page_content_list($page[1]);
+ } else {
+ $params = blog_get_page_content_archive($page[1], $page[3], $page[4]);
+ }
break;
case 'all':
$params = blog_get_page_content_list();
@@ -222,6 +227,34 @@ function blog_entity_menu_setup($hook, $type, $return, $params) {
}
/**
+ * Set the notification message body
+ *
+ * @param string $hook Hook name
+ * @param string $type Hook type
+ * @param string $message The current message body
+ * @param array $params Parameters about the blog posted
+ * @return string
+ */
+function blog_notify_message($hook, $type, $message, $params) {
+ $entity = $params['entity'];
+ $to_entity = $params['to_entity'];
+ $method = $params['method'];
+ if (elgg_instanceof($entity, 'object', 'blog')) {
+ $descr = $entity->description;
+ $title = $entity->title;
+ if ($method == 'email') {
+ $owner = $entity->getOwnerEntity();
+ return $owner->name . ' ' . elgg_echo('blog:via') . ': ' . $title . "\n\n" . $descr . "\n\n" . $entity->getURL();
+ }
+ if ($method == 'web') {
+ $owner = $entity->getOwnerEntity();
+ return $owner->name . ' ' . elgg_echo('blog:via') . ': ' . $title . "\n\n" . $descr . "\n\n" . $entity->getURL();
+ }
+ }
+ return null;
+}
+
+/**
* Register blogs with ECML.
*/
function blog_ecml_views_hook($hook, $entity_type, $return_value, $params) {
@@ -234,7 +267,7 @@ function blog_ecml_views_hook($hook, $entity_type, $return_value, $params) {
* Upgrade from 1.7 to 1.8.
*/
function blog_run_upgrades($event, $type, $details) {
- $blog_upgrade_version = get_plugin_setting('upgrade_version', 'blogs');
+ $blog_upgrade_version = elgg_get_plugin_setting('upgrade_version', 'blogs');
if (!$blog_upgrade_version) {
// When upgrading, check if the ElggBlog class has been registered as this
@@ -243,23 +276,6 @@ function blog_run_upgrades($event, $type, $details) {
add_subtype('object', 'blog', 'ElggBlog');
}
- // only run this on the first migration to 1.8
- // add excerpt to all blogs that don't have it.
- $ia = elgg_set_ignore_access(true);
- $options = array(
- 'type' => 'object',
- 'subtype' => 'blog'
- );
-
- $blogs = new ElggBatch('elgg_get_entities', $options);
- foreach ($blogs as $blog) {
- if (!$blog->excerpt) {
- $blog->excerpt = elgg_get_excerpt($blog->description);
- }
- }
-
- elgg_set_ignore_access($ia);
-
elgg_set_plugin_setting('upgrade_version', 1, 'blogs');
}
}