Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
05/06/2018 10:47:08 AM (8 years ago)
Author:
imath
Message:

BP Nouveau: restrict the allowed HTML tags for Messages.

BP Nouveau is using the WP Editor to improve the user experience of the Messages component when people are writing a new message or replying to a thread. So far allowed HTML tags for the messages content *when BP Nouveau is the active template pack* were the same than WordPress Posts. When BP Nouveau is not the active template pack, the allowed tags are those of the WordPress global .

This commit is introducing a new function that is used to filter the allowed HTML tags for activity content and message content. It extends the with new tags (img, span, ul, ol & li) and leaves specific functions to the 2 components to include filters so that it is possible to restrict/extend allowed HTML tags for both content types or one of them. It also restricts the WP Editor available buttons when used into the BP Nouveau Messages UI so that they are consistent with the allowed HTML tags.

Props DJPaul

Fixes #7795

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-templates/bp-nouveau/includes/messages/loader.php

    r11899 r12067  
    103103                // Messages
    104104                add_filter( 'bp_messages_admin_nav', 'bp_nouveau_messages_adjust_admin_nav', 10, 1 );
    105 
    106                 remove_filter( 'messages_notice_message_before_save', 'wp_filter_kses', 1 );
    107                 remove_filter( 'messages_message_content_before_save', 'wp_filter_kses', 1 );
    108                 remove_filter( 'bp_get_the_thread_message_content', 'wp_filter_kses', 1 );
    109 
    110                 add_filter( 'messages_notice_message_before_save', 'wp_filter_post_kses', 1 );
    111                 add_filter( 'messages_message_content_before_save', 'wp_filter_post_kses', 1 );
    112                 add_filter( 'bp_get_the_thread_message_content', 'wp_filter_post_kses', 1 );
    113                 add_filter( 'bp_get_message_thread_content', 'wp_filter_post_kses', 1 );
    114                 add_filter( 'bp_get_message_thread_content', 'wptexturize' );
    115                 add_filter( 'bp_get_message_thread_content', 'stripslashes_deep', 1 );
    116                 add_filter( 'bp_get_message_thread_content', 'convert_smilies', 2 );
    117                 add_filter( 'bp_get_message_thread_content', 'convert_chars' );
    118                 add_filter( 'bp_get_message_thread_content', 'make_clickable', 9 );
    119                 add_filter( 'bp_get_message_thread_content', 'wpautop' );
    120105        }
    121106}
Note: See TracChangeset for help on using the changeset viewer.