I purchased a mod; I won't say which or who, that is screaming at me that isAdmin() is undefined. Is isAdmin() a core Dolphin Function? If so, what file would contain this function? I have contacted the mod developer but it may be ages before I get a response and I really need this mod in place ASAP. Geeks, making the world a better place |
Yes and no.
It's defined in inc/profiles.inc.php
The the way it is written would only create the function if a check with php function_exists says it's not been previously defined.
How it is written is in my opinion unsafe to rely on. Although i have used it myself in a couple of my modules. Which i guess i should not be. But i am not having any problems with them either.
So perhaps you should replace isAdmin(ID) with isRole(3, ID); https://www.deanbassett.com |
Csampson |
Where at What?
Where it is defined or where in the mod it is used.
The mod i can't tell you.
The isAdmin is defined i stated what file it's in. Just search for IsAdmin. It's right near the top of the file.
https://www.deanbassett.com |
I tried both including the function as well as replacing it was isRole and I keep getting kicked to the homepage; it is not seeing me as admin.
A partial from the script (isAdmin() is used in several places and I replaced them all).
if ($this->_userId && !isAdmin()
Although it quit screaming at me about isAdmin() is undefined.
Geeks, making the world a better place |
I need to add my ID number, correct? That is not a variable in isRole() Geeks, making the world a better place |
OK, thanks, I have this working now. The only change I need to do later is for it to be able to have a variable for the ID because the site will have multiple Admins. Thanks Dean for your help on this. I would give you a big hug if you were here LOL. Geeks, making the world a better place |
Both isAdmin and isRole will use the ID of the member currently logged in if it is not passed.
So isAdmin() is the same as isRole(3)
The 3 in role is the role number in case that part confuses you.
So isMember() is the same as isRole(1)
In your example of if ($this->_userId && !isAdmin() you would use if ($this->_userId && !isRole(3)
https://www.deanbassett.com |
Yes, I see, thanks for that extra bit. Now I owe you two hugs Geeks, making the world a better place |