Skip to content

Commit

Permalink
fixes clone event, rsvp reminders
Browse files Browse the repository at this point in the history
  • Loading branch information
davidfcarr committed Aug 13, 2017
1 parent 5baf889 commit 7789d49
Show file tree
Hide file tree
Showing 6 changed files with 101 additions and 30 deletions.
9 changes: 7 additions & 2 deletions README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ Donate link: http://rsvpmaker.com/
License: GPLv2
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Requires at least: 3.0
Tested up to: 4.8
Stable tag: 4.7.1
Tested up to: 4.8.1
Stable tag: 4.7.2

Schedule events, send invitations, track RSVPs, and collect PayPal payments.

Expand Down Expand Up @@ -115,6 +115,11 @@ For basic usage, you can also have a look at the [plugin homepage](http://www.rs

== Changelog ==

= 4.7.2 =

* Improvements to clone event / create template from event functions
* Fix to prevent other plugins from modifying the mce editor on reminders editor page

= 4.7.1 =

* Fix to rsvpmaker_upcoming display so doesn't show "No events listed" when future events out of date range
Expand Down
34 changes: 17 additions & 17 deletions rsvpmaker-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -2033,22 +2033,6 @@ function rsvpmaker_replay_email ( $post_id, $rsvp_id, $hours ) {
$mail["from"] = $rsvp_to;
$mail["fromname"] = get_bloginfo('name');
rsvpmaker_tx_email(get_post($post_id), $mail);
/*
if(isset($rsvp_options["smtp"]) && !empty($rsvp_options["smtp"]) )
{
$mail["subject"] = $subject;
$mail["html"] = $confirm;
$mail["to"] = $notify;
$mail["from"] = $rsvp_to;
$mail["fromname"] = get_bloginfo('name');
$result = rsvpmailer($mail);
}
else
{
echo wpautop("Notification to $notify");
wp_mail($notify,$subject,$notification,"From: $rsvpto\nContent-Type: text/html; charset=UTF-8");
}
*/
}

// RSVPMaker Reminders
Expand Down Expand Up @@ -2324,7 +2308,17 @@ function rsvp_reminders () {

if(empty($content) )
$content = get_post_meta($post_id,'_rsvp_confirm',true);
$settings = array();

$settings = array(
'media_buttons' => false,
'tinymce' => array(
'toolbar1' => 'bold,italic,separator,alignleft,aligncenter,alignright,separator,link,unlink,undo,redo',
'toolbar2' => '',
'toolbar3' => '',
),
);
//prevent other plugins from modifying editor
add_filter('mce_external_plugins',function( $p ) { return array(); },99);
wp_editor( $content, $editor_id, $settings );
?>
<p><button>Save</button></p>
Expand Down Expand Up @@ -2899,4 +2893,10 @@ function rsvpmaker_admin_page_bottom($hook = '') {
printf("\n".'<hr /><p><small>%s</small></p></div>',$hook);
}

function rsvpmaker_editors() {
if(isset($_GET['page']) && ($_GET['page'] ='rsvp_reminders'))
wp_enqueue_editor();
}

add_action('admin_init','rsvpmaker_editors');
?>
24 changes: 22 additions & 2 deletions rsvpmaker-display.php
Original file line number Diff line number Diff line change
Expand Up @@ -1657,11 +1657,31 @@ function rsvpmaker_archive_loop_end () {
//keep jetpack from messing up
function rsvpmaker_no_related_posts( $options ) {
global $post;
if(($post->post_type =='rsvpmaker' ) || ($post->post_type =='rsvpemail' ))
if(($post->post_type == 'rsvpmaker' ) || ($post->post_type == 'rsvpemail' ))
{
$options['enabled'] = false;
$options['enabled'] = $options['headline'] = false;
}
return $options;
}
add_filter( 'jetpack_relatedposts_filter_options', 'rsvpmaker_no_related_posts' );

function rsvp_report_this_post() {
global $wpdb;
global $rsvp_options;
global $post;
if(empty($post->ID))
return;

$eventid = $post->ID;
$o = "<h2>".__("RSVPs",'rsvpmaker')."</h2>\n";
$sql = "SELECT * FROM ".$wpdb->prefix."rsvpmaker WHERE event=$eventid ORDER BY yesno DESC, last, first";
$wpdb->show_errors();
$results = $wpdb->get_results($sql, ARRAY_A);
if(empty($results))
return $o . '<p>'.__('None','rsvpmaker').'</p>';
ob_start();
format_rsvp_details($results, false);
$o .= ob_get_clean();
return $o;
}
?>
56 changes: 51 additions & 5 deletions rsvpmaker-email.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ class MailChimpRSVP
{
private $api_key;
private $api_endpoint = 'https://<dc>.api.mailchimp.com/3.0';
/* SSL Verification
private $data_center;
/* SSL Verification
Read before disabling:
http://snippets.webaware.com.au/howto/stop-turning-off-curlopt_ssl_verifypeer-and-fix-your-php-config/
*/
Expand All @@ -40,13 +41,19 @@ public function __construct($api_key)
list(, $data_center) = explode('-', $this->api_key);
$this->api_endpoint = str_replace('<dc>', $data_center, $this->api_endpoint);
$this->last_response = array('headers' => null, 'body' => null);
$this->data_center = $data_center;
}
/* when saved as draft, direct user to url for draft */
public function draft_link() {
return 'https://'.$this->data_center.'.admin.mailchimp.com/campaigns/';
}

/**
* Create a new instance of a Batch request. Optionally with the ID of an existing batch.
* @param string $batch_id Optional ID of an existing batch, if you need to check its status for example.
* @return Batch New Batch object.
*/
public function new_batch($batch_id = null)
public function new_batch($batch_id = null)
{
return new Batch($this, $batch_id);
}
Expand Down Expand Up @@ -919,20 +926,30 @@ function default_rsvpemail_title($title) {
function default_rsvpemail_content($content) {
global $post;

if(!empty($_GET["get_post"]) && empty($_GET["rsvpemail"]) )
{
$post = get_post($_GET["get_post"]);
return $post->post_content; // used for creating post draft based on email
}

if(!empty($_GET["get_post"]))
{
if(isset($_GET["rsvpemail"]))
{
//don't add embed code for YouTube etc
remove_filter( 'the_content', array( $GLOBALS['wp_embed'], 'autoembed' ), 8 );
$content .= "INTRO\n\n";
}
$parts = explode(':',$_GET["get_post"]);
if(!empty($parts[1]))
$cq = new WP_Query('posts_per_page='.$parts[1]);
else
$cq = new WP_Query('posts_per_page=1&p='. (int) $_GET["get_post"]);

ob_start();
//// print_r($cq);
while ( $cq->have_posts() ) : $cq->the_post();
global $post;

$post_backup = $post;
if(!$subject)
$subject = get_the_title();
Expand Down Expand Up @@ -1235,11 +1252,19 @@ function rsvpmaker_email_send_ui($chimp_html, $chimp_text, $rsvp_html, $rsvp_tex
echo '<div>'.__('MailChimp API error','rsvpmaker').': '.$MailChimp->getLastError().'</div>';
return;
}
if(empty($_POST["chimp_send_now"]))
{
$link = $MailChimp->draft_link();
echo '<div><a target="_blank" href="'.$link.'">'.__('View draft','rsvpmaker').'</a> '. __('on mailchimp.com','rsvpmaker').'</div>';
}
else // send now
{
$send_result = $MailChimp->post("campaigns/".$campaign["id"].'/actions/send');
if($MailChimp->success())
echo '<div>'.__('Sent MailChimp campaign','rsvpmaker').': '.$campaign["id"].'</div>';
else
echo '<div>'.__('MailChimp API error','rsvpmaker').': '.$MailChimp->getLastError().'</div>';
}
}

}
Expand Down Expand Up @@ -1277,7 +1302,7 @@ function rsvpmaker_email_send_ui($chimp_html, $chimp_text, $rsvp_html, $rsvp_tex
$chosen = (isset($custom_fields["_email_list"][0])) ? $custom_fields["_email_list"][0] : $chimp_options["chimp-list"];
echo mailchimp_list_dropdown($chimp_options["chimp-key"], $chosen);
?>
</select> </div>
</select> <select name="chimp_send_now"><option value="1"><?php _e('Send now','rsvpmaker'); ?></option><option value="" <?php if(isset($_POST["mailchimp"]) && empty($_POST["chimp_send_now"])) echo ' selected="selected" '; ?> ><?php _e('Save as draft on mailchimp.com','rsvpmaker'); ?></option></select></div>
<?php
}

Expand Down Expand Up @@ -1672,7 +1697,28 @@ function email_get_content () {
<li><strong><?php _e('Excerpt','rsvpmaker');?></strong> <?php _e('Show only short excerpt with a link to the rest of the post.','rsvpmaker');?></li>
</ul>
<p><?php _e('These parameters are not applied to the events.','rsvpmaker');?></p>
<?php

<h2>Create Draft Blog Post from Email</h2>

<?php
$posts = '';
$sql = "SELECT ID, post_title FROM $wpdb->posts WHERE post_status='publish' AND post_type='rsvpemail' ORDER BY ID DESC LIMIT 0, 50";
$wpdb->show_errors();
$results = $wpdb->get_results($sql, ARRAY_A);
if($results)
{
foreach ($results as $row)
{
$posts .= sprintf("<option value=\"%d\">%s</option>\n",$row["ID"],substr($row["post_title"],0,80));
}
}
?>
<form action="<?php echo admin_url('post-new.php'); ?>" method="get">
<p><?php _e('Posts','rsvpmaker');?>: <select name="get_post"><?php echo $options.$posts; ?></select>
</p>
<button><?php _e('Create Draft','rsvpmaker');?></button>
</form>
<?php
} // end chimp get content

function rsvpmaker_email_list_okay ($rsvp) {
Expand Down
4 changes: 2 additions & 2 deletions rsvpmaker-plugabble.php
Original file line number Diff line number Diff line change
Expand Up @@ -2486,7 +2486,7 @@ function rsvp_report() {

if(!function_exists('format_rsvp_details') )
{
function format_rsvp_details($results) {
function format_rsvp_details($results, $editor_options = true) {

global $rsvp_options;
$print_nonce = wp_create_nonce('rsvp_print');
Expand Down Expand Up @@ -2548,7 +2548,7 @@ function format_rsvp_details($results) {
echo 'posted: '.strftime($rsvp_options["short_date"],$t);
echo "</p>";

if(!isset($_GET["rsvp_print"]) && current_user_can('edit_others_posts'))
if(!isset($_GET["rsvp_print"]) && current_user_can('edit_others_posts') && $editor_options)
echo sprintf('<p><a href="%s&delete=%d">Delete record for: %s %s</a></p>',admin_url().'edit.php?post_type=rsvpmaker&page=rsvp',$row["id"],esc_attr($row["first"]),esc_attr($row["last"]) );
$userrsvps[] = $row["user_id"];
}
Expand Down
4 changes: 2 additions & 2 deletions rsvpmaker.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Plugin URI: http://www.rsvpmaker.com
Description: Schedule events, send invitations to your mailing list and track RSVPs. You get all your familiar WordPress editing tools with extra options for setting dates and RSVP options. PayPal payments can be added with a little extra configuration. Email invitations can be sent through MailChimp or to members of your website community who have user accounts. Recurring events can be tracked according to a schedule such as "First Monday" or "Every Friday" at a specified time, and the software will calculate future dates according to that schedule and let you track them together.RSVPMaker now also specifically supports organizing online events or webinars with Google's <a href="http://rsvpmaker.com/blog/2016/11/23/creating-a-youtube-live-event-with-a-landing-page-on-your-wordpress-website/">YouTube Live</a> video broadcast service (formerly Hangouts on Air). <a href="options-general.php?page=rsvpmaker-admin.php">Options</a> / <a href="edit.php?post_type=rsvpmaker&page=rsvpmaker_doc">Shortcode documentation</a>.
Author: David F. Carr
Version: 4.7.1
Version: 4.7.2
Author URI: http://www.carrcommunications.com
Text Domain: rsvpmaker
Domain Path: /translations
Expand Down Expand Up @@ -133,7 +133,7 @@ function get_rsvpmaker_custom($post_id) {
);


if(strpos($_SERVER['REQUEST_URI'],'post-new.php'))
if(strpos($_SERVER['REQUEST_URI'],'post-new.php') && !isset($_GET['clone']))
{
$custom['_rsvp_on'][0] = $rsvp_options['rsvp_on'];
foreach($defaults as $default_key => $custom_key)
Expand Down

0 comments on commit 7789d49

Please sign in to comment.