APP-ISADMIN-001
$app->isAdmin()
isAdmin() / isSite()
Joomla 4 can have more application clients than site/admin. isAdmin and isSite were removed. isClient() is the replacement.
$app->isAdmin() → $app->isClient('administrator') / isClient('site')
What you will see
- Call to undefined method ...::isAdmin()
- Call to undefined method ...::isSite()
Symptoms people search
admin-only code runs on the site · undefined method isAdmin
Replace this code
Swap $app->isAdmin() for $app->isClient('administrator') / isClient('site').
Joomla 3
Remove or stop calling this
if ($app->isAdmin()) { ... }
if ($app->isSite()) { ... }Joomla 4 / 6
Use this instead
if ($app->isClient('administrator')) { ... }
if ($app->isClient('site')) { ... }How to fix it
- 1Replace isAdmin() with isClient('administrator').
- 2Replace isSite() with isClient('site').
Also known as
isAdmin · isSite · isClient
Related issues
- Joomla 3 → 4Joomla API
JRequest::getVar() and the whole JRequest API
JRequest::getVar() → $app->getInput()->get('id')
- Joomla 3 → 4Joomla API
JError / JException
JError::raiseError() → throw new RuntimeException() / try-catch
- Joomla 3 → 4PHP
jimport() autoloader calls
jimport('joomla.filesystem.file') → use Joomla\CMS\Filesystem\File;
- Joomla 3 → 4Joomla API
Factory::getUri()
JFactory::getUri() → Uri::getInstance()
- Joomla 3 → 4Joomla API
Factory::getXml() / JXMLElement
JFactory::getXML() → SimpleXMLElement
- Joomla 3 → 4Joomla API
Factory::getEditor()
JFactory::getEditor() → Editor::getInstance()