Skip to content

Commit

Permalink
Merge pull request #8 from eighty20results/4.2.4
Browse files Browse the repository at this point in the history
4.2.4
  • Loading branch information
eighty20results committed Dec 30, 2015
2 parents 277d664 + 37bf7cc commit 1363328
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 42 deletions.
34 changes: 10 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,12 @@ You can also email you support question(s) to [email protected]

##Changelog

###4.2.3

* Fix: Avoid using reserved variable names
* Fix: Extend WP_Error wotj E20RError class
###4.2.4
* Fix: Didn't always allow access to a post that was supposed to be available
* Fix: The subject of email alerts used the incorrect date for the post alert
* Enh: Didn't have a default notification type (single post per alert)
* Enh: Use WP's time constants (DAY|WEEK|etc_IN_SECONDS)
* Enh: The replaceable value !!today!! didn't use the delay value of the post to calculate the date.

##Old releases
###.1
Expand Down Expand Up @@ -476,12 +478,10 @@ You can also email you support question(s) to [email protected]
* Support removing one of multiple sequence entries from a post/page in edit.php

###3.0-beta-3

* Renamed 'Add' button to 'New Sequence'
* Would sometimes add an extra sequence/delay input field when the 'Add' button was clicked in edit.php

###3.0-beta-4

* Update the TODO section in README.txt
* Clean up TODO items class.PMProSequence.php
* Would loop indefinitely if there were no sequence posts and the sequence was attempted viewed from the front-end.
Expand All @@ -494,7 +494,6 @@ You can also email you support question(s) to [email protected]
* Re-enable the wipe functionality when changing the type of sequence from day # based to date based (or vice versa)

###3.0-beta-5

* Fix error handling in add post to sequence operation
* Add class function to configure & time out error message in /wp-admin/
* Fix $_POST variables in add_entry()
Expand All @@ -510,7 +509,6 @@ You can also email you support question(s) to [email protected]
* Refactor add_post_callback()

###3.0-beta-6

* Primarily convert to V3 as part of plugin activation or if the user attempts to load the sequence.
* Would sometimes get into a load/convert loop Flag conversion attempt as 'forced' if no posts are found with V3 format and the sequence is NOT previously converted.
* Add padding to opt-in checkbox
Expand All @@ -521,14 +519,12 @@ You can also email you support question(s) to [email protected]
* Updated translations (Norwegian & English/US)

###3.0-beta-7

* Wouldn't always honor the refresh value when loading the sequence
* Refactor conversion for user's new-post notice settings
* Clean up erroneous notification settings for user
* Didn't save the 'Allow email notification' setting

###3.0-beta-8

* Didn't always set the optin_at timestamp correctly in the default user alert settings
* Removed redundant option management
* Don't show a checkmark if the user has opted-out of receiving alert notices/emails
Expand All @@ -555,22 +551,19 @@ You can also email you support question(s) to [email protected]
* Fix is_after_opt_in() to support new user alert setting format

###3.0-beta-9

* Didn't always display the delay input box in the post editor metabox.
* Make opt-in checkbox responsive
* Didn't always display the delay input box in the post editor metabox.
* Update change log & version numbers

###3.0-beta-10

* Add all_sequences() static function
* Add post_details() static function
* Update change log & version numbers
* Allow calling PMProSequence::sequences_for_post() to return array of sequence IDs for the post_id specified
* Add static function to fetch all sequence IDs that a post_id is associated with

###3.0-beta-11

* Update version number and change log
* find_by_id() would sometimes load unneeded posts (and not honor cache)
* When loading a specific post_id for the sequence, don't ignore drafts (May cause duplication in DB)
Expand All @@ -582,12 +575,10 @@ You can also email you support question(s) to [email protected]
* Update text in email opt-in checkbox

###3.0-beta-12

* Load Font Awesome fonts as part of script/style load.
* Update path to Font Awesome fonts (CDN)

###3.0-beta-13

* Would sometimes return all posts in the sequence while deleting one post.
* Fix undefined variable warning in load_sequence_post()
* Didn't include sequence members (posts) in DRAFT state when displaying list of sequences in metabox(es)
Expand All @@ -596,27 +587,23 @@ You can also email you support question(s) to [email protected]
* Run wp_reset_query() before returning all sequences in get_all_sequences().

###3.0.1

* Would sometimes issue warning in find_by_id()
* Updated to direct user to dashboard
* v3.0.1

###3.0.2

* Would sometimes trigger warning message while searching for a specific post ID
* Only grant blanket access to post in sequence if admin is logged in on dashboard and we're not in an ajax operation
* Comment out incomplete Google Analytics tracking support
* Add debug output for send_notice() to help troubleshoot.
* Make opt-in form full-width

###3.0.3

* On the edit.php page, add a 'Clear alerts' button for a specific post/sequence/delay combination
* Allow admin to clear notification flags for a specific post/delay/sequence id from the posts edit page
* Make language tag consistent

###3.0.4

* Conditional return triggered fatal error in certain situations
* Use absolute URL for fontawesome
* Respect theme settings for fonts/text in widgets
Expand Down Expand Up @@ -710,7 +697,6 @@ You can also email you support question(s) to [email protected]
* Enh: Add link to issues section on GitHub.com

###4.1.0

* Fix: Searchable select box would sometimes stop working in backend
* Fix: More reliable detection of origination of add/remove post/page
* Fix: More robust error handling during remove post/page operation
Expand All @@ -729,22 +715,18 @@ You can also email you support question(s) to [email protected]
* Nit: Refactor Controller class

###4.1.1

* Fix: Adding/Removing posts to sequence could result in JavaScript error
* Fix: Would sometimes attempt to process auto-drafts

###4.1.2

* Fix: Generating warning message while processing delay configuration for sequence(s)
* Fix: Didn't always ignore unpublished/unavailable sequences

###4.1.3

* Fix: Didn't always select the correct key for the sequence cache
* Fix: Didn't always load new sequence data

###4.2.0

* Fix: Load template (or exit if template can't be found)
* Fix: Didn't respect settings for individual alerts for new content (not digest)
* Fix: Remove hidden/inactive code
Expand All @@ -763,3 +745,7 @@ You can also email you support question(s) to [email protected]

###4.2.2
* Fix: Didn't include all 'unalerted' content prior to the specified delay value when sending alerts to users

###4.2.3
* Fix: Avoid using reserved variable names
* Fix: Extend WP_Error wotj E20RError class
12 changes: 10 additions & 2 deletions README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Tags: sequence, drip feed, serial, delayed, limited, memberships
Requires at least: 3.4
Requires PHP 5.3 or later.
Tested up to: 4.4
Stable tag: 4.2.3
Stable tag: 4.2.4

Create a drip feed "Sequence" which are groups of posts/pages/CPTs where the content is revealed to members over time. This is an extension of the "drip feed content" module for Paid Memberships Pro (pmpro-series).

Expand Down Expand Up @@ -136,10 +136,18 @@ Or you can email [email protected]

== Changelog ==

== 4.2.4 ==

* Fix: Didn't always allow access to a post that was supposed to be available
* Fix: The subject of email alerts used the incorrect date for the post alert
* Enh: Didn't have a default notification type (single post per alert)
* Enh: Use WP's time constants (DAY|WEEK|etc_IN_SECONDS)
* Enh: The replaceable value !!today!! didn't use the delay value of the post to calculate the date.

== 4.2.3 ==

* Fix: Avoid using reserved variable names
* Fix: Extend WP_Error wotj E20RError class
* Fix: Extend WP_Error with E20RError class

== 4.2.2 ==

Expand Down
7 changes: 5 additions & 2 deletions build_readmes/current.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
Fix: Avoid using reserved variable names
Fix: Extend WP_Error wotj E20RError class
Fix: Didn't always allow access to a post that was supposed to be available
Fix: The subject of email alerts used the incorrect date for the post alert
Enh: Didn't have a default notification type (single post per alert)
Enh: Use WP's time constants (DAY|WEEK|etc_IN_SECONDS)
Enh: The replaceable value !!today!! didn't use the delay value of the post to calculate the date.
20 changes: 13 additions & 7 deletions classes/class-controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ public function load_sequence_post( $sequence_id = null, $delay = null, $post_id

$this->dbg_log("load_sequence_post() - Expected delay value is a 'date' so need to convert");
$startdate = pmpro_getMemberStartdate( $user_id );
$delay = date('Y-m-d', ($startdate + ( $delay * 3600*24 ) ) );
$delay = date('Y-m-d', ($startdate + ($delay * DAY_IN_SECONDS)) );
$data_type = 'DATE';
}

Expand Down Expand Up @@ -1777,9 +1777,9 @@ public function has_post_access( $user_id, $post_id, $isAlert = false, $sequence

if ( true === $is_authorized_ajax && false === $is_editor ){

$this->dbg_log("has_post_access() - User does not have edit permissions: ");
$this->dbg_log("has_post_access() - User ({$user_id}) does not have edit permissions: ");
$this->dbg_log("has_post_access() - Editor: " . ($is_editor ? 'true' : 'false') . " AJAX: " . ($is_authorized_ajax ? 'true' : 'false'));
return false;
// return false;
}

$retval = false;
Expand Down Expand Up @@ -2149,7 +2149,7 @@ public function find_posts_by_delay( $delay, $user_id = null ) {
$posts = $this->find_closest_post( $user_id );
}

$this->dbg_log("find_posts_by_delay() - Returning " . count($posts) . " with delay value of {$delay}");
$this->dbg_log("find_posts_by_delay() - Returning " . count($posts) . " with delay value <= {$delay}");
return $posts;

}
Expand Down Expand Up @@ -4235,11 +4235,13 @@ private function prepare_mailobj( $post, $user, $template ) {

$email = new \PMProEmail();

$user_started = (pmpro_getMemberStartdate($user->ID) - DAY_IN_SECONDS) + ($this->normalize_delay($post->delay) * DAY_IN_SECONDS);

$email->from = $this->options->replyto; // = pmpro_getOption('from_email');
$email->template = $template;
$email->fromname = $this->options->fromname; // = pmpro_getOption('from_name');
$email->email = $user->user_email;
$email->subject = sprintf('%s: %s (%s)', $this->options->subject, $post->post_title, strftime("%x", current_time('timestamp') ));
$email->subject = sprintf('%s: %s (%s)', $this->options->subject, $post->post_title, strftime("%x", $user_started));
$email->dateformat = $this->options->dateformat;

return $email;
Expand Down Expand Up @@ -4313,11 +4315,15 @@ public function send_notice($posts, $user_id, $seq_id) {
return false;
}

$user_started = (pmpro_getMemberStartdate($user_id) - DAY_IN_SECONDS);

foreach( $posts as $post ) {

// $post = get_post($p->id);
$as_list = false;

$post_date = date($this->options->dateformat, ($user_started + ($this->normalize_delay($post->delay) * DAY_IN_SECONDS)));

// Send all of the links to new content in a single email message.
if ( E20R_SEQ_SEND_AS_LIST == $this->options->noticeSendAs ) {

Expand All @@ -4333,7 +4339,7 @@ public function send_notice($posts, $user_id, $seq_id) {
$emails[$idx]->data = array(
"name" => $user->user_firstname, // Options are: display_name, first_name, last_name, nickname
"sitename" => get_option("blogname"),
"today" => date($this->options->dateformat, current_time('timestamp')),
"today" => $post_date,
"excerpt" => '',
"ptitle" => $post->title
);
Expand Down Expand Up @@ -4371,7 +4377,7 @@ public function send_notice($posts, $user_id, $seq_id) {
"name" => $user->user_firstname, // Options are: display_name, first_name, last_name, nickname
"sitename" => get_option("blogname"),
"post_link" => $post_links,
"today" => date($this->options->dateformat, current_time('timestamp')),
"today" => $post_date,
"excerpt" => $excerpt,
"ptitle" => $post->title
);
Expand Down
3 changes: 2 additions & 1 deletion classes/tools/class-cron.php
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,9 @@ public static function check_for_new_content($sequence_id = null)
}

// $posts = $sequence->get_postDetails( $post->id );
$sequence->dbg_log("cron() - sendNoticeAs option is currently: {$sequence->options->noticeSendAs}");

if (E20R_SEQ_SEND_AS_SINGLE == $sequence->options->noticeSendAs) {
if (empty($sequence->options->noticeSendAs) || E20R_SEQ_SEND_AS_SINGLE == $sequence->options->noticeSendAs) {

$sequence->dbg_log("cron() - Processing " . count($posts) . " individual messages to send to {$s->user_id}");

Expand Down
4 changes: 2 additions & 2 deletions e20r-sequences.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Plugin Name: Eighty / 20 Results Sequences for Paid Memberships Pro
Plugin URI: http://www.eighty20results.com/pmpro-sequences/
Description: Offer serialized (drip feed) content to your PMPro members. Derived from the PMPro Series plugin by Stranger Studios.
Version: 4.2.3
Version: 4.2.4
Author: Thomas Sjolshagen
Author Email: [email protected]
Author URI: http://www.eighty20results.com
Expand Down Expand Up @@ -40,7 +40,7 @@
// use NS as Sequence;

/* Version number */
define('E20R_SEQUENCE_VERSION', '4.2.3');
define('E20R_SEQUENCE_VERSION', '4.2.4');

/* Set the max number of email alerts to send in one go to one user */
define('E20R_SEQUENCE_MAX_EMAILS', 3);
Expand Down
Loading

0 comments on commit 1363328

Please sign in to comment.