phpMyVideoBlog & PHP 7

phpMyVideoBlog (MVB) is one of those commercial scripts that are heavily maintained one year and the next their development goes to a complete halt and although you buy the script, your only hope for support is their forum system, where the developer does reply from time to time.

According to their release notes, the latest plugin version 3.3 was released in November 2015 which is roughly a year back. As I was revising one site today, I noticed that the MVB plugin was prompting me to upgrade it and I went to the forum, downloaded the latest version then deactivated and removed the old plugin so that I could upload and install the new version, but when trying to activate it I was hit with the following error:

Fatal error: Uncaught Error: Call to undefined function mysql_get_server_info() in …/wp-content/plugins/myvideoblog/mvb_main.php

(The error is truncated to include only the most important info)

Just by looking at the error I realized that I was dealing with deprecated code given that the ‘mysql_‘ extension has been considered deprecated since PHP 5.5 and completely removed in PHP 7.

To fix this, I used a dirty trick that I sometimes employ when troubleshooting so i edited the /wp-content/plugins/myvideoblog/mvb_main.php file and commented out the following lines from within which were the only ones referencing the mysql_get_server_info() function:

if ( version_compare(mysql_get_server_info(), ‘4.1.0’, ‘>=’) ) {
if ( ! empty($wpdb->charset) )
$charset_collate = “DEFAULT CHARACTER SET $wpdb->charset”;
if ( ! empty($wpdb->collate) )
$charset_collate .= ” COLLATE $wpdb->collate”;
}

This fixes the issue and the plugin can be installed, but the script will no longer retrieve the MySQL version in order to execute the query to select the correct charset and collation string. This works on plugin upgrades, but may fail on new installations.

To fix this on new installations there are two possible workarounds:

  1. The script uses the version comparison only to insure that the MySQL version is higher or equal with 4.1.0 so if you’re running PHP 7 you’re clearly using higher PHP versions as this “check” was only justified with PHP 4 and earlier versions of PHP 5 so the version compare if statement can be removed altogether and only the following code can remain:
    if ( ! empty($wpdb->charset) )
    $charset_collate = “DEFAULT CHARACTER SET $wpdb->charset”;
    if ( ! empty($wpdb->collate) )
    $charset_collate .= ” COLLATE $wpdb->collate”;
    }
  2. PHP 5.5 was the version that replaced the obsolete ‘mysql_‘ extension with ‘mysqli_‘ in order to make use of the better database driver available for PHP so mysql_get_server_info() will be changed to mysqli_get_server_info() as follows:
    if ( version_compare(mysqli_get_server_info(), ‘4.1.0’, ‘>=’) ) {
    if ( ! empty($wpdb->charset) )
    $charset_collate = “DEFAULT CHARACTER SET $wpdb->charset”;
    if ( ! empty($wpdb->collate) )
    $charset_collate .= ” COLLATE $wpdb->collate”;
    }

Well that’s pretty much about it. If you’re still wondering what phpMyVideoBlog is here’s some insight from the developer’s site:

Compatible with:
YouTube.com, Dailymotion.com, Metacafe.com, Break.com, Hulu.com, Globo.com, MegaVideo.com, Kewego.com, Videos.Yahoo.com, Viddler.com, Sevenload.com, Shufuni.com, PornHub.com, Xvideos.com, RedTube.com, MegaPorn.com, DeviantClip.com, KeezMovies.com, HardSexTube.com, Eporner.com, Extremetube.com

Script Features:
– Easy to install
– Easy control panel inside the wordpress admin!
– Copy thumbnail images of each video to your own server with SEO titles or use the original link from provider.
– 2 ways to run the Auto-Updates: Via WordPress Schedulle or Via Server CronJob
– MVB catches the title, description, embed code and keywords/tags of each video.
– Create “Post Template” directly in the wordpress admin.
– Create “Post Template” directly in your wordpress theme using custom fields.
– Multiple categories per feed.
– Multiple feeds per category.
– Choose the maximum number of videos per feed.
– Choose the weekdays that each feed will be updated.
– Change status of each feed. On or Off.
– Choose post status, Publish, Pending, Draft or Schedule
– Choose post author for each feed.
– Skip videos with keywords of your choice.
– Grab YouTube comments
– Choose how many comments per videos
– Auto aprove comments
– Compatible with JW Player to play YouTube videos
– Compatible with any WordPress theme.
– Allows you to change custom fields to work with any theme
– Predefined settings for MVB Theme Gallery, Press75, ElegantThemes, Woothemes, iThemes, Free WPTube, WP Tube Platinum

The post status:
– You can mark any feed as “pending”, so all the videos from this feed will be saved as “pending” and will not be published until you access the wordpress admin and publish manually. Works like a moderation system. The script collects the videos and you approve them.
– You can mark any feed as “Schedule” and configure the time interval between each post, using this feature, your blog will have new posts during the day!

If you want to buy this plugin get 35% off using this coupon: 35off

Leave a Reply

Your email address will not be published. Required fields are marked *