How to get a form plugins parameters

achartier

Administrator
Staff member
I am writing a plugin that extends JMail and captures the JUser generated email. I am able to capture it just fine. I would like to know how I might access the parameters of the specific instance of the JUser plugin for the specific form that created the email?

Using the JPluginHelper to get the params gets me nothing as the system installed JUser plugin does not itself have parameters.

I can get the fabrik form ID via JRequest and I can see that the form data stored in the #_fabrik_forms db table includes the params. As it is possible for a form to have more than one instance of the same plugin though, I don't see how I would know which instance of the JUser plugin generated this specific email. Since the parameters of each instance might be different this becomes important.

Any thoughts?
 
what type of plugin are you writing? Is it a fabrik form plugin - or something else? The answer to that will affect the rest of my answer ;)
 
It is a joomla plugin that extends JMail. So when JUser generates an email and issues the send I can capture and modify it. There are certain JUser plugin parameters that I should key on to do different actions such as the autologin. If this is set I need to send a different email than the standard new user details email.
 
Yes, a single form can have more than one juser plugin, although obviously the idea would be that only one of them is firing, depending on some arbitrary condition(as per the juser_condition param). And it would be very unlikely - I've only ever seen a small handful of instances over the years where people have more than one juser plugin on a form, although it does happen.

The params are in JSON format, so each param is an array, like "juser_field_default_group":["1","1"], with the values being in the order the multiple copies are listed on the form's plugins list.

However ... I really can't think of a way you would be able to tell which one fired the actual email you are seeing. Both instances of the plugin will have been called, and will have simply decided whether they actually do anything, after evaluating the juser_condition param. And I don't think you could realistically evaluate that yourself, as it could depend on all kinds of data you don't have when your plugin runs.

You could do it by ading a few lines of code to the juser 'condition' code, if there are more than one, which do something like set a session variable or an $app->input->set() with their render order if the condition is going to return true ... but that would mean your Jail plugin wasn't "standalone".

Rob? Any brilliant ideas?

-- hugh
 
I can't think of anyway for a Joomla User plugin to know where it was triggered from I'm afraid.
 
Thanks guys. I think I may be able to use the condition to set an input variable. I agree having more than one JUser plugin will be uncommon but it could happen. When I get it working I will post the details back here.
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top