Correct api function for public subscribers to receive EXCERPT? | General - Subscribe2 HTML Support Forum | 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

No permission to create posts
sp_Feed Topic RSS sp_TopicIcon
Correct api function for public subscribers to receive EXCERPT?
May 28, 2015
10:36 am
Avatar
thomas
Member
Guests
Forum Posts: 15
Member Since:
March 31, 2015
sp_UserOfflineSmall Offline

Hi there,

I am trying to get this to work, both subscribers and public subscribers receive excerpt emails.

function s2member_filter($subscribers, $post_id) {
// $subscribers is an array of subscriber email addresses
$args = array( ‘role’ => ‘s2member_level1’, ‘fields’ => array(‘user_email’) );
$s2_level1 = get_users($args);

$args = array( ‘role’ => ‘s2member_level2’, ‘fields’ => array(‘user_email’) );
$s2_level2 = get_users($args);

$args = array( ‘role’ => ‘s2member_level3’, ‘fields’ => array(‘user_email’) );
$s2_level3 = get_users($args);

$all_s2_members = array_merge($s2_level1, $s2_level2, $s2_level3);
foreach ($all_s2_members as $user) {
$s2members[] = $user->user_email;
}
// we can do this with the $postid also
// like amend the subscribers list of the post id is in a specific category
$categories = wp_get_post_categories($post_id);
if ( in_array(‘1’, $categories) ) {
//The post is in category 1 so do something different
}

$filtered_subscribers = array_intersect($subscribers, $s2members);
} // end s2member_filter()

add_filter(‘s2_send_html_excerpt_subscribers’, ‘s2member_filter’, 10, 2);
add_filter(‘s2_send_public_subscribers’, ‘s2member_filter’, 10, 2);

is this correct? Is there a shorter way? All I want to achieve is that all subscribers always receive only excerpt html email.

Also I would like to find out how to show “subscribe success” and “unsubscribe success” message on the subscription page.
Does this work with all themes? somehow my page just shows the signup form. Any guidlines on how to tackle this problem would be awesome!

Kind regards,

Thomas

May 28, 2015
2:42 pm
Avatar
Matthew Robinson
UK
Admin
Forum Posts: 448
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 **

June 4, 2015
6:09 am
Avatar
thomas
Member
Guests
Forum Posts: 15
Member Since:
March 31, 2015
sp_UserOfflineSmall Offline

Hey Matthew, thx for the link, got it all to work!

One more problem stands, I am using enfold theme and somehow when someone clicks subscribes or unsubcribes in the email the landing page only shows the signup form, shoudlnt there be something like “thank you” or “sorry to see you go”?

how would I go about to troubleshoot this / fix it or incorporate it in the theme…

kind regards!

Thomas

June 4, 2015
7:04 am
Avatar
Matthew Robinson
UK
Admin
Forum Posts: 448
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 **

June 4, 2015
10:11 am
Avatar
thomas
Member
Guests
Forum Posts: 15
Member Since:
March 31, 2015
sp_UserOfflineSmall Offline

yes I understand, however.. my page only shows the subscribe/unsubscribe form, no messages…

 

situation:

1 someone adds emailaddress and clicks subscribe

2 a message is shown: A confirmation message is on its way!

3 user gets an email with confirmation link: domainename.ext/?s2=0859dac6bcf9dc2fed3fdf213191ecc1523

4 click the link and the page shows only Subscription form, enter email address – subscribe/unsubscribe. no messages.

 

Any idea how this can occur?

I would show you but the server is under in dev mode with special ip, you would need to change your host file to see it.

June 4, 2015
10:13 am
Avatar
Matthew Robinson
UK
Admin
Forum Posts: 448
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 **

June 4, 2015
10:33 am
Avatar
thomas
Member
Guests
Forum Posts: 15
Member Since:
March 31, 2015
sp_UserOfflineSmall Offline

found the problem, wordpress SEO by Yoast.
https://wordpress.org/plugins/wordpress-seo/

Is there a fix to make it compatible? Yoast is an important plugin, 1 mil+ users.

I tried:

function

s2_pts_compatibility() {

    

return array();

}

// end s2_pts_compatibility()

add_filter(

's2_post_statuses', 's2_pts_compatibility' );

 

without any result… oh just realised thats for pts 🙂 any code like this for wordpress SEO by yoast?

 

With this find I see that I have another problem, the text is shown in a page that doesnt use certain features of my template, for instance there is some code around the shortcode that needs to be in place. Is there a template file? Can I add linke 50 lines of html before and after the text to spice up the page? Can i add the template file in my childtheme folder? You can see this in the attachements. First one is page without message, SEO plugin enabled, second one is page with message, SEO plugin disabled.

Need: SEO plugin enabled page layout with confirmation message working :-/

subscription_page.jpgImage Enlargersubscription_message_page.jpgImage Enlarger

June 4, 2015
10:42 am
Avatar
Matthew Robinson
UK
Admin
Forum Posts: 448
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 **

June 4, 2015
10:46 am
Avatar
thomas
Member
Guests
Forum Posts: 15
Member Since:
March 31, 2015
sp_UserOfflineSmall Offline

I striked it through before you posted 🙂 sorry my bad

Any way to include some code before and after the message? I have the codes in a php file I could include in a template file.

Hmmm.. I could make subscription-page.php

 

Let me try

June 4, 2015
10:54 am
Avatar
Matthew Robinson
UK
Admin
Forum Posts: 448
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 **

June 4, 2015
11:58 am
Avatar
thomas
Member
Guests
Forum Posts: 15
Member Since:
March 31, 2015
sp_UserOfflineSmall Offline

got it all to work with special template file! jeeeeee

thank you, you rock!

One last little question, is it possible to include a tag in the email that will unsubscribe on click? Now users need to manually add their emailaddress in a form. Like a 1 click unsubscribe.

 

greets,

Thomas

June 4, 2015
3:27 pm
Avatar
Matthew Robinson
UK
Admin
Forum Posts: 448
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 **

June 8, 2015
9:37 am
Avatar
thomas
Member
Guests
Forum Posts: 15
Member Since:
March 31, 2015
sp_UserOfflineSmall Offline

Matthew Robinson said
@Thomas

That’s possible too with the {UNSUBLINK} keyword in the template. And if you want to make it look better still there are hooks that allow additional formatting as documented here:

https://subscribe2.wordpress.com/2014/12/31/unsubscribe-links-in-notification-emails/

Thank you, this is exactly what I was looking for!

I am currently using a plugin to style the email (WP Email by S3). However I rather get rid of it and add my custom html to subscribe2html. How would I go about and add a whole lot of html to the start of the email, and how would I add a whole lot of html to the end of the email? So the content part is inbetween. 

How would I add the {UNSUBLINK} into the footer part?

When I use the other email template plugin the {UNBSUBLINK} is just shown as {UNSUBLINK} logically as its from a different plugin.

I found these functions, is this the way to go?

ADD HTML TO START OF EMAIL:
function my_s2html_filter($message) { 
if ( empty($message) ) { return; }
list($first, $second) = explode('<html>', $message, 2);
$email = $first . '<html> a whole lot of html here' . $second;


return $message;
}

add_filter('s2_digest_email', 'my_s2html_filter');

 
ADD HTML TO END OF EMAIL:
function my_s2_template($template) {
$template .= "Some additional text I'd like at the end";
}
add_filter('s2_email_template', 'my_s2_template');

 

Is this correct? or is there a better way of doing it?

 

Greets,

Thomas

June 8, 2015
10:00 am
Avatar
thomas
Member
Guests
Forum Posts: 15
Member Since:
March 31, 2015
sp_UserOfflineSmall Offline

Just tried the functions, but dont see any changes.

In short:

I have a html responsive email layout, complete with inline styles etc. I need to take half of that code and add it to the top of the email, then comes the content from wordpress, then I would like to close it all off with the bottom half of the html file. This bottom half contains the unsubscribe link.

 

What to do?

 

Thomas

June 8, 2015
10:31 am
Avatar
Matthew Robinson
UK
Admin
Forum Posts: 448
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 **

June 8, 2015
10:39 am
Avatar
thomas
Member
Guests
Forum Posts: 15
Member Since:
March 31, 2015
sp_UserOfflineSmall Offline

thx gonna try it right away!

How would I add {UNSUBLINK} in here?

June 8, 2015
10:48 am
Avatar
thomas
Member
Guests
Forum Posts: 15
Member Since:
March 31, 2015
sp_UserOfflineSmall Offline

ok just tested above code:

Parse error: syntax error, unexpected ‘explode’ (T_STRING), expecting ‘=’

 

any ideas?

June 8, 2015
11:04 am
Avatar
Matthew Robinson
UK
Admin
Forum Posts: 448
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 **

June 8, 2015
12:14 pm
Avatar
thomas
Member
Guests
Forum Posts: 15
Member Since:
March 31, 2015
sp_UserOfflineSmall Offline

no problem,

I have another one for you:

Parse error: syntax error, unexpected ‘}’

 

About the unsub, its kinda styled in the layout of the email as a footer, any ideas how to achieve this?

Check image below to see what I am trying to achieveemail.jpgImage Enlarger

sp_PlupAttachments Attachments
June 8, 2015
1:18 pm
Avatar
Matthew Robinson
UK
Admin
Forum Posts: 448
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 **

No permission to create posts
Forum Timezone: America/New_York

Most Users Ever Online: 964

Currently Online:
38 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Member Stats:

Guest Posters: 35

Members: 19946

Moderators: 0

Admins: 8

Forum Stats:

Groups: 4

Forums: 28

Topics: 1894

Posts: 8081

Newest Members:

Vickie Yorke

Administrators: Michael TorbertPeter BayliesSupport TeamSteve MortiboyMatthew RobinsonSteve KlasenArnaud BroesAshish Ravi

[i]
[i]
Skip to toolbar