Support » Plugin: Subscribe2 » Does not publish posts from status update post type

  • Resolved gkhairallah



    I’ve been looking for a subscribe plugin for a while, and subscribe2 really fit the bill, and it’s working perfectly.
    Here’s my problem though, I have a wordpress instance which I’m using internally for publishing system status updates, using the Service Status plugin:

    I’m not too well versed with PHP or the WordPress codex to be able to decipher what’s going on here, but, the status update plugin creates a new post type in the left pane on the admin navigation bar. (i.e: there is the Pages –> All Pages / Add New / , Posts –> All Posts / Add New / Categories / Tags, and there is a new one now Service Status –> Service Status / Add New / Products.

    The notifications get sent when creating a page and/or a post, but not when I create a new status, which is the most important part in my case.

    My question: Is there a way I can enable Subscribe2 to send messages when I make updates to that post type?

    (fyi I have a custom archive-service-status.php , and single-service-status.php)

    I’m afraid that this may not be possible from within existing settings, but if someone would be so kind as to help with enabling the notifications on the new post type. (I’m comfortable navigating the php code).

    Thank you much!

Viewing 7 replies - 1 through 7 (of 7 total)
  • Just so I’m not asking the question and not doing any work … 🙂 .. I tried to look up some info. and I found 2 piece of information that may be helpful.
    In my Service Status plugin, there is a “service-status.class.php”, in which I found this code:

    public function init() {
            public function admin_init() {
                    add_meta_box("service-status-meta", "Status", array( &$this, 'post_status' ), $this->options->post_type, "side", "low");
            private function register_post_type() {
                    $supports = array('title','editor');
                    if( $this->options->comments ) {
                            array_push( $supports, 'comments' );
                    register_post_type( $this->options->post_type,
                                    'labels'=> array(
                                            'name'=>__('Service Status'),
                                            'singular_name'=> __('Service Status update'),
                                            'add_new_item'=>__('Add new service status update'),
                                            'edit_item' => __('Edit status update'),
                                    'supports'=> $supports

    Also, I looked up some info about integrating subscribe2 into the custom post types, and I found this:

    and an example of adding code:

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

    At this point though, I’m not sure sure what changes to make in this example, and where to place this code. I figure with these 2 additional details, someone with more php and WP codex knowledge could easily help with this.

    Thanks again,

    @ gkhairallah,

    The custom post type registered by the Service Status plugin seems to be ‘service-status’ so in the latter piece of code you’ve already found you need to change ‘my_post_type’ to ‘service-status’ , like this.

    function my_post_types($types) {
    	$types[] = 'service-status';
    	return $types;
    add_filter('s2_post_types', 'my_post_types');

    It should then work if you place this code into a plugin file and activate it on your blog.

    Excellent @mattyrob. That did it. the only thing that’s still missing, which I suspect you figured was going to be my next question, and that is the Subscribe2 Notification Override section.
    Again, I did my research, and found a standalone plugin you wrote for the AI1EC Subscribe2 plugin, though it looks like this was specifically written for the AI1EC plugin, so when I try to activate the plugin I get this:

    Fatal error: Cannot redeclare my_post_types() (previously declared in /opt/wordpress/wp-content/plugins/service-status/includes/service-status.class.php:132) in /opt/wordpress/wp-content/plugins/AI1EC-Subscribe2/my_post_types.php on line 16

    (which I guess, is to be expected).

    Is there a way to modify that plugin to work with the status-update plugin? or even just modify the PHP code on the Subscribe2 plugin to make that section show up?

    Either method would work, which ever is easier…

    Thanks again for your help. you’re awesome!


    If you are already running another instance of the same (or very similar) code you’ll get this. It basically because you are using the exact same function name for both instances, so change one from my_post_types() to my_post_types2() or whatever.

    Excellent. Thank you very much Matt. I actually had to make additional changes to refer to the plugin in question, and also, I realized that the only reason it was happening, was because I wasn’t supposed to implement the original change you suggested along with the AI2EC plugin. So I undid the original one, and modified this one, and now it’s all working.

    Below is the code that now works out-of-the-box with the Service-Status plugin.

    Plugin Name: Service Status Filters & Notification Override
    Plugin URI:
    Description: Adds Service Status custom post type and taxonomy to Subscribe2, and enables notification override box on event authoring pages.
    Version: 1.0
    Author: Matthew Robinson / modified by Georges Khairallah
    // Allows Subscribe2 to recognize and publish
    // the service status custom post types.
    function my_post_types($types) {
            $types[] = 'service-status';
            return $types;
    function my_taxonomy_types($taxonomies) {
            $taxonomies[] = 'products';
            $taxonomiez[] = 'service-status';
            return $taxonomies;
    // Adds the "Subscribe2 Notification Override" button to each
    // systemstatus custom post type authoring page.
    function my_meta_types() {
            global $mysubscribe2;
            add_meta_box('subscribe2', 'Subscribe2 Notification Override', array(&$mysubscribe2, 's2_meta_box'), 'service-status','advanced');
    add_action('admin_menu', 'my_meta_types');

    Thanks again for your help,

    Much appreciated!!

    @ Georges,

    That code looks fine but I’ve spotted one typo. In the taxonomy types function on one line you are using the $taxonomies variable but on the next it’s $taxonomiez. The variable name really needs to be the same on both lines.

    Oops. Thanks for the heads up Matt. I fixed the typo 🙂

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Does not publish posts from status update post type’ is closed to new replies.