Making WordPress.org

Changeset 9824


Ignore:
Timestamp:
05/05/2020 01:52:18 AM (6 years ago)
Author:
dd32
Message:

Profiles: When notifing profiles.wordpress.org of activity, strip tags and shortcodes from the title and content.

Additionally, remove support forum replies/topics from the activity feeds when they're Archived.

See #2408.
Fixes #3162, #5194.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-profiles-wp-activity-notifier/wporg-profiles-wp-activity-notifier.php

    r6265 r9824  
    4545                add_action( 'bbp_approved_topic',        array( $this, 'notify_forum_new_topic' )                   );
    4646                add_action( 'bbp_unapproved_topic',      array( $this, 'notify_forum_remove_topic' )                );
     47                add_action( 'wporg_bbp_archived_topic',  array( $this, 'notify_forum_remove_topic' )                );
    4748
    4849                // bbPress 2.x reply support
     
    5455                add_action( 'bbp_trashed_reply',         array( $this, 'notify_forum_remove_reply' )                );
    5556                add_action( 'bbp_untrashed_reply',       array( $this, 'notify_forum_new_reply' )                   );
     57                add_action( 'wporg_bbp_archived_reply',  array( $this, 'notify_forum_remove_reply' )                );
    5658        }
    5759
     
    132134
    133135                $content = wp_trim_words(
    134                         ( has_excerpt( $post ) ? $post->post_excerpt : $post->post_content ),
     136                        strip_shortcodes( has_excerpt( $post ) ? $post->post_excerpt : $post->post_content ),
    135137                        55
    136138                );
     
    263265                                'topic_id'  => $topic_id,
    264266                                'forum_id'  => bbp_get_topic_forum_id( $topic_id ),
    265                                 'title'     => bbp_get_topic_title( $topic_id ),
     267                                'title'     => strip_tags( bbp_get_topic_title( $topic_id ) ),
    266268                                'url'       => bbp_get_topic_permalink( $topic_id ),
    267269                                'message'   => bbp_get_topic_excerpt( $topic_id, 55 ),
     
    331333                                'topic_id'  => bbp_get_reply_topic_id( $reply_id ),
    332334                                'forum_id'  => bbp_get_reply_forum_id( $reply_id ),
    333                                 'title'     => bbp_get_reply_topic_title( $reply_id ) ,
     335                                'title'     => strip_tags( bbp_get_reply_topic_title( $reply_id ) ),
    334336                                'url'       => bbp_get_reply_url( $reply_id ),
    335337                                'message'   => $this->get_reply_excerpt( $reply_id, 15 ),
     
    401403
    402404                // Strip tags and surrounding whitespace.
    403                 $text = trim ( strip_tags( $text ) );
     405                $text = trim( strip_tags( $text ) );
     406
     407                // Strip shortcodes.
     408                if ( function_exists( 'strip_shortcodes' ) ) {
     409                        $text = strip_shortcodes( $text );
     410                }
    404411
    405412                // If trimming by chars, behave like a more multibyte-aware
Note: See TracChangeset for help on using the changeset viewer.