function onEndGroupSaveForm($action)
 {
     $gps = null;
     if (!empty($action->group)) {
         $gps = Group_privacy_settings::staticGet('group_id', $action->group->id);
     }
     $orig = null;
     if (empty($gps)) {
         $gps = new Group_privacy_settings();
         $gps->group_id = $action->group->id;
     } else {
         $orig = clone $gps;
     }
     $gps->allow_privacy = $action->trimmed('allow_privacy');
     $gps->allow_sender = $action->trimmed('allow_sender');
     if (empty($orig)) {
         $gps->created = common_sql_now();
         $gps->insert();
     } else {
         $gps->update($orig);
     }
     return true;
 }
 function onEndGroupSaveForm(Action $action)
 {
     // The Action class must contain this method
     assert(is_callable(array($action, 'getGroup')));
     $gps = null;
     if ($action->getGroup() instanceof User_group) {
         $gps = Group_privacy_settings::getKV('group_id', $action->getGroup()->id);
     }
     $orig = null;
     if (empty($gps)) {
         $gps = new Group_privacy_settings();
         $gps->group_id = $action->getGroup()->id;
     } else {
         $orig = clone $gps;
     }
     $gps->allow_privacy = $action->trimmed('allow_privacy');
     $gps->allow_sender = $action->trimmed('allow_sender');
     if (empty($orig)) {
         $gps->created = common_sql_now();
         $gps->insert();
     } else {
         $gps->update($orig);
     }
     return true;
 }