Support » Plugin: Subscribe2 - Form, Email Subscribers & Newsletters » [Plugin: Subscribe2] Notifications for customer events?

Viewing 15 replies - 1 through 15 (of 30 total)
  • @smithgt,

    Yes it is possible, you’ll need to register the custom post type in Subscribe2 as described here. The name of the custom post type seems to be ‘ai1ec_event’.

    You may also need to register some custom taxonomy types too, that’s covered here. The principle is very similar.

    @mattyrob,

    I just googled around to get an answer to my exact question as the one above. But.. I lost you somewhere at “register the custom post type” as I don’t have the slightest clue to where this can be added, and that also goes for the custom taxonomy (which I don’t even know what it means).

    Could you please explain?

    Thanks in advance and with kind regards,
    Martin

    Thread Starter smithgt

    (@smithgt)

    Thanks MattyRob,

    Silly question, but which PHP file am I to add the my_post_types to?

    subscribe2.php?

    (I’ve just upgraded to V8)

    @marblez / smithgt,

    Your best bet is to create your own plugin code placed in the wp-content/plugins/ folder that contains the filter code as linked above. If you add it to another plugin file you will lose this with every version update.

    Thread Starter smithgt

    (@smithgt)

    @mattyrob

    While I’m no IT novice, I am new to PHP and wordpress, so I’m a little unsure what I would need to include in a PHP file.

    From your FAQ I beleive that the event type my AI1EC is ‘ai1ec_event’, so this this script correct?

    /* Code to add post type for AI1EC to Subscribe2 */
    function my_post_types($types) {
    $types[] = ‘ai1ec_event’;
    return $types;
    }
    add_filter(‘s2_post_types’, ‘my_post_types’);

    And do I simply drop this in the root folder of /wp-content/plugins or does it need it its own sub folder? Do I have to do anything to activate/ run the code?

    @smithgt,

    That looks about right so far – wrap it in PHP tags and also include a plugin header. Reading here will point you along the right path.

    @mattyrob

    Thanks for your replies, but they aren’t making me any smarter 🙂

    If I would borrow the code smithgt made, and add the things you asked for (php tags), where, what and how would that look?

    What should the .php file be called? And, if I manage to get everything right – how would this line of code work? Would I get a new option in the subscribe2 settings?

    I’ve never written a single line of php code in my life, so that’s why I’m asking 🙁

    Thread Starter smithgt

    (@smithgt)

    @mattrob

    OK – I’ve read that and created this file

    <?php
    /*
    Plugin Name: AI1EC-Subscribe2
    Description: Add AI1EC to Subscribe2 notifications
    Version: 0.1
    Author: smithgt
    */
    ?>
    function my_post_types($types) {
    $types[] = ‘ai1ec_event’;
    return $types;
    }
    add_filter(‘s2_post_types’, ‘my_post_types’);

    It’s called my_post_types.php and I’ve uploaded it into my wordpress site into the folder /wp-content/plugins/AI1EC-Subscribe2

    It’s now listed under plugins – wow!
    If I activate it I see an error:

    The plugin generated 123 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.

    And when I add an event I get this error:

    function my_post_types($types) { $types[] = ‘ai1ec_event’; return $types; } add_filter(‘s2_post_types’, ‘my_post_types’);
    Warning: Cannot modify header information – headers already sent by (output started at /homepages/10/d83518211/htdocs/WordPress/testing/wp-content/plugins/AI1EC-Subscribe2/my_post_types.php:13) in /homepages/10/d83518211/htdocs/WordPress/testing/wp-includes/pluggable.php on line 866

    Now I’m a bit stuck 🙁

    @smithgt,

    So close – you’ve closed the PHP tag before your code – move the ‘?>’ to the last line of the file.

    Thread Starter smithgt

    (@smithgt)

    Ah 🙂

    Moved that to the end of the file and activation was ok this time around, but when I created a test event I get this error 🙁

    Fatal error: Uncaught exception ‘Ai1ec_Event_Not_Found’ with message ‘Event with ID ‘5752’ could not be retrieved from the database.’ in /homepages/10/d83518211/htdocs/WordPress/testing/wp-content/plugins/all-in-one-event-calendar/app/model/class-ai1ec-event.php:356 Stack trace: #0 /homepages/10/d83518211/htdocs/WordPress/testing/wp-content/plugins/all-in-one-event-calendar/app/helper/class-ai1ec-events-helper.php(63): Ai1ec_Event->__construct(5752, false) #1 /homepages/10/d83518211/htdocs/WordPress/testing/wp-content/plugins/all-in-one-event-calendar/app/controller/class-ai1ec-events-controller.php(491): Ai1ec_Events_Helper::get_event(5752) #2 [internal function]: Ai1ec_Events_Controller->event_content(‘<p>bbc</p>?’) #3 /homepages/10/d83518211/htdocs/WordPress/testing/wp-includes/plugin.php(170): call_user_func_array(Array, Array) #4 /homepages/10/d83518211/htdocs/WordPress/testing/wp-content/plugins/subscribe2/classes/class-s2-core.php(559): apply_filters(‘the_content’, ‘bbc’) #5 [internal function]: s2class->publish(Ob in /homepages/10/d83518211/htdocs/WordPress/testing/wp-content/plugins/all-in-one-event-calendar/app/model/class-ai1ec-event.php on line 356

    It must be something to do with the use of the post type “ai1ec_event” as if I change to something else then the error when posting an event doesnt appear.

    I’ve asked on the AE1EC forum for confirmation of the post type.

    Does the error mean anything useful to you?

    @smithgt,

    That doesn’t mean a great deal to me, it looks like a post with ID 5752 was pushed through that filter as it looked to Subscribe2 as though it was an event but the event plugin could not find it for some reason.

    I wonder if that because you also need to include the custom taxonomies in Subscribe2 as well. It would be additional filters added to your existing code as described here but you’ll have to ask for the taxonomy names or dig through the ai1ec code to find them.

    Thread Starter smithgt

    (@smithgt)

    @mattyrob

    I’ve found some possible taxonomy candidates – events_tags and events_categories

    So how do I add more than one taxonomy? The code below fails 🙁

    function my_taxonomy_types($taxonomies) {
    // where ‘my_taxonomy_type’ is the name of your custom taxonomy
    $taxonomies[] = ‘events_tags’,’events_categories’;
    return $taxonomies;
    }
    add_filter(‘s2_taxonomies’, ‘my_taxonomy_types’);

    @smithgt,

    Like this:

    $taxonomies[] = 'events_tags';
    $taxonomies[] = 'events_categories';
    return $taxonomies;

    Thread Starter smithgt

    (@smithgt)

    @mattyrob

    Thanks, but unfortunately that’s still not fixed the AE1EC errors 🙁

    Fatal error: Uncaught exception 'Ai1ec_Event_Not_Found' with message 'Event with ID '5778' could not be retrieved from the database.' in /homepages/10/d83518211/htdocs/WordPress/testing/wp-content/plugins/all-in-one-event-calendar/app/model/class-ai1ec-event.php:356 Stack trace: #0 /homepages/10/d83518211/htdocs/WordPress/testing/wp-content/plugins/all-in-one-event-calendar/app/helper/class-ai1ec-events-helper.php(63): Ai1ec_Event->__construct(5778, false) #1 /homepages/10/d83518211/htdocs/WordPress/testing/wp-content/plugins/all-in-one-event-calendar/app/controller/class-ai1ec-events-controller.php(491): Ai1ec_Events_Helper::get_event(5778) #2 [internal function]: Ai1ec_Events_Controller->event_content('<p>test b</p>?') #3 /homepages/10/d83518211/htdocs/WordPress/testing/wp-includes/plugin.php(170): call_user_func_array(Array, Array) #4 /homepages/10/d83518211/htdocs/WordPress/testing/wp-content/plugins/subscribe2/classes/class-s2-core.php(559): apply_filters('the_content', 'test b') #5 [internal function]: s2class->publ in /homepages/10/d83518211/htdocs/WordPress/testing/wp-content/plugins/all-in-one-event-calendar/app/model/class-ai1ec-event.php on line 356

    I’ve had a dig in the event plugin code, this is a thrown error code in one of the files.

    It seems to be saying that the event details are null.

    Now this might be because they are not collected at the time the filter code is called or perhaps they are nit yet created when the filter code is called. I’m not sure. I think it may be better to follow up with the event calendar author as they know their code better.

Viewing 15 replies - 1 through 15 (of 30 total)
  • The topic ‘[Plugin: Subscribe2] Notifications for customer events?’ is closed to new replies.