SHARE
TWEET

Change Pro manual booking user dropdown to show usernames

eventsmanager Oct 9th, 2016 (edited) 310 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. /*
  3. This snippet changes the dropdown for selecting a user for adding a booking manually to show usernames instead of their full name.
  4.  
  5. for more information on adding this snippet to your site, see here
  6. http://wp-events-plugin.com/tutorials/how-to-safely-add-php-code-to-wordpress/
  7. */
  8. function my_em_mod_change_manual_booking_userddm(){
  9.     add_filter('em_locate_template', function( $located, $template_name ){
  10.         if( $template_name == 'placeholders/bookingform.php'){
  11.             remove_action('em_booking_form_custom', array(EM_Gateways::get_gateway('offline'),'em_booking_form_custom'), 1);
  12.             add_action('em_booking_form_custom', 'my_offline_em_booking_form_custom', 1);
  13.         }
  14.         return $located;
  15.     }, 10, 2);
  16. }
  17. add_action('em_bookings_manual_booking', 'my_em_mod_change_manual_booking_userddm', 1);
  18.  
  19. function my_offline_em_booking_form_custom(){
  20.     ?>
  21.     <p>
  22.         <?php
  23.             $person_id = (!empty($_REQUEST['person_id'])) ? $_REQUEST['person_id'] : false;
  24.             wp_dropdown_users ( array ('name' => 'person_id', 'show' => 'user_login', 'show_option_none' => __ ( "Selectxxx a user, or enter a new one below.", 'em-pro' ), 'selected' => $person_id  ) );
  25.         ?>
  26.     </p>
  27.     <?php
  28. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top