Notifications
Clear all

wpForo 1.x.x [Solved] Здравствуйте!

3 Posts
2 Users
0 Reactions
2,165 Views
Posts: 3
 gfy
Topic starter
(@gfy)
Active Member
Joined: 5 years ago

Хотелось бы ставить на форуме для участников видео с ютуба, но не могу найти как это возможно. А так форум удобный, простой в работе, за что спасибо

2 Replies
Sofy
Posts: 4900
 Sofy
Admin
(@sofy)
Support Team
Joined: 7 years ago

Hi @gfy,

Thank you for using wpForo and for contacting us. 

Please put this code in the active WordPress theme's functions.php:

add_filter('wpforo_content_after', 'wpforo_custom_video_embed', 10);
function wpforo_custom_video_embed( $content ){
$paterns = array();
$paterns[] = "/<a[^><]+>\s*[a-zA-Z\/\/:\.]*youtube.com\/watch\?v=([a-zA-Z0-9\-_]+)([a-zA-Z0-9\/\*\-\_\?\&\;\%\=\.]*)/i";
$paterns[] = "/<a[^><]+>\s*[a-zA-Z\/\/:\.]*youtu.be\/([a-zA-Z0-9\-_]+)([a-zA-Z0-9\/\*\-\_\?\&\;\%\=\.]*)/i";
$content = preg_replace($paterns, "<iframe width=\"420\" height=\"280\" src=\"//www.youtube.com/embed/$1\" frameborder=\"0\" allowfullscreen></iframe>", $content);
return $content;
}

For more embedding options I recommend wpForo Embeds addon:

https://gvectors.com/product/wpforo-embeds/

Posts: 3
 gfy
Topic starter
(@gfy)
Active Member
Joined: 5 years ago

Thanks!