Joomla plugin triggers questions

707 views
Skip to first unread message

nant

unread,
Oct 11, 2012, 4:13:41 AM10/11/12
to joomla-de...@googlegroups.com
I have been helping out the civiCRM team to fix some issues they have with Joomla 2.5 integration.

They currently have a Joomla plugin that is triggering off this event:

onUserAfterSaveGroup

When exactly is this fired?

Where can I find perhaps a complete list of event triggers for Joomla?

I see some triggers in the Joomla documentation site, but I do not think its complete - for example I cannot find the one I quoted above.

The specific need here is to find a trigger that is fired when a modification is made to any Joomla ACL group (example: modifying permissions).

Thanks in advanced for responding ...
Nick

piotr_cz

unread,
Oct 11, 2012, 6:56:52 AM10/11/12
to Joomla! General Development
I'd say that this is an event of UsersModelGroup class (administrator/
com_users/models.group.php),
triggered by JModelAdmin parent class in function save so after
usergroup table is stored and component cache cleaned.

nant

unread,
Oct 11, 2012, 7:09:24 AM10/11/12
to joomla-de...@googlegroups.com
Thanks for feedback - yup it looks like that is where the trigger is defined.

Questions now are:

1. what parameters can I expect here and perhaps a sample usage?
2. this is not listed on the doc site - how can i find other event triggers also not listed?

Thanks again!
Nick

nant

unread,
Oct 16, 2012, 7:38:15 PM10/16/12
to joomla-de...@googlegroups.com
Well, this trigger seems kind of useless.

If I alter permissions related to a group, this trigger is not fired.

It looks like it is only fired if I just save the group from the group page - and altering the actual group characteristics does nothing.

Is there ar trigger that is fired if a group permissions save is executed?

elin

unread,
Oct 16, 2012, 9:25:29 PM10/16/12
to joomla-de...@googlegroups.com
Well  after save group .. happens after you save a group ..which happens ... on a group page.  It's pretty semantic.

What do you mean by alter permissions related to a group?  Those are not saved with the group they are save with the asset they apply to.

Are you asking if there is an event when you change permissions for something? You could always use the general form save event if the changes are happening via the ui.  Are you basically looking for an event that is specifically triggered when there is a save to the asset table?

http://docs.joomla.org/16Events  is a list of 1.6/2.5 events

Elin

nant

unread,
Oct 17, 2012, 2:50:37 AM10/17/12
to joomla-de...@googlegroups.com
Hi Elin and thanks for replying here.

I am looking specifically how to trigger a function when a permissions tab is saved.

For example: Users -> User Manager -> Options tab -> Save (or Save and Close)

Is there a trigger I can use here?

In fact is there some way to hook into any similar Options button save in other components?

Nick

nant

unread,
Oct 17, 2012, 2:56:35 AM10/17/12
to joomla-de...@googlegroups.com
Also, what is the general form save event?
Any doc on this?

Thanks again!

Nick

On Wednesday, October 17, 2012 4:25:29 AM UTC+3, elin wrote:

Dan YJ

unread,
Oct 17, 2012, 8:55:05 AM10/17/12
to joomla-de...@googlegroups.com
@nant 

public function onExtensionBeforeSave($name, $data){
}
is what you are looking for 

nant

unread,
Oct 17, 2012, 9:47:57 AM10/17/12
to joomla-de...@googlegroups.com
That doesn't appear to trigger in my tests.

It does not fire at all in these test cases:

1. Saving permissions from Joomla global area.
2. Saving permissions from component options area.

Youjoomla LLC

unread,
Oct 17, 2012, 9:54:39 AM10/17/12
to joomla-de...@googlegroups.com
Im confused , are you making a plugin or component now , 
Look here 
line 45
We are using same event on JBotstrap plugin to restore backup and  reset the restore_backup param after save  and works just fine 


--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To view this discussion on the web, visit https://groups.google.com/d/msg/joomla-dev-general/-/cgWwyCGJtMAJ.

To post to this group, send an email to joomla-de...@googlegroups.com.
To unsubscribe from this group, send email to joomla-dev-gene...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/joomla-dev-general?hl=en-GB.



--
Best Regards
Dan Casky
Youjoomla Customer Service
+1727-388-6653
5044 17th street N
Saint Petersburg ,FL
33714
-------------------------------
Youjoomla LLC
www.youjoomla.com
Professional Joomla Web Design Services

nant

unread,
Oct 17, 2012, 3:52:46 PM10/17/12
to joomla-de...@googlegroups.com, youjoo...@gmail.com
I have attached a simple plugin to test the triggers - you need to edit the filename path for your specific root to get it to work.

This basically tests all the mentioned triggers and prints a line in the text file if the trigger is fired.

Idea is to get something to fire here when a save is done on permissions popup in a Joomla or in a third party component -

I tried for example saving the user manager options permissions popup and nothing fires here.

Nick

On Wednesday, October 17, 2012 6:09:08 PM UTC+3, Brian Shaughnessy wrote:
I see how you've structured your plugin. And I see that when I save the *plugin* parameters -- the event is triggered.
However -- I don't see how that event is triggered from a component.

For example --
If I throw a simple echo + exit statement in your plugin at the top of onExtensionBeforeSave, and edit-save your plugin, I see my debug text.
Since this is a system plugin, and I've put my debug code before any context conditions are implemented, one would think that I would get the text and exit if I then go to any component, view options, and save. But I don't.

So either the events are not triggered with components, or there must be some other way to implement the trigger that I am missing.
plg_test.zip

elin

unread,
Oct 17, 2012, 5:13:43 PM10/17/12
to joomla-de...@googlegroups.com, youjoo...@gmail.com
Ok so this is probably because of how com_config is working in some way differently from the othter edit screens. (A quick look for example shows it is extending jControllerLegacy and not JControllerForm). I would say that it's totally reasonable to expect that they are going to trigger the form events given that you should be able to use a plugin to add or replace fields and fieldsets. 

Let's try to dig into what is happening and whether it is something that can be fixed in com_config.  Would you go ahead and put it in the tracker?

Elin

nant

unread,
Oct 18, 2012, 3:13:59 AM10/18/12
to joomla-de...@googlegroups.com, youjoo...@gmail.com
Before I invest more time on this, I need to ask if YOU consider this a bug or a feature. I do not want to start a never ending tracker discussion if I open this as a bug and have people (maybe even you) commenting that it's not a bug but it should be a feature.

Regarding tracker title - i propose:

"com_config not firing any event triggers on Save actions"

Finally, just for clarity - would com_config be responsible for firing events for other components using the Joomla ACL configuration methods?

Thanks you Elin for contributing to this.

Nick

Youjoomla LLC

unread,
Oct 18, 2012, 8:03:40 AM10/18/12
to joomla-de...@googlegroups.com
I agree with Nick , just the other day I needed onbeforesave in com_templates and is not available.
Seems to be available on plugin actions only and on plugin save. It should be in all components onafter/onbefore save.

--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To view this discussion on the web, visit https://groups.google.com/d/msg/joomla-dev-general/-/07u3XNO8eBUJ.

To post to this group, send an email to joomla-de...@googlegroups.com.
To unsubscribe from this group, send email to joomla-dev-gene...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/joomla-dev-general?hl=en-GB.

elin

unread,
Oct 18, 2012, 7:55:47 PM10/18/12
to joomla-de...@googlegroups.com, youjoo...@gmail.com
I would not have said to put it in the tracker if I thought it wasn't a bug.

There is actually a very old pending issue in the tracker for this general situation.

http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=24792


That patch from Ofer does not include com_config but it could.be updated.

If you care about issues or have annoyances the way to make them better is not to suffer in silence but to help with the work of getting the fixes to those problems in.

It would be fantastic for people to get that tested.

Elin
To unsubscribe from this group, send email to joomla-dev-general+unsub...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/joomla-dev-general?hl=en-GB.

elin

unread,
Oct 18, 2012, 8:00:49 PM10/18/12
to joomla-de...@googlegroups.com, youjoo...@gmail.com
To answer the other question, the global configuration and component options are set with com_config so it's the job of com_config to do that. For things like a category or an article it would be the job of the appropriate component (i.e. com_categories or com_content). 

Components are full of triggers of all types.

Elin

nant

unread,
Oct 19, 2012, 4:06:57 AM10/19/12
to joomla-de...@googlegroups.com, youjoo...@gmail.com
So, just to confirm.

If any third part component is using Joomla ACL and has and is presents the popup window that allows superamdins to modify allowed permissions for the component based on Joomla ACL groups, then the code that actually handles the Save, Save and Close,  Cancel actions is in the com_config?

Or should the third-party component actually fire a trigger in its code somehow?

I would think its a Joomla function that is being called by the third party component and Joomla opens-up the pop-up window.

I hope you can clarify this.

Thanks,
Nick

elin

unread,
Oct 19, 2012, 5:54:18 PM10/19/12
to joomla-de...@googlegroups.com, youjoo...@gmail.com
Yes all components that  follow the design pattern of the core components use com_config.

Elin

nant

unread,
Nov 13, 2012, 2:59:56 AM11/13/12
to joomla-de...@googlegroups.com, youjoo...@gmail.com
Ok, I am back on this now after taking care of other tasks on my already filled plate ...

I am willing to propose a new patch/pull request to fire the right triggers in com_config.
Is there some sample code I can look at to see an example of how this should be done?

nant

unread,
Nov 13, 2012, 3:04:42 AM11/13/12
to joomla-de...@googlegroups.com, youjoo...@gmail.com
Elin, would you consider this a bug or a feature?
Which tracker should I put this on?


On Saturday, October 20, 2012 12:54:18 AM UTC+3, elin wrote:

elin

unread,
Nov 13, 2012, 7:32:26 PM11/13/12
to joomla-de...@googlegroups.com, youjoo...@gmail.com
It's borderline but I don't mind calling it a bug.

Elin

nant

unread,
Nov 14, 2012, 6:47:46 AM11/14/12
to joomla-de...@googlegroups.com
thx elin,

is there some sample code you can point me to?

nant

unread,
Dec 2, 2012, 3:16:45 AM12/2/12
to joomla-de...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages