summaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
Diffstat (limited to 'classes')
-rw-r--r--classes/Notice.php30
1 files changed, 30 insertions, 0 deletions
diff --git a/classes/Notice.php b/classes/Notice.php
index 02526bae2..ef8f7046e 100644
--- a/classes/Notice.php
+++ b/classes/Notice.php
@@ -75,4 +75,34 @@ class Notice extends DB_DataObject
}
return true;
}
+
+ static function saveNew($profile_id, $content, $source=NULL, $is_local=1) {
+
+ $notice = new Notice();
+ $notice->profile_id = $profile_id;
+ $notice->is_local = $is_local;
+ $notice->created = DB_DataObject_Cast::dateTime();
+ # Default theme uses 'content' for something else
+ $notice->content = $content;
+
+ $notice->rendered = common_render_content($notice->content, $notice);
+
+ $id = $notice->insert();
+
+ if (!$id) {
+ return _('Problem saving notice.');
+ }
+
+ $orig = clone($notice);
+ $notice->uri = common_notice_uri($notice);
+
+ if (!$notice->update($orig)) {
+ return _('Problem saving notice.');
+ }
+
+ common_save_replies($notice);
+ $notice->saveTags();
+
+ return $notice;
+ }
}