The forum is here for legacy reasons. No new posts will be created. User registration is disabled! If you have any questions, please email us or check https://www.adultscriptpro.com for more details!
You are not logged in.
After research, I've found what I need I think but still have some questions.
I want to disable the Upload button and link for a user who is not premium. When a non-premium user clicks it, it just takes them to the home page and says you're already logged in.
Therefor, I want to use modules/user/components/login.php to set a cookie saying whether a user is premium or not.
In login.php at line 105 I see:
if (isset($remember) && $remember == 'on') {
VCookie::set('username', md5($user['username']), (30*86400));
VCookie::set('password', $user['password'], (30*86400));
}
I can set it to:
if (isset($remember) && $remember == 'on') {
VCookie::set('username', md5($user['username']), (30*86400));
VCookie::set('password', $user['password'], (30*86400));
VCookie::set('premium', $user['premiumornot'], (30*86400));
}
But the premiumornot section is what I'm wondering about. How does the software check for premium? If someone can clarify I can set this up.
Last edited by Tenche (2012-07-01 13:54:03)
Offline
It checks if the $_SESSION['group_id'] is the Premium group and then it checks if the user has enough credit/subscription valid. If you only want to allow premium users to upload, edit modules/video/components/upload.php and add VAuth::check('Registered');
Adult Scripts: Adult Script Pro - Adult Search Script
Adult Advertising/Traffic: Plug Rush - EXOClick - PopAds
Offline
I may not have explained what I'm trying to do properly. I want to REMOVE the upload button and link from the site if they are not Premium.
Can I use VAuth::check('Premium'); ?
Offline
You will need to wrap the button in an if statement that checks the group_id from the session array. If it equals premium then show the button. Do not use a cookie for this as that can be bypassed extremely easy.
Last edited by THS (2012-07-01 15:53:04)
Offline
Correct, which is what I'm doing. I'll work on this later, thanks again.
Offline
In the templates/your-template/header.tpl.php you can have:
<?php if (VAuth::group('Premium')): ?>
html code here
<?php endif; ?>
Adult Scripts: Adult Script Pro - Adult Search Script
Adult Advertising/Traffic: Plug Rush - EXOClick - PopAds
Offline
Wow! It's identical to the one I wrote. Just what I needed. Thanks!
Offline
Got a problem. Since the upload button in the menu still shows, I'd like to know the best method of achieving it's hidden status for Registered/non-premium users. I've looked in the extend\plugins\menu_main.plugin.php file and found where it handles some of the upload button, but I'm not sure what would be the best method of hiding it using the VAuth::group('Premium') method.
Any insight would be appreciated.
Thanks again!
Offline
Change this:
$url = ($link['type'] == 'int') ? RELATIVE_URL.$link['link'] : $link['link'];
$target = ($link['target'] != 'none') ? ' target="_'.$link['target'].'"' : '';
$active = ($link['current'] == $tpl->menu) ? ' class="active"' : '';
$title = ($link['title'] != '') ? ' title="'.htmlspecialchars($link['title'], ENT_QUOTES, 'UTF-8', FALSE).'"' : '';
$upload = ($link['current'] == 'upload') ? ' class="upload"' : '';
$name = ($lang == 'en-US') ? strtoupper($link['name']) : utf8_strtoupper(__($link['lang']));
$menu[] = '<li'.$upload.'><a href="'.$url.'"'.$active.$title.$target.'>'.htmlspecialchars($name, ENT_QUOTES, 'UTF-8', FALSE).'</a></li>';
to:
$url = ($link['type'] == 'int') ? RELATIVE_URL.$link['link'] : $link['link'];
$target = ($link['target'] != 'none') ? ' target="_'.$link['target'].'"' : '';
$active = ($link['current'] == $tpl->menu) ? ' class="active"' : '';
$title = ($link['title'] != '') ? ' title="'.htmlspecialchars($link['title'], ENT_QUOTES, 'UTF-8', FALSE).'"' : '';
$upload = ($link['current'] == 'upload') ? ' class="upload"' : '';
$name = ($lang == 'en-US') ? strtoupper($link['name']) : utf8_strtoupper(__($link['lang']));
if ($upload) {
if (VAuth::group('Premium')) {
$menu[] = '<li'.$upload.'><a href="'.$url.'"'.$active.$title.$target.'>'.htmlspecialchars($name, ENT_QUOTES, 'UTF-8', FALSE).'</a></li>';
}
} else {
$menu[] = '<li'.$upload.'><a href="'.$url.'"'.$active.$title.$target.'>'.htmlspecialchars($name, ENT_QUOTES, 'UTF-8', FALSE).'</a></li>';
}
Adult Scripts: Adult Script Pro - Adult Search Script
Adult Advertising/Traffic: Plug Rush - EXOClick - PopAds
Offline
Thank you sooo much! The logic is understood.
Offline