Notifications
Clear all

Video [Solved] Hide menu "download" from video player

5 Posts
3 Users
0 Reactions
216 Views
Posts: 6
 fufy
Topic starter
(@fufy)
Active Member
Joined: 3 weeks ago

I have this code in my wordpress theme's functions.php to disable download menu from video player which works great on my posts, i.e. video plays normally and has all functions except the download menu - just what I need.

add_filter( 'render_block', 'video_block_render', 10, 2 );
function video_block_render( $output, $block ) {
    if ( 'core/video' !== $block['blockName'] ) {
      return $output;
    }
    $output = str_replace(
      '<video controls',
        '<video controls controlslist="nodownload"', $output
    );
    return $output;
}

But in wpForo posts, the video player's download menu shows normally. Not sure if there's anything from wpForo that overcomes or has higher priorty that blocks this function not working properly. I've also tried adding the code to wpForo's functions.php instead of Wordpress's but didn't work either.

Please kindly advise.

 

Many thanks.

 


4 Replies
4 Replies
wpForo Support
Moderator
(@wpforo-support)
Joined: 4 weeks ago

Member
Posts: 15

@fufy,
To hide or disable the download menu from the video player in wpForo posts, you can use custom CSS to target the video player's controls and hide the download option, since the default WordPress function does not work in wpForo posts. For example, you can add CSS like this:

#wpforo .wp-video::-webkit-media-controls-enclosure { /* Hide download button in WebKit browsers */
  overflow: hidden;
}
#wpforo .wp-video::-webkit-media-controls-download-button {
  display: none !important;
}

This CSS targets the video controls inside wpForo posts and hides the download button. You may need to adjust selectors depending on your theme or video player.

If you need more advanced control or customization, consider contacting the Gvectors Custom Work Team for custom development, as wpForo does not have built-in integration for changing video player controls directly.


Reply
 fufy
(@fufy)
Joined: 3 weeks ago

Active Member
Posts: 6

@wpforo-support Thank you for looking at my issue. I've put the code to wpForo's custom CSS but the download menu still appears. I've attached the pictures here for your checking.


Reply
Sofy
 Sofy
Admin
(@sofy)
Joined: 8 years ago

Support Team
Posts: 5562

@fufy 

Use this hook-code: 

add_filter( 'wpforo_content_after', function($content){ return str_replace( '<video ', '<video controlslist="nodownload" ', $content ); }, 999 );

Reply
 fufy
(@fufy)
Joined: 3 weeks ago

Active Member
Posts: 6

@sofy Yes this one works perfectly. So many thanks!


Reply