Preventing item to publish

More
11 years 4 months ago #38665 by rubenreyes
Hello,

I am looking for comments on a mechanism a want to implement that automatically prevents an item to become published when certain conditions occur.

Here is the situation:

We are developing a custom field that allows the user to upload a video to a 3rd party video streaming service.

Once the video is uploaded it needs to be transcoded. This process can take several minutes. After the video is transcoded, we receive the video ID number via an API.

I want to prevent the item from been published during the period while the video is transcoded. Even if the user changes the status to Published, it will be automatically changed to Unpublished or Draft.

So this is what we were thinking, and wanted to hear your opinion:

Option 1: As part of our custom field we would include some logic in the onAfterSaveField function that would change the item status.

Option 2: Create a plugin that would be triggered with onAfterContentSave event that takes care of changing the status (does Flexicontent trigger this event?)

Let me know your thoughts.

Thank you

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

More
11 years 4 months ago #38666 by ggppdk
Replied by ggppdk on topic Preventing item to publish
Hello,
FLEXIcontent triggers:
a. onAfterSaveField for plugins of type:
flexicontent fields

b. onAfterContentSave for plugins of type:
content
(the content of triggering this is 'com_content.article' and not 'com_flexicontent.item' for compatibility reasons)

c. onAfterSaveItem and onCompleteSaveItem for plugins of type:
flexicontent


-- NOTE: the user may change the item state without editing a content via the "state toggler" icon, but you can catch this because FLEXIcontent triggers the onContentChangeState

... but because the state is overwritten after calling the event, please add this fix:

in file: administrator/components/com_flexicontent/models/parentitemclass.php
change line:
Code:
JRequest::setVar('view', $fc_itemview); JRequest::setVar('option', 'com_flexicontent'); $item->state = $fc_state;
to:
Code:
JRequest::setVar('view', $fc_itemview); JRequest::setVar('option', 'com_flexicontent'); if ($item->state == $jm_state) $item->state = $fc_state;


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

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

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.449 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