]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
create privacy settings on new group
authorEvan Prodromou <evan@status.net>
Thu, 27 Jan 2011 01:48:13 +0000 (18:48 -0700)
committerEvan Prodromou <evan@status.net>
Thu, 27 Jan 2011 01:48:13 +0000 (18:48 -0700)
plugins/PrivateGroup/PrivateGroupPlugin.php

index 0ae1247bee396211f5aba9dd4783af4798386fe1..9851313ff40955568241caad9c7a089459c26141 100644 (file)
@@ -202,6 +202,31 @@ class PrivateGroupPlugin extends Plugin
         return true;
     }
 
+    /**
+     * Create default group privacy settings at group create time
+     *
+     * @param $group Group that was just created
+     *
+     * @result boolean hook value
+     */
+
+    function onEndGroupSave($group)
+    {
+        $gps = new Group_privacy_settings();
+
+        $gps->group_id      = $group->id;
+        $gps->allow_privacy = Group_privacy_settings::SOMETIMES;
+        $gps->allow_sender  = Group_privacy_settings::MEMBER;
+        $gps->created       = common_sql_now();
+        $gps->modified      = $gps->created;
+
+        // This will throw an exception on error
+
+        $gps->insert();
+
+        return true;
+    }
+
     function onPluginVersion(&$versions)
     {
         $versions[] = array('name' => 'PrivateGroup',