If for example I want to make a piece of code available to administrators only and other code available to normal users, can I use this?
if ($auth->acl_get('a_'))
{
CODE TO SHOW ADMINS
}
else
{
CODE TO SHOW NORMAL USERS
}
or is there a better way to do this?
admin / normal user code switch
-
- New member
- Posts: 14
- Joined: 07 Aug 2008, 23:32
- [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
- igorw
- Past Contributor
- Posts: 1967
- Joined: 01 Jun 2006, 20:48
- Real name: Igor [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
Re: admin / normal user code switch
Yes, that can be used. However you should note that if somebody has access to one single acp module they will see the content. So you might want to create a separate permission.
- we're poor!
-
- Supporter
- Posts: 316
- Joined: 18 Sep 2007, 14:35
- Real name: David
- Contact:
Re: admin / normal user code switch
You can also, if you only want founders to use it, you can do...
$user->data['user_type'] == 'founder'...
Or atleast I think that is the code...maybe not, however.
$user->data['user_type'] == 'founder'...
Or atleast I think that is the code...maybe not, however.
That's like, I can't beat my neighbor in an argument, so instead I kill his dog.
-Best English Teacher Ever
-
- Supporter
- Posts: 316
- Joined: 18 Sep 2007, 14:35
- Real name: David
- Contact:
Re: admin / normal user code switch
Sorry, forgot about constants Thanks Igor.
That's like, I can't beat my neighbor in an argument, so instead I kill his dog.
-Best English Teacher Ever
- EY
- Supporter
- Posts: 204
- Joined: 05 Nov 2006, 23:13
- Real name: Elias
- Location: Montreal [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
Re: admin / normal user code switch
Never Say Never!
- igorw
- Past Contributor
- Posts: 1967
- Joined: 01 Jun 2006, 20:48
- Real name: Igor [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
Re: admin / normal user code switch
No. I think the $admin variable you mean is from the login_box() function, it's only set to true if it's an admin login. That has nothing to do with permissions.
- we're poor!
-
- New member
- Posts: 14
- Joined: 07 Aug 2008, 23:32
- [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
Re: admin / normal user code switch
Thanks for the responses.
Other / all admins viewing isn't an issue in this case, but I may create a new permission anyway.
Cheers
Shane
Other / all admins viewing isn't an issue in this case, but I may create a new permission anyway.
Cheers
Shane
Return to “phpBB Development discussion”
Who is online
Users browsing this forum: No registered users and 23 guests