• Welcome to WooUSEFUL by PHPVIBE . Please log in.
avatar_Marius

[Hack] Restrict video qualities for guests and non-premium users

Started by Marius,

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

MariusTopic starter

Restrict video qualities for guests and non-premium users in PHPVibe

For those of you constructing an adult tube using PHPVibe, this small modification can be beneficial if you're contemplating restricting certain video qualities for specific users, akin to the practices of sites like Redtube or Pornhub.

To implement this modification in the PHPVibe CMS, open the file app/classes/class.providers.php and locate the following section:

/* We have multiple qualities */
$real_link = (isset($qualities["hd"])) ? $qualities["hd"] : $qualities["sd"];
$extra = $qualities;
}
krsort($qualities);

Just before the last line (krsort($qualities);), insert the following code:

/* Restrict some */
$garr = array('1080', '720', 'hd'); /* Guest restrictions */
if (!is_user()) {
    foreach ($garr as $rg) {
        if (isset($qualities[$rg])) {
            unset($qualities[$rg]);
        }
    }
}

$usrr = array('1080');/* Non-premium user restrictions */
if (!has_premium()) {
    $qualities = array_diff(array_map('json_encode', $qualities), array_map('json_encode', $usrr));
    $qualities = array_map('json_decode', $qualities);
}

Adjust the $garr and $usrr arrays with the values you want to exclude. $garr pertains to guests, while $usrr relates to non-premium users or regular users. The $qualities variable is global, allowing you to access it from video.php in the theme folder. This enables you to create a message that informs users about the restricted qualities, such as "Sign in to watch this in stunning 1080p," a common feature on adult tube sites.

I hope this proves helpful! Cheers.
If this helped, consider buying me a coffee.
20 years coding, tweaking, building in PHP. Still creating!
  •  

Similar topics (7)