BeforeSaveItem or AfterSaveItem Plugin Events PLEASE?!!!

More
13 years 4 months ago #12563 by Brat
I'm using Flexicontent to develop an online fiction delivery system. I'm now at the point I need to 1) know when an item has been successfully saved to #__content and 2) to access that item data (using an array var of course) for my own custom plugin code.

The problem is, I cannot find ANY documentation on how to write Flexicontent-related plugins that do something besides display content. I DESPERATELY need to write plugins that handle "OnBeforeSave" and "OnAfterSave" type events, where I can access the article item array (i.e., $item).

Is there any documentation anywhere to explain how to do this? Should this plugin be done as a SYSTEM plugin (I already found out that Joomla's built in before and after save content triggers do not work with Flexicontent as the core com_content extension does not submit to the content table)? Or, is there a way to do this as an actual content plugin?

Or has someone developed a similar plugin I can study?

I need to have this done very soon for my project. Just point me in the right direction, please. Thanks!

Please Log in or Create an account to join the conversation.

More
More
13 years 4 months ago #12586 by Brat
Thanks for the referral, but in the end I just added hacks to the item model file to initiate com_content's native event triggers where appropriate (i.e., OnAfterSaveContent). So far, this appears to be working.

Hopefully, full third party event triggers will be implemented someday soon. :D

Please Log in or Create an account to join the conversation.

More
12 years 11 months ago #15619 by freshwebservices

Brat wrote: Thanks for the referral, but in the end I just added hacks to the item model file to initiate com_content's native event triggers where appropriate (i.e., OnAfterSaveContent). So far, this appears to be working.


Hi, do you want to post your code? I need to do similar & am not sure where to start!
Thanks,

www.freshwebservices.com -> Leicester web design

Please Log in or Create an account to join the conversation.

More
12 years 11 months ago #15704 by micker
yes brat any news ?

FLEXIcontent is Free but involves a very big effort on our part.
Like the our support? (for a bug-free FC, despite being huge extension) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing reviews. Thanks![/size]

Please Log in or Create an account to join the conversation.

More
12 years 11 months ago #15743 by Brat
Sorry for the long delay. I had to dig through my files and notes to find what I did, since I admittedly haven't worked on this in a while.

NOTE: This was done for Flexicontent 1.5.3, so please don't just copy and paste this code for the latest version!

The file in question is:
Code:
JOOMLA ROOT/components/com_flexicontent/models/items.php

In that file you'll find that a lot of triggers are set up but not really activated.

Around line 1001 or thereabouts in that file, you should see code similar to the following:
Code:
// NOTE: This event isn't used yet but may be useful in a near future $results = $dispatcher->trigger('onAfterSaveItem', array( $item ));

Underneath that, I added the following:
Code:
// THIRD PARTY CONTENT TRIGGER INTEGRATION HACK - trigger com_content's native events JPluginHelper::importPlugin( 'content' ); $dispatcher =& JDispatcher::getInstance(); $results = $dispatcher->trigger( 'onAfterContentSave', array( &$item, $isnew ) );

I literally just looked at code pertaining to Joomla's native content and added it accordingly.

Again, when I tested it last, this appeared to be working. Still, I'd advise experimenting with this in a safe environment before using it on a live site.

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.514 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline