chrishajer

Disable notification during certain hours

Jun 26th, 2012
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.60 KB | None | 0 0
  1. <?php
  2. // http://www.gravityhelp.com/forums/topic/user-notification-during-specific-hours#post-61964
  3. // change 81 here to the form for which you want to disable notifications
  4. add_filter('gform_disable_user_notification_81', 'disable_user_notification', 10, 3);
  5. function disable_user_notification($is_disabled, $form, $entry){
  6.         // the hour of the day now, 24 hour format
  7.         $hour = date('G');
  8.         // if the hour is 10 or after, AND 21 or before, then disable the notification
  9.         if ($hour >= 10 && $hour <= 21)
  10.                 return true;
  11.         else
  12.                 return false;
  13. }
Advertisement
Add Comment
Please, Sign In to add comment