Support » Plugin: BuddyPress Group Email Subscription » strip shortcodes in email body content

  • I’m using this plugin in conjunction with 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='' title='BBC - Home' image='']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)
  • 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


    @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)
  • You must be logged in to reply to this topic.