• I’m using this plugin in conjunction with BuddyPress Activity Plus

    https://en-gb.www.ads-software.com/plugins/buddypress-activity-plus/ .

    This adds several options for adding content (image, video or link) to buddypress activities via shortcodes.

    In the group notification emails that come through when someone posts, it displays the shortcode and in most cases the shortcode breaks the link to the image or video.

    Something like this:

    John Smith posted an update in the group test group:
    
    testing a link post
    
    [bpfb_link url='https://www.bbc.co.uk' title='BBC - Home' image='https://www.bbc.co.uk///homepage.files.bbci.co.uk/s/homepage-v5/5-2-1-90-47c143b28/images/bbc_homepage.png']The best of the BBC, with the latest news and sport headlines, weather, TV & radio highlights and much more from across the whole of BBC Online[/bpfb_link]
    
    –
    Go to the discussion to reply or catch up on the conversation.
    Your email setting for this group is: All Email

    I’ve tried implementing this filter which I stumbled across with no luck:

    function strip_shortcodes_from_notification_message( $message, $args ){
    	return strip_shortcodes($message);
    }
    add_filter( 'bp_ass_activity_notification_message', 'strip_shortcodes_from_notification_message', 10, 2 );

    Can someone point me in the right direction to strip out shortcodes from email notifications?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter magland

    (@magland)

    Just found that this code in my functions appears to work:

    add_filter( 'ass_clean_content', 'strip_shortcodes', 10 );

    If anyone has any better suggestions let me know.

    Ideally I’d like to remove the shortcode block from the email but leave the link / video or image in the email.

    Plugin Author Boone Gorges

    (@boonebgorges)

    @magland Thanks for sharing your approach. This is probably a decent thing to add to BPGES itself.

    If you want to replace the shortcode with the URL, I’m afraid that’s a pretty custom thing that you’d have to write yourself. Some sort of regular expression that looks for [bpfb_link url="([^"]+)".

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘strip shortcodes in email body content’ is closed to new replies.