aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcash <cash.costello@gmail.com>2011-12-23 15:20:57 -0500
committercash <cash.costello@gmail.com>2011-12-23 15:20:57 -0500
commitc0f3b8d03f260c5ab83289bdf4c7cf6a6c5aa6a6 (patch)
treed408643823a0a1372765c7ff79ff69061248a1bb
parent23a912aa6678bb16f866b01c175b8e73e7bf417d (diff)
downloadelgg-c0f3b8d03f260c5ab83289bdf4c7cf6a6c5aa6a6.tar.gz
elgg-c0f3b8d03f260c5ab83289bdf4c7cf6a6c5aa6a6.tar.bz2
Fixes #4179 not setting excerpt if none set
-rw-r--r--mod/blog/actions/blog/save.php6
-rw-r--r--mod/blog/start.php20
-rw-r--r--mod/blog/views/default/object/blog.php3
3 files changed, 5 insertions, 24 deletions
diff --git a/mod/blog/actions/blog/save.php b/mod/blog/actions/blog/save.php
index 8ca8ce846..8923cd0d2 100644
--- a/mod/blog/actions/blog/save.php
+++ b/mod/blog/actions/blog/save.php
@@ -78,11 +78,8 @@ foreach ($values as $name => $default) {
case 'excerpt':
if ($value) {
- $value = elgg_get_excerpt($value);
- } else {
- $value = elgg_get_excerpt($values['description']);
+ $values[$name] = elgg_get_excerpt($value);
}
- $values[$name] = $value;
break;
case 'container_guid':
@@ -144,7 +141,6 @@ if (!$error) {
system_message(elgg_echo('blog:message:saved'));
$status = $blog->status;
- $db_prefix = elgg_get_config('dbprefix');
// add to river if changing status or published, regardless of new post
// because we remove it for drafts.
diff --git a/mod/blog/start.php b/mod/blog/start.php
index 4b825fc1f..53a4dcadf 100644
--- a/mod/blog/start.php
+++ b/mod/blog/start.php
@@ -234,7 +234,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,24 +243,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',
- 'limit' => 0,
- );
-
- $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');
}
}
diff --git a/mod/blog/views/default/object/blog.php b/mod/blog/views/default/object/blog.php
index 3525b3d48..aa8074a69 100644
--- a/mod/blog/views/default/object/blog.php
+++ b/mod/blog/views/default/object/blog.php
@@ -16,6 +16,9 @@ $owner = $blog->getOwnerEntity();
$container = $blog->getContainerEntity();
$categories = elgg_view('output/categories', $vars);
$excerpt = $blog->excerpt;
+if (!$excerpt) {
+ $excerpt = elgg_get_excerpt($blog->description);
+}
$owner_icon = elgg_view_entity_icon($owner, 'tiny');
$owner_link = elgg_view('output/url', array(