aboutsummaryrefslogtreecommitdiff
path: root/mod/blog/actions
diff options
context:
space:
mode:
Diffstat (limited to 'mod/blog/actions')
-rw-r--r--mod/blog/actions/blog/save.php10
1 files changed, 9 insertions, 1 deletions
diff --git a/mod/blog/actions/blog/save.php b/mod/blog/actions/blog/save.php
index 0720d6163..8be67ec6c 100644
--- a/mod/blog/actions/blog/save.php
+++ b/mod/blog/actions/blog/save.php
@@ -8,6 +8,9 @@
// start a new sticky form session in case of failure
elgg_make_sticky_form('blog');
+// save or preview
+$save = (bool)get_input('save');
+
// store errors to pass along
$error = FALSE;
$error_forward_url = REFERER;
@@ -106,6 +109,11 @@ foreach ($values as $name => $default) {
}
}
+// if preview, force status to be draft
+if ($save == false) {
+ $values['status'] = 'draft';
+}
+
// assign values to the entity, stopping on error.
if (!$error) {
foreach ($values as $name => $value) {
@@ -154,7 +162,7 @@ if (!$error) {
));
}
- if ($blog->status == 'published') {
+ if ($blog->status == 'published' || $save == false) {
forward($blog->getURL());
} else {
forward("blog/edit/$blog->guid");