Exemplo n.º 1
0
 /**
  * Add a checkbox to turn off email summaries
  * 
  * @param Action $action Action being executed (emailsettings)
  * 
  * @return boolean hook value
  */
 function onEndEmailSaveForm($action)
 {
     $sendSummary = $action->boolean('emailsummary');
     $user = common_current_user();
     if (!empty($user)) {
         $ess = Email_summary_status::staticGet('user_id', $user->id);
         if (empty($ess)) {
             $ess = new Email_summary_status();
             $ess->user_id = $user->id;
             $ess->send_summary = $sendSummary;
             $ess->created = common_sql_now();
             $ess->modified = common_sql_now();
             $ess->insert();
         } else {
             $orig = clone $ess;
             $ess->send_summary = $sendSummary;
             $ess->modified = common_sql_now();
             $ess->update($orig);
         }
     }
     return true;
 }
Exemplo n.º 2
0
 /**
  * Save checkbox value for following everyone
  *
  * @param Action $action The action being executed
  *
  * @return boolean hook value
  */
 function onEndProfileSaveForm($action)
 {
     $user = common_current_user();
     User_followeveryone_prefs::savePref($user->id, $action->boolean('followeveryone'));
     return true;
 }
 /**
  * Add a checkbox to turn off email summaries
  *
  * @param Action $action Action being executed (emailsettings)
  * @param Profile $scoped Profile for whom settings are configured (current user)
  *
  * @return boolean hook value
  */
 public function onEndEmailSaveForm(Action $action, Profile $scoped)
 {
     $sendSummary = $action->boolean('emailsummary');
     $ess = Email_summary_status::getKV('user_id', $scoped->id);
     if (empty($ess)) {
         $ess = new Email_summary_status();
         $ess->user_id = $scoped->id;
         $ess->send_summary = $sendSummary;
         $ess->created = common_sql_now();
         $ess->modified = common_sql_now();
         $ess->insert();
     } else {
         $orig = clone $ess;
         $ess->send_summary = $sendSummary;
         $ess->modified = common_sql_now();
         $ess->update($orig);
     }
     return true;
 }