SHOW:
|
|
- or go back to the newest paste.
| 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; |
| 14 | + | $messages = (array) $messages; |
| 15 | ||
| 16 | - | $lookfor = 'Event submitted. '; |
| 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) |
| 20 | + | if (strpos($message['message'], $lookFor) !== false) |
| 21 | - | $message['message'] = str_replace($lookfor, $replaceWith, $message['message']); |
| 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'); |