We have a custom login plugin which extends the CMSPlugin.
I am trying to register the Class of the plugin inside a module but the following scenarios occur.
Case 1
JLoader::register('CLASS_NAME_OF_THE_PLUGIN', 'path_to_plugin');
CLASS_NAME_OF_THE_PLUGIN::method_inside_class();
Does not work because the method is not static
Case 2
JLoader::register('CLASS_NAME_OF_THE_PLUGIN', 'path_to_plugin');
$new_class_instance = CLASS_NAME_OF_THE_PLUGIN();
Does not work and the error is
Too few arguments to function Joomla\CMS\Plugin\CMSPlugin::__construct(), 0 passed at least 1 expected
How I can solve that? I don't really want to change my functions/methods to 'static' because after other problems arise(can't login and so on).Perhaps going with the second approach? But I don't know what should I give as argument and how should I write it
we use the Plugin to override standard Joomla login kinda. So when the user logs in for first a request is sent on the external login "environment" and if the credentials are correct then a joomla user is created without password. After user tries to login in the future a request is being sent on the external login also. In this plugin we also check if the tokens are valid, renew the tokens if they are expired and also fetch the user additional info from the external environment(address, phone etc). So I thought I could use maybe some functions of the plugin inside a module? Like refetch the additional user info?
Thanks :)