admin / normal user code switch

Discuss the development of future releases of phpBB (phpBB 3.x minor releases) and MODing/Coding related questions.
[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
xceler8shun
New member
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

admin / normal user code switch

Postby xceler8shun » 17 Aug 2008, 10:26

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?

User avatar
igorw
Past Contributor
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

Postby igorw » 17 Aug 2008, 11:56

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!

harmlessgoat22
Supporter
Supporter
Posts: 316
Joined: 18 Sep 2007, 14:35
Real name: David
Contact:

Re: admin / normal user code switch

Postby harmlessgoat22 » 17 Aug 2008, 14:59

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.

That's like, I can't beat my neighbor in an argument, so instead I kill his dog.
-Best English Teacher Ever

User avatar
igorw
Past Contributor
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

Postby igorw » 17 Aug 2008, 15:01

$user->data['user_type'] == USER_FOUNDER

;)

- we're poor!

harmlessgoat22
Supporter
Supporter
Posts: 316
Joined: 18 Sep 2007, 14:35
Real name: David
Contact:

Re: admin / normal user code switch

Postby harmlessgoat22 » 17 Aug 2008, 18:11

Sorry, forgot about constants :P Thanks Igor.

That's like, I can't beat my neighbor in an argument, so instead I kill his dog.
-Best English Teacher Ever

User avatar
EY
Supporter
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

Postby EY » 17 Aug 2008, 18:43

Never Say Never!

User avatar
igorw
Past Contributor
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

Postby igorw » 17 Aug 2008, 19:19

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!

xceler8shun
New member
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

Postby xceler8shun » 17 Aug 2008, 23:34

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


[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
[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

Return to “phpBB Development discussion”

Who is online

Users browsing this forum: No registered users and 23 guests