Search Results for 'code'
-
Search Results
-
Hi, One of my users discovered that they can post potentially malicious HTML into the bbPress reply box.
I once added the code below to my functions.php file, because users were not able to use Left-align, Centre, and Right-align for text, but I fear maybe it’s now given too many HTML permissions.
Could anyone please look at this code and let me know if something needs to be changed (maybe some trues switched to falses)?
Thank you so much, Sam
add_filter( 'bbp_kses_allowed_tags', 'ntwb_bbpress_custom_kses_allowed_tags' ); function ntwb_bbpress_custom_kses_allowed_tags() { return array( // Links 'a' => array( 'class' => true, 'href' => true, 'title' => true, 'rel' => true, 'class' => true, 'target' => true, ), // Quotes 'blockquote' => array( 'cite' => true, ), // Div 'div' => array( 'class' => true, ), // Span 'span' => array( 'class' => true, 'style' => true, ), // Paragraph 'p' => array( 'class' => true, 'style' => true, ), // Code 'code' => array(), 'pre' => array( 'class' => true, ), // Formatting 'em' => array(), 'strong' => array(), 'del' => array( 'datetime' => true, ), // Lists 'ul' => array(), 'ol' => array( 'start' => true, ), 'li' => array(), // Images 'img' => array( 'class' => true, 'src' => true, 'border' => true, 'alt' => true, 'height' => true, 'width' => true, ), // Tables 'table' => array( 'align' => true, 'bgcolor' => true, 'border' => true, ), 'tbody' => array( 'align' => true, 'valign' => true, ), 'td' => array( 'align' => true, 'valign' => true, ), 'tfoot' => array( 'align' => true, 'valign' => true, ), 'th' => array( 'align' => true, 'valign' => true, ), 'thead' => array( 'align' => true, 'valign' => true, ), 'tr' => array( 'align' => true, 'valign' => true, ) ); }
When I try to access mysite.com/forums it does not work with my theme so I copied archive-forum.php to my child theme.
The default archive-forum.php template allows the bbpress content to appear, but not the theme header, so I stripped away the bbpress header items and replaced ‘archive-forum’ with ‘page’ like so:
<?php get_header(); ?> <div id="forum-front" class="bbp-forum-front"> <div class="entry-content"> <?php bbp_get_template_part( 'content', 'page' ); ?> </div> </div><!-- #forum-front --> <?php do_action( 'bbp_after_main_content' ); ?> <?php get_sidebar(); ?> <?php get_footer();
This makes the theme header work, but now the bbpress content is broken.
I am getting the following error:
Warning: count(): Parameter must be an array or an object that implements Countable in public_html/wp-includes/post-template.php on line 316
The line in question is:
if ( $elements['page'] > count( $elements['pages'] ) ) { // if the requested page doesn't exist $elements['page'] = count( $elements['pages'] ); // give them the highest numbered page that DOES exist }
From what I understand
/forums
is not a page that ‘exists’, but I’ not comfortable modifying WP core. Any help would be appreciated…