summaryrefslogtreecommitdiff
path: root/plugins/UserFlag/User_flag_profile.php
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2009-12-28 10:58:49 -0800
committerEvan Prodromou <evan@status.net>2009-12-28 10:58:49 -0800
commit6d3e6b42849ad14b15cb4c41c4f8baac45e58df0 (patch)
tree77eb93add9e83fd85493fee896944cd0d4946ac4 /plugins/UserFlag/User_flag_profile.php
parent2ae04bb6d598c74763aca79ab52172934158be46 (diff)
move flag creation to a method of data object
Diffstat (limited to 'plugins/UserFlag/User_flag_profile.php')
-rw-r--r--plugins/UserFlag/User_flag_profile.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/plugins/UserFlag/User_flag_profile.php b/plugins/UserFlag/User_flag_profile.php
index b8f3f3fe1..658259452 100644
--- a/plugins/UserFlag/User_flag_profile.php
+++ b/plugins/UserFlag/User_flag_profile.php
@@ -118,4 +118,23 @@ class User_flag_profile extends Memcached_DataObject
return !empty($ufp);
}
+
+ static function create($user_id, $profile_id)
+ {
+ $ufp = new User_flag_profile();
+
+ $ufp->profile_id = $profile_id;
+ $ufp->user_id = $user_id;
+ $ufp->created = common_sql_now();
+
+ if (!$ufp->insert()) {
+ $msg = sprintf(_("Couldn't flag profile '%d' for review."),
+ $profile_id);
+ throw new ServerException($msg);
+ }
+
+ $ufp->free();
+
+ return true;
+ }
}