Site members getting emails for categories they are not subscribed to | 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

sp_Feed Topic RSS sp_TopicIcon
Site members getting emails for categories they are not subscribed to
June 2, 2017
12:26 pm
Avatar
silverback
Member
Subscribe2
Forum Posts: 9
Member Since:
January 13, 2016
sp_UserOfflineSmall Offline

We are using S2HTML to allow site members to subscribe to custom taxonomies attached to custom post types. Everything appears to be working, but people who are not subscribed to some categories are still getting those categories. We’re currently using TT Subscribe2 Frontend to allow users to manage their subs from the frontend of the site, but I don’t think it’s the issue. When I login to WP Admin and look at the users’ s2 subscriptions, what the plugin is showing accurately reflects their choices, the send process just doesn’t seem to be adhering to those choices.

June 2, 2017
1:20 pm
Avatar
Matthew Robinson
UK
Admin
Forum Posts: 443
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 2, 2017
6:53 pm
Avatar
silverback
Member
Subscribe2
Forum Posts: 9
Member Since:
January 13, 2016
sp_UserOfflineSmall Offline

This:

 

/*
 *  Add Subscribe2 subscription options
 */
function my_post_types($types) {
    $types[] = 'zap';
    $types[] = 'job';
    $types[] = 'resume';
    return $types;
}

function my_taxonomy_types($taxonomies) {
    $taxonomies[] = 'crb_zap_tax';
    $taxonomies[] = 'crb_job_tax';
    $taxonomies[] = 'crb_resume_tax';
    return $taxonomies;
}

function s2_social_links_off() {
    return array();
}

add_filter('s2_social_links', 's2_social_links_off');
add_filter('s2_post_types', 'my_post_types');
add_filter('s2_taxonomies', 'my_taxonomy_types');

 

Their subscription choices show up as they should on the form, and the subscriptions in the users profile appear assigned as they should be, but when the emails go out, people are getting them for terms to which they are not subscribed. For instance, we have 3 terms in the crb_zap_tax taxonomy, and users who are subscribed to only one still get an email for posts assigned to other two (and posts are never assigned to multiple terms).

June 3, 2017
10:41 am
Avatar
Matthew Robinson
UK
Admin
Forum Posts: 443
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 30, 2017
3:25 pm
Avatar
silverback
Member
Subscribe2
Forum Posts: 9
Member Since:
January 13, 2016
sp_UserOfflineSmall Offline

Sorry for the delay, I don’t get email notifications for responses, so I forget to come check until I circle back to work on this issue.

{CATS} results in nothing, the $post_cat_names field is blank. I believe the problem is that we’re using Gravity Forms to allow site members to submit posts via the frontend, and the taxonomy is not associated with the post until after the email is generated and sent (as far as I can tell).

Looking back through the functions.php file, I recall this was added to ensure the subject included the type of “zap”, and you can see it check for both a form value OR a value for the custom taxonomy. It’s been a minute, but I recall having to do this because zap CPTs created in the admin interface were fine (I believe, it’s been a while), but zaps created from the frontend form were having the custom keyword replaced with nothing (as there was not, at this point in the post creation process, any value attached to the post for the custom taxonomy — that much I definitely remember).

========================================================
function add_subscribe2_zaps_category ( $string ) {
   global $mysubscribe2;

   $zapType = '';

   switch ( get_post_type( $mysubscribe2->post_id ) ) {
      case 'zap' :
            $zap_category_form = $_POST['input_12'];
            $zap_categories_post = wp_get_post_terms($mysubscribe2->post_id, 'crb_zap_tax');
            $zap_category_post = $zap_categories_post[0]->name;

            if ( '38' === $zap_category_form || 'Ad' === $zap_category_post )
             $zapType = 'Ad';
            elseif ( '39' === $zap_category_form || 'Cable' === $zap_category_post )
                $zapType = 'Cable';
            elseif ( '37' === $zap_category_form || 'Member' === $zap_category_post )
                $zapType = 'Member';
         break;
      case 'resume' :
         $zapType = 'Resume';
         break;
      case 'job' :
         $zapType = 'Job';
         break;
      default :
         $zapType = 'New';
   }

   return str_replace( "{ZAP_CAT}", $zapType, $string );
}
add_filter( 's2_custom_keywords', 'add_subscribe2_zaps_category' );
====================================================

If this code is executed prior to the post’s taxonomy being saved as post meta, though, then I’m wondering how anybody gets any emails, since no subscribers subscription options should match the custom taxonomy values of ad/cable/member, but it seems if anybody is subscribed, to any, they’re getting them all.
July 1, 2017
4:25 pm
Avatar
Matthew Robinson
UK
Admin
Forum Posts: 443
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 20, 2017
6:02 pm
Avatar
silverback
Member
Subscribe2
Forum Posts: 9
Member Since:
January 13, 2016
sp_UserOfflineSmall Offline

You’re gonna love this.

So, I actually edited a core plugin file to add the post_id variable, because the $post global is the page containing the Gravity Form we’re using to let members submit the Zap post type. By adding it in the S2HTML file, I can actually access the correct post ID for the Zap post. Otherwise, so far as I can tell, it is invisible to me at this point.

And I’m only getting terms for the Zap type, because the other two don’t have any taxonomies. They’re just resumes or jobs, whereas Zaps have the 3 different kinds (ad, cable, member).

July 21, 2017
1:49 pm
Avatar
Matthew Robinson
UK
Admin
Forum Posts: 443
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:
14 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Member Stats:

Guest Posters: 35

Members: 18944

Moderators: 0

Admins: 8

Forum Stats:

Groups: 4

Forums: 28

Topics: 1823

Posts: 7738

Newest Members:

Harte Londo

Administrators: Michael TorbertPeter BayliesSupport TeamSteve MortiboyMatthew RobinsonSteve KlasenArnaud BroesAsh R

[i]
[i]
Skip to toolbar