• Resolved Erling

    (@erling)


    Thanks for a nice plugin. We love it on the page I’m administering (https://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.

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

Viewing 15 replies - 1 through 15 (of 19 total)
  • @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.

    Thread Starter Erling

    (@erling)

    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

    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’);

    Thread Starter Erling

    (@erling)

    Thank you so much.
    It works !!

    Thread Starter Erling

    (@erling)

    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?

    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! ??

    Thread Starter Erling

    (@erling)

    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?

    @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.

    Andrew

    (@rhdri)

    @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!

    @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.

    @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');

    @rhdri,

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

    Andrew

    (@rhdri)

    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: https://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: https://screencast.com/t/Y3NhCJ4KB5 & https://screencast.com/t/K3vfft4SUbxJ | url: https://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

    Andrew

    (@rhdri)

    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.

    @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.

Viewing 15 replies - 1 through 15 (of 19 total)
  • The topic ‘[Plugin: Subscribe2] Subscribe from events’ is closed to new replies.