Support » Plugin: Royal PrettyPhoto » Code snippet for Buddypress activity

  • Thanks for the great plugin.

    You can also use it for Buddypress activity by simply adding the following in your custom.php file

    add_filter('bp_get_activity_content_body', 'royal_prettyphoto_replaceBuddypress');
    function royal_prettyphoto_replaceBuddypress($content) {
        $pattern = "/<a(.*?)href=('|\")([^>]*).(bmp|gif|jpeg|jpg|png)('|\")(.*?)>(.*?)<\/a>/i";
        $replacement = '<a$1href=$2$3.$4$5 rel="prettyPhoto[' . bp_get_activity_id() . ']"$6>$7</a>';
        $content = preg_replace($pattern, $replacement, $content);
        return $content;

    Bests Lena

  • The topic ‘Code snippet for Buddypress activity’ is closed to new replies.