Restrict video qualities for guests and non-premium users

17 Nov 2018
@PHPVibe
288

For thouse of you building an adult tube based on MediaVibe this little mod can help out if you’re considering restrincting some video qualities to some users. Like Redtube or Pornhub do, or most adult tube websites.

This is simple on the MediaVibe CMS, open lib/class.providers.php and find:


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

Right before this


krsort($qualities);

add this:


/* Restict 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);
}


Edit the $garr and $usrr arrays wil the values you wish to exclude, $garr is for guests and $usrr is for non-premium users *regular users*.
The $qualities variable is global, so you can acess it from video.php in tpl and create a message that includes the restricted qualities for that user.
Like a “Sign in to watch this in stunning 1080p” that adult tubes have.

Hope this helps!
Cheers

1 Comment

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.