WordPress.org

Ready to get started?Download WordPress

Forums

Subscribe2
[resolved] Subscribe from events (20 posts)

  1. Erling
    Member
    Posted 2 years ago #

    Thanks for a nice plugin. We love it on the page I'm administering (http://ishojvolley.dk).
    We also use Events Manager - and a wish could be that the subscriber not only get news when we have new posts and pages, but also new events. In other words: That the 'Subscribe2' can pick from the events-database also.
    I know this is future - but nevertheless, now I have said it - and this feature would no doubt make 'Subscribe2' the second to none
    choice for many thousands.
    Best regards from Denmark.

    http://wordpress.org/extend/plugins/subscribe2/

  2. mattyrob
    Member
    Posted 2 years ago #

    @Erling,

    Currently it seems that Events Manager uses a custom database table and they are in the process of implementing and API to allow plugin extension.

    Once this is firmed up, what you are asking for may well be possible.

  3. Erling
    Member
    Posted 2 years ago #

    Back to the issue: Now the plugin "Events Manager" is released in a new version 5.0. I installed and it's working fine. The big news is that events are treated like custom WP posts.
    Does that give the possibilities we where talking about above?
    Best regards
    Erling

  4. basememara
    Member
    Posted 2 years ago #

    Yes, it works with Events Manager 5+. In your theme's function add this:

    /**
    * Custom post type for Subscribe2
    */
    function custom_s2_post_types($types) {
    $types[] = 'event';
    return $types;
    }
    add_filter('s2_post_types', 'custom_s2_post_types');

  5. Erling
    Member
    Posted 2 years ago #

    Thank you so much.
    It works !!

  6. Erling
    Member
    Posted 2 years ago #

    Although there is a problem: For a normal post I have the possibility to uncheck that news are sent out for this post.
    I miss this possibility for the event - that I can shoose NOT to create news for posting an event.
    Do you have any suggestions?

  7. basememara
    Member
    Posted 2 years ago #

    I miss that function as well :( Maybe we have to manually add the custom field for the custom post type? I am not sure, but I am really hoping Subscribe2 has better integration with custom post types. I would expect to enter a comma-delimited list of custom post types from the settings section of Subscribe2 instead of hacking a php file. Also subscribers should be able to choose which post type they want to subscribe to.

    If anyone has a solution for excluding custom post types with a checkmark, please let us know! :)

  8. Erling
    Member
    Posted 2 years ago #

    I just realized that when I added the above code in the functions.php-file it sends out only the event, not the new post. While we are waiting for at better plugin, do you have a good advice to get the subscribe2 to pick BOTH a new Event AND a nem post for the list to be send out?

  9. mattyrob
    Member
    Posted 2 years ago #

    @Erling & @basememara,

    In order to add the custom field box to override post notification you have to know the slug name of the added page. It's the fourth parameter passes to the add_meta_box() function.

    For that reason it would be easier to extend the Events plugin to call the Subscribe2 code rather than the other way around. Either that or write your own custom plugin that adds the code to the Events page once you've found the slug name.

    @Erling,

    If notifications for new posts are not sending check all of your settings and make sure you are not blocking them for some reason (like and excluded category for example). Try disabling the custom post code and see if it works without it too as I can't think why that code would stop it working.

  10. Andrew
    Member
    Posted 1 year ago #

    @mattryrob

    For that reason it would be easier to extend the Events plugin to call the Subscribe2 code rather than the other way around. Either that or write your own custom plugin that adds the code to the Events page once you've found the slug name.

    Do you have any suggestions for how I can accomplish this? I added the following code to subscribe2.php

    function my_post_types($types) {
            $types[] = 'ai1ec_event';
            return $types;
    }
    add_filter('s2_post_types','my_post_types');
    function my_taxonomy_types($taxonomies) {
    $taxonomies[] = 'events_tags';
    $taxonomies[] = 'events_categories';
    return $taxonomies;
    }
    add_filter('s2_taxonomies','my_taxonomy_types');

    but it did not replicate the "Subscribe2 Notification Override" box on each new event page, like there is on normal posts.

    Thanks!

  11. mattyrob
    Member
    Posted 1 year ago #

    @rhdri,

    To add that box would need some more code using to add the meta box. I'll have a look and see if I can figure out what you need.

  12. mattyrob
    Member
    Posted 1 year ago #

    @rhdri,

    Add the following function to the filter code for Subscribe2 and the meta box should appear on the page. Note I have not tested this code so although the meta box is present I'm not certain that the checkbox will be obeyed.

    function my_meta_types() {
    	global $mysubscribe2;
    	add_meta_box('subscribe2', 'Subscribe2 Notification Override', array(&$mysubscribe2, 's2_meta_box'), 'edit-ai1ec_event', 'advanced');
    	add_meta_box('subscribe2', 'Subscribe2 Notification Override', array(&$mysubscribe2, 's2_meta_box'), 'ai1ec_event', 'advanced');
    }
    add_action('admin_menu', 'my_meta_types');
  13. mattyrob
    Member
    Posted 1 year ago #

    @rhdri,

    I've just tested that code and it works for me.

  14. Andrew
    Member
    Posted 1 year ago #

    It's a christmas miracle!!!!!!! @mattyrob I could kiss you!

    Seriously, works like a charrrrm. Tested and re-tested and just perfect. I wish there was a "kudos" or "thanks" button to bump your virtual status. I'm only slightly worried that I will lose some or all of this work when I update the Subscribe2 plugin. I know I can make backups/duplicates and re-paste them into the new files, but that's not ideal. I've made changes now to subscribe2.php (adding custom post type notifications and enabling override box), class-s2-core.php (changing the email signup message), and class-s2-admin.php (changing the override box text). I went back to the mini-plugin idea you suggested and tried this code out:

    <?php
    /*
    Plugin Name: Subscribe2 AI1EC Filters & Notification Override Box
    Plugin URI: http://subscribe2.wordpress.com
    Description: Adds AI1EC custom post type and taxonomy to Subscribe2, and enables notification override box on event authoring pages.
    Version: 1.0
    Author: Matthew Robinson
    */
    
    // Allows Subscribe2 to recognize and publish
    // the all-in-one-events-calendar custom post types.
    
    function my_post_types($types) {
            $types[] = 'ai1ec_event';
            return $types;
    }
    add_filter('s2_post_types','my_post_types');
    function my_taxonomy_types($taxonomies) {
    	$taxonomies[] = 'events_tags';
    	$taxonomies[] = 'events_categories';
    	return $taxonomies;
    }
    add_filter('s2_taxonomies','my_taxonomy_types');
    
    // Adds the "Subscribe2 Notification Override" button to each
    // all-in-one-events-calendar custom post type editor page.
    
    function my_meta_types() {
    	global $mysubscribe2;
    	add_meta_box('subscribe2', 'Subscribe2 Newsletter Notification Override', array(&$mysubscribe2, 's2_meta_box'), 'edit-ai1ec_event', 'advanced');
    	add_meta_box('subscribe2', 'Subscribe2 Newsletter Notification Override', array(&$mysubscribe2, 's2_meta_box'), 'ai1ec_event', 'advanced');
    }
    add_action('admin_menu', 'my_meta_types');
    
    ?>

    I pasted this code inside the file called my_post_types.php located at /wp-content/plugins/AI1EC-Subscribe2 and then activated the plugin. The override box was there, it worked (sent an email when it was supposed to and suppressed it when it was supposed to)! BUT, after clicking on either "Update" or "Publish," the event page reloads to a completely blank page at wp-admin/post.php. If I navigate to the event in the backend (it's still in my list events, and on my calendar), sometimes it takes me to a blank page, but usually I can get there at the correct address: wp-admin/post.php?post=539&action=edit. So everything has been saved and updated properly in the event, but it's not auto-reloading/refreshing the page back to the newest edited version after I click Publish or Update. This didn't happen when the code was just plopped into the subscribe2.php file, but having a separate mini-plugin that could withstand upgrades would be soooo much more convenient! Any ideas why this is happening or how to fix it?

    Beyond that (which is more of an inconvenience than a terribly important issue), all that's left for me is figuring out how to populate the "Event" categories into the normal "Post" categories, so I can add them to home page. I know there is a checkbox in the calendar settings that is supposed to accomplish this, but it's not working for me for some reason. I disabled all my plugins temporarily to check for conflicts, but that didn't help.

    What I have now is a theme-options.php file that is displaying a backend options page where I can choose which category of posts are featured in which areas of my front page (screenshots: http://screencast.com/t/Y3NhCJ4KB5 & http://screencast.com/t/K3vfft4SUbxJ | url: http://pennlpssa.org).

    I was previously using ordinary posts for my events, but now I would like to use AI1EC events instead. But I'm not sure how to populate those event categories in that backend option page. The code being used now, to retrieve normal post categories, is as follows:

    <?php wp_dropdown_categories(array('selected' => ot_option('hp_mid_cat'), 'name' => $settings.'[hp_mid_cat]', 'orderby' => 'Name' , 'hierarchical' => 1, 'show_option_all' => __("All Categories", 'organicthemes'), 'hide_empty' => '0' )); ?></p>

    Should I be able to do a query posts or categories with the custom post type here, instead of the current code? I don't need to list all the post categories and event categories in one dropdown—one or the other would work fine.

    Thanks again!!

    Andrew

  15. Andrew
    Member
    Posted 1 year ago #

    I just turned off the mini-plugin, put its code back into subscribe2.php and tried editing the event again. After I pressed update, it took me to this URL: wp-admin/post.php?post=539&action=edit&message=10&doing_wp_cron=1350839084.5872418880462646484375.

    When I was using the mini-plugin, pressing update or publish would reload the page to either:
    1. wp-admin/post.php?
    or
    2. wp-admin/post.php?post=539&action=edit

    So it looks like the url was missing a bunch more stuff that was necessary for it to reload properly.

  16. mattyrob
    Member
    Posted 1 year ago #

    @Ansrew / rhdri,

    I'm using identical standalone code to you (with the exception of the plugin header) with version 8.5 of Subscribe2 and version 1.8.3-premium of All-in-One Event Calendar by Timely.

    I am so far unable to reproduce any white screens or error messages.

  17. Andrew
    Member
    Posted 1 year ago #

    @mattyrob

    When I tried the reactivating the plugin again (after removing the same code from subscribe2.php), I got this message on my plugin admin page:

    The plugin generated 2 characters of unexpected output during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.

    I'm using the same versions as you, but continue to get the same weird white screen issues. I even get them on other pages and using other functions, like after I move an event to the trash or even after deactivating a plugin. Sometimes just refreshing will do the trick to fix the white screen, but it's buggy for sure, on the front and backend (only when using the code via plugin).

    Maybe in future iterations of Subscribe2 there could be a settings box where you could enter custom post type names directly, i.e. where it currently reads "Subscribe2 will send email notifications for the following custom post types: Ai1ec_event" If I were able to input the custom post type right there in the backend, that would be fantastic. And if it would automatically add the notification override to whatever custom post types are added, that would be even better.

    I did, however, figure out how to get my custom post type categories to be available in the featured content drop down menus of the theme options page:

    It used to be:

    <?php wp_dropdown_categories(array(
    					'selected' => ot_option('hp_mid_cat'),
    					'name' => $settings.'[hp_mid_cat]',
    					'orderby' => 'Name' ,
    					'hierarchical' => 1,
    					'show_option_all' => __("All Categories",
    					'organicthemes'), 'hide_empty' => '0'
    )); ?></p>

    Now it's:

    <?php 
    
    					$taxonomy     = 'events_categories';
    					$orderby      = 'name';
    					$show_count   = 1;      // 1 for yes, 0 for no
    					$pad_counts   = 0;      // 1 for yes, 0 for no
    					$hierarchical = 1;      // 1 for yes, 0 for no
    					$title        = '';
    
    					wp_dropdown_categories(array(
    					  'taxonomy'     => $taxonomy,
    					  'orderby'      => $orderby,
    					  'show_count'   => $show_count,
    					  'hierarchical' => $hierarchical,
    					  'title_li'     => $title,
    					  'selected'     => ot_option('hp_side_cat'),
    					  'name'         => $settings.'[hp_side_cat]',
    					  'orderby'      => 'Name' ,
    					  'hierarchical' => 1,
    					  'show_option_all' => __("All Events", 'organicthemes'),
    					  'hide_empty' => '0' 
    
    				)); ?>
    				</p>

    That worked for me.

    Anyhow, thanks again for the spectacularly fast and effective help! And the awesome plugin.

    -Andrew

  18. mattyrob
    Member
    Posted 1 year ago #

    @Andrew / rhdri,

    That error message you are/ were getting is usually down to white space in the plugin files before or after the opening or closing PHP tags. You need to carefully check your file syntax.

    I'll have a think about adding custom post types that way but there would have to be consideration also of custom taxonomies and also how to add meta boxes to any custom authoring pages. For these latter reasons I currently think a standalone plugin is the better way.

  19. Erling
    Member
    Posted 1 year ago #

    Dear @mattyrob and @rhdi
    I followed your interestering discussions in this thread that I started. For me - being only a skilled WP user/developer with limited selfmade php coding skills - the most was hard to understand. That's why I support the last suggestion: Hopefully someday somebody can bridge Events Manager and Subscribe2 with a standalone plugin. Thanks for contributing to the issue.
    Best regards
    Erling

  20. Andrew
    Member
    Posted 1 year ago #

    @mattyrob Huh! Look at that. There was in fact lots of random white space after the end of my PHP tag. I deleted that and now the plugin works perfectly. Brilliant!

    @Erling I can't help you with the Events Calendar plugin unfortunately—this is specific to the All-In-One Events Calendar plugin.

    But in case anyone else is looking for a similar fix and stumbles upon this thread, I'll share my (actually, @mattyrob's) solution in full:

    If you are using WordPress 3.4.2 and both the Subscribe2 plugin (version 8.5) and the All-In-One Event Calendar plugin (premium version 1.8.3), this handy little standalone plugin should do the following:
    1. Enable Subscribe2 to send email notifications for your all-in-one events the same way it normally does for posts.
    2. Enable the "Subscribe2 Notification Override" box to appear on all-in-one event authoring pages.

    Link to download the plugin:
    AI1EC-Subscribe2 Plugin

    How to install the plugin:
    1. Download the above zip file.
    2. Follow these directions to upload, install, and activate the zip file.
    3. You're good to go!

    Notes:
    - Check your "Screen Options" on any event authoring page to ensure that "Subscribe2 Notification Override" is checked.
    - Check your Subscribe2 > Settings page to verify correct plugin installation—the fourth line down should read: "Subscribe2 will send email notifications for the following custom post types: Ai1ec_event"
    - Under Subscribe2 > Settings > Appearance the last line reads "Disable email notifications is checked by default on authoring pages?" If you check this box, the Subscribe2 Notification Override box on each even authoring page will also be checked by default.

    CAVEATS: I can only verify that this plugin works for me—I haven't done any other testing, at all. I wouldn't even know how to properly test it if I wanted to.

    Hope this helps some other folks as well. And, if you download the plugin, don't forget to thank @mattryob for this awesome fix—and for the stellar Subscribe2 email notification plugin!

    -Andrew

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags