• I have a custom post type of “monthly bulletin” that I need to send to subscribers.
    I’ve added the code below into my functions.php file, and tested it by publishing a new bulletin, but the email notification doesn’t come through.

    Any ideas on what I am missing?

    function my_post_types($types) {
        $types[] = 'monthlybulletin';
        return $types;
    }
    add_filter('s2_post_types', 'monthlybulletin');

    I’ve tested the plugin with a standard post and that works fine.

    Thanks in advance.

    https://www.ads-software.com/plugins/subscribe2/

Viewing 15 replies - 1 through 15 (of 34 total)
  • @auk

    On the add_filter() first item inside the brackets is the hook you are linking to and the second part is the name of the function you are hooking. In the case you’ve change that to the name of your custom post type rather than the function that is called to register the custom post type.

    Change that to the function name or rename the function and it should work.

    Hi,

    This is mine. It works. my post type name is ‘job’

    // add job post type to subscribe2
    function jobs($types) {
    $types[] = ‘job’;
    return $types;
    }

    add_filter(‘s2_post_types’, ‘jobs’);

    Oh, well, how can I actually see that this is working? It is unfortunately not showing custom taxonomies of those post types, so I cannot configure it to shoot when a post in a specific category of a custom post type is being published.

    @physalis

    Once correctly registered a custom post type will be displayed on the Subscribe2->Settings page in the first ran. Once a taxonomy is registered you should see the names listed in the Registered Users tab or in your own Your Subscriptions page.

    Hi @mattyrob,

    thanks for your quick reply :). However, unfortunately I cannot see these taxonomy terms anywhere, but the custom post type I need to use the taxonomy with is showing on the settings page directly. However, none of the taxonomy terms show up in the general settings, Registered user and my own settings, weird. Does the taxonomy have some kind of a special name?

    However, on a side note, I have another custom post type which I had built myself through functions.php that isn’t showing at all on the settings page. What requirements does a CPT have in order to show up in your settings (I don’t need notifications for that, but maybe it is connected somehow)?

    @physalis

    CPT and taxonomies don’t need any special characteristics. They just need registering in Subscribe2. Have you done that? Can you post your code?

    Oh wait, yes, I registered the post type, though not its taxonomies. Should I do that as well? Didn’t find anything for taxonomies…

    @physalis

    Yes, you need to register both. The API is documented here:
    https://subscribe2.wordpress.com/support/api/

    You’ll need the ‘s2_taxonomies’ filter hook.

    Aaaaah, well, thank you so much, THAT worked fine. I can finally see the terms on each user’s subscribe settings. However, maybe I am still doing something wrong:

    a) If I use the original settings of the plugin, the frontend submissions create ‘pending’ posts, and Subscribe2 ignores them. Notifications only get triggered when I set them to publish immediately. Is there any screw I can turn to make it recognise pending posts that are coming from the frontend?

    b) I have set up two users to one example term each (categories), i.e. user1 gets notified on a new post in category1, user2 gets notified on a new post in category2. However, when I post to either category, both users get equally notified, i.e. it does seem to ignore which one of the taxonomies the user is subscribed to. May I just miss something here?

    Thanks again,

    physalis

    @physalis

    For the first issue you need to use the ‘s2_post_statuses’ hook to tell Subscribe2 to act on posts made to the pending status.

    The second issue I’m not sure I can explain. It may be down to the way the COT and taxonomy are created. They need to have a heirarchy.

    Hi @mattyrob,

    thanks a ton again.

    You just found what seems to be the problem – the post type has a non-hierarchical, thus tag-based taxonomy even though they call it category. The funny thing is that they even have a separate taxonomy for tags.

    Well well, is there a way to include a non-hierarchical taxonomy to trigger notifications?

    Hi @mattyrob again,

    sorry to bother you again, but maybe I got that wrong for a bit? I put up

    function my_post_statuses($statuses) {
        $types[] = 'pending';
        return $statuses;
    }
    add_filter('s2_post_types', 'my_post_statuses');

    into my functions.php in order to have it listen to posts that are being created as pending from the Q&A plugin. Would that be right if the posts are being created in a normal fashion? It’s the standard pending status that is being applied, and when I disable the pending feature for new posts, notifications go to everyone that subscribed to ANY of the taxonomy terms.

Viewing 15 replies - 1 through 15 (of 34 total)
  • The topic ‘Using with Custom Post Type’ is closed to new replies.