Disable add-ons for some user groups

DEBIL

Member
Registered
Joined
Jan 2, 2020
Messages
13
Points
3

Reputation:

you need to make XF\\Entity\User.php file

PHP:
<?php

namespace DC\AdvancedDownload\XF\Entity;

class User extends XFCP_User
{
    public function canViewAdvancedDownload(&$error = null)
    {
        return $this->hasPermission('your_group', 'view');
    }
}
and after that you need to use this check in other files of this add-on
PHP:
$visitor = \XF::visitor();

if (!$visitor->canViewAdvancedDownload($error))
{
    throw $this->exception($this->noPermission($error));
}
good luck!
 

DEBIL

Member
Registered
Joined
Jan 2, 2020
Messages
13
Points
3

Reputation:

demonstration.gif
 

Attachments

  • DC-AdvancedDownload-1.0.2.zip
    30.1 KB · Views: 111

zenfor

Member
Registered
Joined
Jan 3, 2020
Messages
15
Points
3

Reputation:

Hello again, I tested this method, but that's not what I want.

While I'm holding some users on the page, I want others to be able to download the file immediately.

However, disabled users cannot download files.

For example VIP members want to download the file without waiting.

But I want to keep normal users waiting.
 
Top