質問

I have a user Joomla plugin which validates data when creating a new user in Joomla both for front-end and back-end.

I want to separate parts of code that the plugin is running, based on the client id. So the plugin will run other code when the form is submitted from the front-end than when a user is created in the back-end.

How can I determine in the plugin code, if the user is logged-in the backend or he is in the front-end ?

役に立ちましたか?

解決

Check the JApplication object for isAdmin() or isSite().

$app = JFactory::getApplication();
$inAdmin = $app->isAdmin();

or

$app = JFactory::getApplication();
$inSite = $app->isSite();

https://github.com/joomla/joomla-cms/blob/master/libraries/legacy/application/application.php#L1111

https://github.com/joomla/joomla-cms/blob/master/libraries/legacy/application/application.php#L1123

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top