WordPress.org

Plugin Directory

Changeset 686595


Ignore:
Timestamp:
03/24/13 12:14:56 (13 months ago)
Author:
liedekef
Message:

you can now send mails to all attendees for an event in the admin backend

Location:
events-made-easy/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • events-made-easy/trunk/eme_rsvp.php

    r684967 r686595  
    783783} 
    784784 
    785 function eme_get_attendees_list_for($event_id) { 
     785function eme_get_attendees_for($event_id) { 
    786786   global $wpdb;  
    787787   $bookings_table = $wpdb->prefix.BOOKINGS_TBNAME; 
     
    790790   if ($person_ids) { 
    791791      $attendees = eme_get_persons($person_ids); 
     792   } else { 
     793      $attendees= array(); 
     794   } 
     795   return $attendees; 
     796} 
     797 
     798function eme_get_attendees_list_for($event_id) { 
     799   $attendees = eme_get_attendees_for($event_id); 
     800   if ($attendees) { 
    792801      $res="<ul class='eme_bookings_list_ul'>"; 
    793802      foreach ($attendees as $attendee) { 
     
    896905      $replacement=''; 
    897906      $found = 1; 
    898       if (preg_match('/#_(NAME|PHONE|ID|EMAIL)$/', $result)) { 
    899          $field = preg_replace("/#_/","",$result); 
     907      if (preg_match('/#_(ATTEND)?(NAME|PHONE|ID|EMAIL)$/', $result)) { 
     908         $field = preg_replace("/#_ATTEND|#_/","",$result); 
    900909         $field = "person_".strtolower($field); 
    901910         $replacement = $attendee[$field]; 
     
    13901399   </form> 
    13911400</div> 
     1401 
    13921402<?php 
     1403} 
     1404 
     1405function eme_send_mails_page() { 
     1406   global $wpdb; 
     1407 
     1408   $event_id = isset($_POST ['event_id']) ? intval($_POST ['event_id']) : 0; 
     1409   $action = isset($_POST ['action']) ? $_POST ['action'] : ''; 
     1410   $message = isset($_POST ['message']) ? $_POST ['message'] : ''; 
     1411   $subject = isset($_POST ['subject']) ? $_POST ['subject'] : ''; 
     1412 
     1413   if ($event_id>0 && $action == 'send_mail') { 
     1414       if (empty($subject) || empty($message)) { 
     1415           print "<div id='message' class='error'><p>".__('Please enter both subject and message for the mail to be sent.','eme')."</p></div>"; 
     1416       } else { 
     1417           $event = eme_get_event($event_id); 
     1418           $current_userid=get_current_user_id(); 
     1419           if (current_user_can( get_option('eme_cap_send_other_mails')) || 
     1420                   (current_user_can( get_option('eme_cap_send_mails')) && ($event['event_author']==$current_userid || $event['event_contactperson_id']==$current_userid))) {   
     1421 
     1422               $event_name = $event['event_name']; 
     1423               $contact = eme_get_contact ($event); 
     1424               $contact_email = $contact->user_email; 
     1425               $contact_name = $contact->display_name; 
     1426 
     1427               $message = eme_replace_placeholders($message, $event, "text"); 
     1428               $subject = eme_replace_placeholders($subject, $event, "text"); 
     1429 
     1430               $attendees = eme_get_attendees_for($event_id); 
     1431               foreach ( $attendees as $attendee ) { 
     1432                   $message = eme_replace_attendees_placeholders($message, $attendee, "text"); 
     1433                   $message = eme_translate($message); 
     1434                   $subject = eme_replace_attendees_placeholders($subject, $attendee, "text"); 
     1435                   $subject = eme_translate($subject); 
     1436                   eme_send_mail($subject,$message, $attendee['person_email'], $attendee['person_name'], $contact_email, $contact_name); 
     1437               } 
     1438               print "<div id='message' class='updated'><p>".__('The mail has been sent.','eme')."</p></div>"; 
     1439           } else { 
     1440               print "<div id='message' class='error'><p>".__('You do not have the permission to send mails for this event.','eme')."</p></div>"; 
     1441           } 
     1442       } 
     1443   } 
     1444 
     1445   // now show the form 
     1446   eme_send_mail_form($event_id); 
     1447} 
     1448 
     1449function eme_send_mail_form($event_id=0) { 
     1450?> 
     1451<div class="wrap"> 
     1452<div id="icon-events" class="icon32"><br /> 
     1453</div> 
     1454<h2><?php _e ('Send Mails to all attendees for a event','eme'); ?></h2> 
     1455<?php admin_show_warnings();?> 
     1456   <div id='message' class='updated'><p> 
     1457<?php 
     1458      _e('Warning: using this functionality to send mails to attendees can result in a php timeout, so not everybody will receive the mail then. This depends on the number of attendees, the load on the server, ... . If this happens, use the CSV export link to get the list of all attendees and use mass mailing tools (like OpenOffice) for your mailing.','eme'); 
     1459?> 
     1460   </p></div> 
     1461   <form id='send-mail' name='send-mail' action="" method="post"> 
     1462   <input type='hidden' name='page' value='eme-send-mails' /> 
     1463   <input type='hidden' name='action' value='send_mail' /> 
     1464   <select name="event_id" onchange="this.form.submit()"> 
     1465   <?php 
     1466   $all_events=eme_get_events(0,"future"); 
     1467   $events_with_pending_bookings=array(); 
     1468   $event_id = isset($_POST ['event_id']) ? intval($_POST ['event_id']) : 0; 
     1469   $current_userid=get_current_user_id(); 
     1470   echo "<option value='0' >".__('Select the event','eme')."</option>  "; 
     1471   foreach ( $all_events as $event ) { 
     1472         $option_text=$event['event_name']." (".eme_localised_date($event['event_start_date']).")"; 
     1473     if (current_user_can( get_option('eme_cap_send_other_mails')) || 
     1474             (current_user_can( get_option('eme_cap_send_mails')) && ($event['event_author']==$current_userid || $event['event_contactperson_id']==$current_userid))) {   
     1475         if ($event['event_id'] == $event_id) { 
     1476             echo "<option selected='selected' value='".$event['event_id']."' >".$option_text."</option>  "; 
     1477         } else { 
     1478             echo "<option value='".$event['event_id']."' >".$option_text."</option>  "; 
     1479         } 
     1480     } 
     1481   } 
     1482   ?> 
     1483   </select> 
     1484   <p> 
     1485   <?php if ($event_id>0) {?> 
     1486       <div id="titlediv" class="form-field form-required"> 
     1487           <label><?php _e('Subject','eme'); ?></label><br> 
     1488           <input type="text" name="subject" value="" /> 
     1489       </div> 
     1490       <div id="titlediv" class="form-field form-required"> 
     1491       <label><?php _e('Message','eme'); ?></label><br> 
     1492       <textarea name="message" value="" rows=10></textarea>  
     1493       </div> 
     1494       <div id="titlediv"> 
     1495       <?php _e('You can use any placholders mentioned here:','eme'); 
     1496       print "<br><a href='http://www.e-dynamics.be/wordpress/?cat=25'>".__('Event placeholders','eme')."</a>"; 
     1497       print "<br><a href='http://www.e-dynamics.be/wordpress/?cat=48'>".__('Attendees placeholders','eme')."</a>"; 
     1498       ?> 
     1499       </div> 
     1500       <input type="submit" value="<?php _e ( 'Send Mail', 'eme' ); ?>" name="doaction2" id="doaction2" class="button-secondary action" /> 
     1501       </form> 
     1502 
     1503   <?php 
     1504       $csv_address = admin_url("/admin.php?page=eme-people&amp;action=booking_csv&amp;event_id=".$event['event_id']); 
     1505       $available_seats = eme_get_available_seats($event['event_id']); 
     1506       $total_seats = $event ['event_seats']; 
     1507       if ($total_seats!=$available_seats) 
     1508           echo "<br><br> <a id='booking_csv_".$event['event_id']."'  target='' href='$csv_address'>".__('CSV export','eme')."</a>"; 
     1509   } 
    13931510} 
    13941511 
  • events-made-easy/trunk/eme_settings.php

    r674331 r686595  
    110110   'eme_cap_cleanup' => DEFAULT_CAP_CLEANUP, 
    111111   'eme_cap_settings' => DEFAULT_CAP_SETTINGS, 
     112   'eme_cap_send_mails' => DEFAULT_CAP_SEND_MAILS, 
     113   'eme_cap_send_other_mails' => DEFAULT_CAP_SEND_OTHER_MAILS, 
    112114   'eme_event_html_headers_format' => '', 
    113115   'eme_location_html_headers_format' => '', 
     
    150152//////////////////////////////////// 
    151153function eme_options_delete() { 
    152    $options = array ('eme_version', 'eme_events_page', 'eme_display_calendar_in_events_page', 'eme_event_list_item_format_header', 'eme_event_list_item_format', 'eme_event_list_item_format_footer', 'eme_event_page_title_format', 'eme_event_html_title_format', 'eme_single_event_format', 'eme_list_events_page', 'eme_events_page_title', 'eme_no_events_message', 'eme_location_page_title_format','eme_location_html_title_format', 'eme_location_baloon_format', 'eme_single_location_format', 'eme_location_event_list_item_format', 'eme_show_period_monthly_dateformat','eme_show_period_yearly_dateformat', 'eme_location_no_events_message', 'eme_gmap_is_active', 'eme_gmap_zooming', 'eme_seo_permalink', 'eme_rss_main_title', 'eme_rss_main_description', 'eme_rss_title_format', 'eme_rss_description_format', 'eme_rss_show_pubdate', 'eme_rsvp_mail_notify_is_active', 'eme_contactperson_email_body', 'eme_contactperson_cancelled_email_body', 'eme_contactperson_pending_email_body', 'eme_respondent_email_body', 'eme_registration_recorded_ok_html', 'eme_mail_sender_name', 'eme_smtp_username', 'eme_smtp_password', 'eme_default_contact_person','eme_captcha_for_booking', 'eme_mail_sender_address', 'eme_mail_receiver_address', 'eme_smtp_host', 'eme_rsvp_mail_send_method', 'eme_rsvp_mail_port', 'eme_rsvp_mail_SMTPAuth', 'eme_rsvp_registered_users_only', 'eme_rsvp_reg_for_new_events', 'eme_rsvp_require_approval', 'eme_rsvp_default_number_spaces', 'eme_rsvp_addbooking_submit_string', 'eme_rsvp_delbooking_submit_string', 'eme_image_max_width', 'eme_image_max_height', 'eme_image_max_size', 'eme_full_calendar_event_format', 'eme_use_select_for_locations', 'eme_attributes_enabled', 'eme_recurrence_enabled','eme_rsvp_enabled','eme_categories_enabled','eme_small_calendar_event_title_format','eme_small_calendar_event_title_separator','eme_registration_pending_email_body','eme_registration_denied_email_body','eme_registration_cancelled_email_body','eme_attendees_list_format','eme_bookings_list_format','eme_bookings_list_header_format','eme_bookings_list_footer_format','eme_uninstall_drop_tables','eme_uninstall_drop_data','eme_time_remove_leading_zeros','eme_rsvp_hide_full_events','eme_events_admin_limit','eme_donation_done','eme_hello_to_user','eme_filter_form_format','eme_rsvp_addbooking_min_spaces','eme_rsvp_addbooking_max_spaces','eme_shortcodes_in_widgets','eme_load_js_in_header','eme_use_client_clock','eme_event_list_number_items', 'eme_cap_add_event', 'eme_cap_author_event', 'eme_cap_publish_event', 'eme_cap_edit_events', 'eme_cap_list_events', 'eme_cap_add_locations', 'eme_cap_edit_locations', 'eme_cap_author_locations', 'eme_cap_categories', 'eme_cap_people', 'eme_cap_approve', 'eme_cap_registrations', 'eme_cap_forms', 'eme_cap_cleanup', 'eme_cap_settings', 'eme_event_html_headers_format', 'eme_location_html_headers_format','eme_permalink_events_prefix','eme_permalink_locations_prefix','eme_paypal_url','eme_paypal_business', 'eme_2co_business', 'eme_2co_secret', 'eme_2co_demo', 'eme_webmoney_purse', 'eme_webmoney_secret', 'eme_webmoney_demo', 'eme_google_checkout_type', 'eme_google_merchant_id', 'eme_google_merchant_key', 'eme_location_list_format_header', 'eme_location_list_format_item', 'eme_location_list_format_footer','eme_event_initial_state', 'eme_registration_form_format', 'eme_smtp_debug','eme_default_currency','eme_default_price', 'eme_rsvp_number_days', 'eme_paypal_s_encrypt', 'eme_paypal_s_pubcert', 'eme_paypal_s_privkey', 'eme_paypal_s_paypalcert', 'eme_paypal_s_certid'); 
     154   $options = array ('eme_version', 'eme_events_page', 'eme_display_calendar_in_events_page', 'eme_event_list_item_format_header', 'eme_event_list_item_format', 'eme_event_list_item_format_footer', 'eme_event_page_title_format', 'eme_event_html_title_format', 'eme_single_event_format', 'eme_list_events_page', 'eme_events_page_title', 'eme_no_events_message', 'eme_location_page_title_format','eme_location_html_title_format', 'eme_location_baloon_format', 'eme_single_location_format', 'eme_location_event_list_item_format', 'eme_show_period_monthly_dateformat','eme_show_period_yearly_dateformat', 'eme_location_no_events_message', 'eme_gmap_is_active', 'eme_gmap_zooming', 'eme_seo_permalink', 'eme_rss_main_title', 'eme_rss_main_description', 'eme_rss_title_format', 'eme_rss_description_format', 'eme_rss_show_pubdate', 'eme_rsvp_mail_notify_is_active', 'eme_contactperson_email_body', 'eme_contactperson_cancelled_email_body', 'eme_contactperson_pending_email_body', 'eme_respondent_email_body', 'eme_registration_recorded_ok_html', 'eme_mail_sender_name', 'eme_smtp_username', 'eme_smtp_password', 'eme_default_contact_person','eme_captcha_for_booking', 'eme_mail_sender_address', 'eme_mail_receiver_address', 'eme_smtp_host', 'eme_rsvp_mail_send_method', 'eme_rsvp_mail_port', 'eme_rsvp_mail_SMTPAuth', 'eme_rsvp_registered_users_only', 'eme_rsvp_reg_for_new_events', 'eme_rsvp_require_approval', 'eme_rsvp_default_number_spaces', 'eme_rsvp_addbooking_submit_string', 'eme_rsvp_delbooking_submit_string', 'eme_image_max_width', 'eme_image_max_height', 'eme_image_max_size', 'eme_full_calendar_event_format', 'eme_use_select_for_locations', 'eme_attributes_enabled', 'eme_recurrence_enabled','eme_rsvp_enabled','eme_categories_enabled','eme_small_calendar_event_title_format','eme_small_calendar_event_title_separator','eme_registration_pending_email_body','eme_registration_denied_email_body','eme_registration_cancelled_email_body','eme_attendees_list_format','eme_bookings_list_format','eme_bookings_list_header_format','eme_bookings_list_footer_format','eme_uninstall_drop_tables','eme_uninstall_drop_data','eme_time_remove_leading_zeros','eme_rsvp_hide_full_events','eme_events_admin_limit','eme_donation_done','eme_hello_to_user','eme_filter_form_format','eme_rsvp_addbooking_min_spaces','eme_rsvp_addbooking_max_spaces','eme_shortcodes_in_widgets','eme_load_js_in_header','eme_use_client_clock','eme_event_list_number_items', 'eme_cap_add_event', 'eme_cap_author_event', 'eme_cap_publish_event', 'eme_cap_edit_events', 'eme_cap_list_events', 'eme_cap_add_locations', 'eme_cap_edit_locations', 'eme_cap_author_locations', 'eme_cap_categories', 'eme_cap_people', 'eme_cap_approve', 'eme_cap_registrations', 'eme_cap_forms', 'eme_cap_cleanup', 'eme_cap_settings', 'eme_cap_send_mails', 'eme_cap_send_other_mails', 'eme_event_html_headers_format', 'eme_location_html_headers_format','eme_permalink_events_prefix','eme_permalink_locations_prefix','eme_paypal_url','eme_paypal_business', 'eme_2co_business', 'eme_2co_secret', 'eme_2co_demo', 'eme_webmoney_purse', 'eme_webmoney_secret', 'eme_webmoney_demo', 'eme_google_checkout_type', 'eme_google_merchant_id', 'eme_google_merchant_key', 'eme_location_list_format_header', 'eme_location_list_format_item', 'eme_location_list_format_footer','eme_event_initial_state', 'eme_registration_form_format', 'eme_smtp_debug','eme_default_currency','eme_default_price', 'eme_rsvp_number_days', 'eme_paypal_s_encrypt', 'eme_paypal_s_pubcert', 'eme_paypal_s_privkey', 'eme_paypal_s_paypalcert', 'eme_paypal_s_certid'); 
    153155   foreach ( $options as $opt ) { 
    154156      delete_option ( $opt ); 
     
    174176             break; 
    175177          case 'access' : 
    176                  $options = array ('eme_cap_add_event', 'eme_cap_author_event', 'eme_cap_publish_event', 'eme_cap_list_events', 'eme_cap_edit_events', 'eme_cap_add_locations', 'eme_cap_author_locations', 'eme_cap_edit_locations', 'eme_cap_categories', 'eme_cap_people', 'eme_cap_approve', 'eme_cap_registrations', 'eme_cap_forms', 'eme_cap_cleanup', 'eme_cap_settings'); 
     178                 $options = array ('eme_cap_add_event', 'eme_cap_author_event', 'eme_cap_publish_event', 'eme_cap_list_events', 'eme_cap_edit_events', 'eme_cap_add_locations', 'eme_cap_author_locations', 'eme_cap_edit_locations', 'eme_cap_categories', 'eme_cap_people', 'eme_cap_approve', 'eme_cap_registrations', 'eme_cap_forms', 'eme_cap_cleanup', 'eme_cap_settings','eme_cap_send_mails','eme_cap_send_other_mails'); 
    177179             break; 
    178180          case 'events' : 
     
    338340   eme_options_select (__('Approve registrations','eme'), 'eme_cap_approve', eme_get_all_caps (), sprintf(__('Permission needed to approve pending registrations. Default: %s','eme'), eme_capNamesCB(DEFAULT_CAP_APPROVE)) ); 
    339341   eme_options_select (__('Edit registrations','eme'), 'eme_cap_registrations', eme_get_all_caps (), sprintf(__('Permission needed to edit approved registrations. Default: %s','eme'), eme_capNamesCB(DEFAULT_CAP_REGISTRATIONS)) ); 
     342   eme_options_select (__('Send Mails','eme'), 'eme_cap_send_mails', eme_get_all_caps (), sprintf(__('Permission needed to send mails for own events. Default: %s','eme'), eme_capNamesCB(DEFAULT_CAP_SEND_MAILS)) ); 
     343   eme_options_select (__('Send Other Mails','eme'), 'eme_cap_send_other_mails', eme_get_all_caps (), sprintf(__('Permission needed to send mails for any event. Default: %s','eme'), eme_capNamesCB(DEFAULT_CAP_SEND_OTHER_MAILS)) ); 
    340344   eme_options_select (__('Edit form fields','eme'), 'eme_cap_forms', eme_get_all_caps (), sprintf(__('Permission needed to edit form fields. Default: %s','eme'), eme_capNamesCB(DEFAULT_CAP_FORMS)) ); 
    341345   eme_options_select (__('Cleanup','eme'), 'eme_cap_cleanup', eme_get_all_caps (), sprintf(__('Permission needed to execute cleanup actions. Default: %s','eme'), eme_capNamesCB(DEFAULT_CAP_CLEANUP)) ); 
  • events-made-easy/trunk/events-manager.php

    r681557 r686595  
    152152define('DEFAULT_CAP_CLEANUP','activate_plugins'); 
    153153define('DEFAULT_CAP_SETTINGS','activate_plugins'); 
     154define('DEFAULT_CAP_SEND_MAILS','edit_posts'); 
     155define('DEFAULT_CAP_SEND_OTHER_MAILS','edit_others_posts'); 
    154156define('DEFAULT_EVENT_LIST_ITEM_FORMAT', '<li>#j #M #Y - #H:#i<br /> #_LINKEDNAME<br />#_TOWN </li>'); 
    155157define('DEFAULT_SINGLE_EVENT_FORMAT', '<p>#j #M #Y - #H:#i</p><p>#_TOWN</p><p>#_NOTES</p><p>#_ADDBOOKINGFORM</p><p>#_MAP</p>');  
     
    890892         $plugin_page = add_submenu_page('events-manager', __('Change Registration', 'eme'), __('Change Registration', 'eme'), get_option('eme_cap_registrations'), 'eme-registration-seats', "eme_registration_seats_page"); 
    891893         add_action( 'admin_head-'. $plugin_page, 'eme_admin_general_script' );  
     894         $plugin_page = add_submenu_page('events-manager', __('Send Mails', 'eme'), __('Send Mails', 'eme'), get_option('eme_cap_send_mails'), 'eme-send-mails', "eme_send_mails_page"); 
     895         add_action( 'admin_head-'. $plugin_page, 'eme_admin_general_script' );  
    892896         $plugin_page = add_submenu_page('events-manager', __('Form Fields','eme'),__('Form Fields','eme'), get_option('eme_cap_forms'), "eme-formfields", 'eme_formfields_page'); 
    893897         add_action( 'admin_head-'. $plugin_page, 'eme_admin_general_script' ); 
  • events-made-easy/trunk/readme.txt

    r686237 r686595  
    114114 
    115115= 1.0.19 = 
     116* Feature: you can now send mails to all attendees for an event in the admin backend. This functionality has it's own access right settings as well. 
    116117* Feature: added the possibility to use a print stylesheet called eme_print.css in your theme style dir 
    117118* Feature: shortcode events_ical_link now has 3 extra options: scope, author and contact_person 
Note: See TracChangeset for help on using the changeset viewer.