Advertisement
BakerMan

Change Community Events Thankyou

Oct 5th, 2012
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.89 KB | None | 0 0
  1. /**
  2.  * This is filters the array of "errors" processed in
  3.  * TribeCommunityEvents::outputMessage().
  4.  *
  5.  * Place this and the matching
  6.  * add_filter() call in your theme functions.php file to quickly replace the
  7.  * "Event submitted" text that is displayed by default when an event is
  8.  * successfully submitted.
  9.  *
  10.  * @param $messages
  11.  * @return array
  12.  */
  13. function replaceCommunitySubmitThankyou($messages) {
  14.     $message = (array) $messages;
  15.  
  16.     $lookfor = 'Event submitted. ';
  17.     $replaceWith = 'You guys rock! '; // Change this to whatever you think appropriate
  18.  
  19.     foreach ($messages as &$message)
  20.         if (strpos($message['message'], $lookfor) !== false)
  21.             $message['message'] = str_replace($lookfor, $replaceWith, $message['message']);
  22.  
  23.     return $messages;
  24. }
  25.  
  26. // Filter the "error" messages upon form submission
  27. add_filter('tribe_community_events_form_errors', 'replaceCommunitySubmitThankyou');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement