From 1a96a5e695e76f4a7e91ffe10e5ca0b5ccbfccaf Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 26 Jan 2011 18:48:13 -0700 Subject: [PATCH] create privacy settings on new group --- plugins/PrivateGroup/PrivateGroupPlugin.php | 25 +++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/plugins/PrivateGroup/PrivateGroupPlugin.php b/plugins/PrivateGroup/PrivateGroupPlugin.php index 0ae1247bee..9851313ff4 100644 --- a/plugins/PrivateGroup/PrivateGroupPlugin.php +++ b/plugins/PrivateGroup/PrivateGroupPlugin.php @@ -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', -- 2.39.5