Skip to:
Content
Pages
Categories
Search
Top
Bottom

Extra tags to add to list for videos


  • Chuckie
    Participant

    @ajtruckle

    So I have this code for html tags not showing in topics for non-admin:

    // Stop HTML Tags appearing in bbPress posts for non-admin users
    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(
    			'dir'    => 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,
    		)
    	);
    } 

    I need to add some more tags to this list because my topics now support embedded videos. A user did a topic and it shows as:

    <video controls=”controls” width=”300″ height=”150″>
    <source src=”path; /></video>

    What must I add to this tags array for this?

    Thanks

Viewing 5 replies - 1 through 5 (of 5 total)

  • Chuckie
    Participant

    @ajtruckle

    Is this right? I don’t want to blindly add the code so I appreciate confirmation:

    'video'      => array(
    	'controls' => true,
    	'width'    => true,
    	'height'   => true,
    ),
    'source'     => array(
    	'src'    => true
    )

    ?


    Chuckie
    Participant

    @ajtruckle

    This works:

    		'video'      => array(
    			'controls' => true,
    			'width'    => true,
    			'height'   => true,
    		),
    		'source'     => array(
    			'src'    => true,
    			'type'	 => true
    		)

    Chuckie
    Participant

    @ajtruckle

    It is not working. For a standard user once I hit submit the code I end up with is:

    <video controls="controls" width="300" height="150"></video>

    It has lost the inner source item:

    <video controls="controls" width="300" height="150">
    <source src="xxxxx.mp4" type="video/mp4" /></video>

    Chuckie
    Participant

    @ajtruckle

    Sorted:

    		'video'      => array(
    			'controls' => true,
    			'width'    => true,
    			'height'   => true,
    			'source'     => array(
    				'src'    => true,
    				'type'	 => true
    			)
    		)

    Chuckie
    Participant

    @ajtruckle

    I still have a bug with the inserting of videos. If I am creating the topic / reply as an ADMIn then the code is correct:

    <video controls="controls" width="300" height="150">
    <source src="https://www.publictalksoftware.co.uk/videos/forum/pts-test-video.mp4" type="video/mp4" /></video>

    When you hit SUBMIT the video can be played etc.

    But when you are NON-ADMIN and hit SUBMIT the outer chevrons of the inner SOURCE tag get escaped. I don’t know where this issue lies:

    – WordPress 5.3?
    – TinyMCE Insert Media Plugin 4.9.6 ?
    – bbPress 2.6.2?

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.
Skip to toolbar