• Resolved ikookmaar

    (@ikookmaar)


    Hi Franky and fellow Evneters,

    Sorry if this is a bit off topic, but I am trying to display an eventlist in a Mailpoet Newsletterfollowing https://support.mailpoet.com/knowledgebase/hook-to-add-your-own-shortcode/.
    The examples (my_name and blog_name) display fine, but the Events Made Easy event list displays to the upperleft corner of my browser window in a preview of the newsletter, instead of to the content of the newsletter.
    Also if I send an example of the newsletter it pops up a message like “Request error Not JSON ….”.

    Here’s the modified example code I put in function.php:

    /**
     * This is an example of a custom shortcode parser for MailPoet newsletters.
     * It's really easy to implement.
     * We already automatically parse all shortcodes with this notation for you: [custom:my_value]
     * You just have to add a filter and return the value you prefer.
     * In the following example we added [custom:my_name] and [custom:blog_name] to our newsletter.
     * We have now to return the preferred values, as string.
     */
    // [custom:my_name]
    // [custom:blog_name]
    function mailpoet_shortcodes_custom_filter( $tag_value , $user_id) {
    
        // $tag_value contains the string after custom:
        // This function will be called the first time with $tag_value = my_name
        // The second time with $tag_value = blog_name
    
        // $user_id contains the corresponding MailPoet's subscriber id,
        // this could be useful to fetch extra data from the WordPress user's meta for instance
        // e.g.: https://gist.github.com/benheu/cf9eb925b0e17e6dbd6c
    
    	if ($tag_value === 'my_name') {
            $replacement = 'Maily';
        }
    
        if ($tag_value === 'blog_name') {
            $replacement = get_bloginfo('name');
        }
    
       	if ($tag_value === 'eme_events') {
            		$replacement = eme_get_events_list('limit=10');
    	}
    
        return $replacement;
    
    }
    add_filter('wysija_shortcodes', 'mailpoet_shortcodes_custom_filter',10 ,2);

    `

    Any help is most welcome…

    Peter

    https://www.ads-software.com/plugins/events-made-easy/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Franky

    (@liedekef)

    I’ve read their doc a bit, but it’s not very clear. Maybe only simple strings are to be returned, are the replacement should be encoded in some way. The eme call yoiu use returns html, maybe that is not allowed. You should ask for that info on their forum.

    Thread Starter ikookmaar

    (@ikookmaar)

    Thanks Franky, I’ll ask there…

    Plugin Author Franky

    (@liedekef)

    Of course if you/they think there is a bug in eme concerning this, just let me know.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘display eventlist in Mailpoet Newsletters’ is closed to new replies.