2

Can any one suggest how I can call the Users default controller's methods, like activate or any other, that I have created in User controller of Admin site with argument?

1 Answer 1

2

You would not call the controller methods to activate a user as this would then set a redirect as well - you need to be calling the model. Basic PHP, not really Joomla related.

So you would first include the model

include_once JPATH_ADMINISTRATOR . '/components/com_users/models/user.php';

and then instantiate the object:

$usersMdl = new UsersModelUser();

define your array of user ids to activate (as only variables can be passed by reference):

$myIds = [1, 2, 3];

and then call the models methods:

$usersMdl->activate($myIds);

where 1,2 and 3 are the user ids you want to activate.

(code tested and working in Joomla 3.4+)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.