?
avatar eguerin
eguerin
15 Apr 2015

Steps to reproduce the issue

This is for the Users -> Groups -> New Group / Modify Group view.

1) Create a users plugin, which provides several additional form fields for the group form (not the user form). I created two plugins one for the Users plugin group and one for the content plugin group, neither group provided a trigger point for saving.

2) Try to find an available "trigger" point for the save event to save the results into the database.

What did I try:

onContentAfterSave
onUserAfterSave
onContentBeforeSave
onUserBeforeSave

Expected result

I expected one of the triggers, either the content or the user, ideally the user since the plugin is part of the user group and the functionality is part of the user component to trigger an event.

Actual result

No event was triggered.

System information (as much as possible)

PHP Built On Darwin GuerinOSX.local 14.1.0 Darwin Kernel Version 14.1.0: Thu Feb 26 19:26:47 PST 2015; root:xnu-2782.10.73~1/RELEASE_X86_64 x86_64
Database Version 5.1.52
Database Collation latin1_swedish_ci
PHP Version 5.4.10
Web Server Apache/2.2.23 (Unix) mod_ssl/2.2.23 OpenSSL/0.9.8zc DAV/2 PHP/5.4.10
WebServer to PHP Interface apache2handler
Joomla! Version Joomla! 3.3.6 Stable [ Ember ] 01-October-2014 02:00 GMT
Joomla! Platform Version Joomla Platform 13.1.0 Stable [ Curiosity ] 24-Apr-2013 00:00 GMT
User Agent Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:37.0) Gecko/20100101 Firefox/37.0

Additional comments

My work-around was unfortunately to modify the core administrator/components/com_users/models/group.php to include a trigger such as the following:

// Proceed with the save
if (parent::save($data)) {
$dispatcher = JEventDispatcher::getInstance();
$dispatcher->trigger('onUserAfterSave', array('com_users.group', $data, false));
return true;
} else {
return false;
}

It would be a nice addition to Joomla if the Core functionality can be modified by the plugin system without core changes. If After and Before Save events are available in more places you will make the Event system all that more powerful.

avatar eguerin eguerin - open - 15 Apr 2015
avatar joomdonation
joomdonation - comment - 16 Apr 2015

You don't have to hack core code to do that. Try onUserAfterSaveGroup event and it should work. It is defined at https://github.com/joomla/joomla-cms/blob/staging/administrator/components/com_users/models/group.php#L29

avatar eguerin
eguerin - comment - 16 Apr 2015

I will try this, I thought I did and it didn't work but I will attempt to do it again.


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6780.

avatar joomdonation
joomdonation - comment - 16 Apr 2015

Make sure you try it on latest version of Joomla (version 3.4.1).

avatar eguerin
eguerin - comment - 21 Apr 2015

Yes, this worked, however now the function is passed a OBJECT of type JTableUsergroup. This object does not contain any of the extended properties I have added to the User Group form using the following method:

JForm::addFormPath(dirname(FILE).'/forms');
$form->loadFile('group', false);

I have added a PARAMS fieldset, that fieldset is now missing from the resulting OBJECT. How do I retrieve those values and re-insert them into the database now? This seems like a bigger issue then before as now the field data is no longer available.


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6780.

avatar brianteeman
brianteeman - comment - 4 May 2015

As the original issue was resolved thanks to the suggestion of @joomdonation and the remaining issue is more of a support issue I am closing this here. I would suggest that if you still have the issue above you take it to either the Joomla Dev General mailing list (https://groups.google.com/forum/#!forum/joomla-dev-general) or the sirum (http://forum.joomla.org)


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6780.

avatar brianteeman brianteeman - change - 4 May 2015
Status New Closed
Closed_Date 0000-00-00 00:00:00 2015-05-04 14:11:12
Closed_By brianteeman
avatar brianteeman brianteeman - close - 4 May 2015

Add a Comment

Login with GitHub to post a comment