Add a filter to include post_status options for previews. | Feature Requests - Subscribe2 HTML | Support | Semper Plugins

Avatar
Lost password?
Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
sp_Feed Topic RSS sp_TopicIcon
Add a filter to include post_status options for previews.
May 26, 2017
5:28 pm
Avatar
Kyle Johnson
Member
Guests
Forum Posts: 4
Member Since:
May 26, 2017
sp_UserOfflineSmall Offline

My usage of this plugin includes previewing the email for a post still in draft mode before it gets published.  I edited the code to add this functionality, but it would be nice if something like this was added to the source code so that I don’t have to add it manually every time an updated version of the core code is release.

Here is how I did it, which is simple and solves my problem, but you might have a better way that is more safe/robust.

Code added to settings.php and class-s2-core.php

$post_status = apply_filters('s2_post_status',""); $posts = get_posts( "numberposts=1" . $post_status );

 

Code added to a custom plugin

function zn_s2_post_status() { return "&post_status='publish,draft'"; } add_filter('s2_post_status','zn_s2_post_status');
May 27, 2017
2:45 pm
Avatar
Matthew Robinson
UK
Admin
Forum Posts: 472
Member Since:
December 13, 2012
sp_UserOfflineSmall Offline

** You currently do not have permission to see this post. To obtain access to these Premium Support Forums, please purchase a plugin and support subscription from Semper Plugins **

May 30, 2017
8:59 pm
Avatar
Kyle Johnson
Member
Guests
Forum Posts: 4
Member Since:
May 26, 2017
sp_UserOfflineSmall Offline

The code is good other than an ampersand “&” becoming the entity “&”

After posting I also had a thought that it may be simpler to add a check box option for including drafts, since implementing the filter as I have it allows for completely modifying the post query.  Though maybe that is something other users might want.

June 3, 2017
12:49 pm
Avatar
Matthew Robinson
UK
Admin
Forum Posts: 472
Member Since:
December 13, 2012
sp_UserOfflineSmall Offline

** You currently do not have permission to see this post. To obtain access to these Premium Support Forums, please purchase a plugin and support subscription from Semper Plugins **

July 28, 2017
6:54 pm
Avatar
Kyle Johnson
Member
Guests
Forum Posts: 4
Member Since:
May 26, 2017
sp_UserOfflineSmall Offline

@Matthew

Sorry for not responding sooner, my email subscriptions were disabled.

I saw the 10.15 release notes (thanks for the name recognition for my other issue) and saw the bit about sending a preview email and thought it sounded like my suggestion.

So to answer your questions from 2 months ago:

1 – You are correct that we want a preview of the current post before it is published.

2 – Yes it would, and it does. 

I installed the update and tested a preview email and it worked perfectly!

I don’t know that there is a way to mark this as SOLVED, but this update provided the functionality that we needed.

Thank you!

July 31, 2017
1:41 pm
Avatar
Matthew Robinson
UK
Admin
Forum Posts: 472
Member Since:
December 13, 2012
sp_UserOfflineSmall Offline

** You currently do not have permission to see this post. To obtain access to these Premium Support Forums, please purchase a plugin and support subscription from Semper Plugins **

Forum Timezone: America/New_York
Most Users Ever Online: 964
Currently Online:
28
Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Member Stats:
Guest Posters: 36
Members: 22805
Moderators: 0
Admins: 8
Forum Stats:
Groups: 4
Forums: 28
Topics: 2094
Posts: 9105
Newest Members:
Sabrina Kent
Administrators: Michael TorbertPeter BayliesSupport TeamSteve MortiboyMatthew RobinsonSteve Klasen, Arnaud: 239Ashish Ravi
[i]
[i]
Skip to toolbar