Example #1
0
    $values['future_access'] = $values['access_id'];
    $values['access_id'] = ACCESS_PRIVATE;
}
// assign values to the entity, stopping on error.
if (!$error) {
    foreach ($values as $name => $value) {
        $blog->{$name} = $value;
    }
}
// only try to save base entity if no errors
if (!$error) {
    if ($blog->save()) {
        // handle icon upload
        if (get_input('remove_icon') == 'yes') {
            // remove existing icons
            $blog->deleteIcon();
        } else {
            $blog->saveIconFromUploadedFile('icon');
        }
        // remove sticky form entries
        elgg_clear_sticky_form('blog');
        // remove autosave draft if exists
        $blog->deleteAnnotations('blog_auto_save');
        // no longer a brand new post.
        $blog->deleteMetadata('new_post');
        // if this was an edit, create a revision annotation
        if (!$new_post && $revision_text) {
            $blog->annotate('blog_revision', $revision_text);
        }
        system_message(elgg_echo('blog:message:saved'));
        $status = $blog->status;