Login or create new account.

By registering on joomprod.com, you will have immediate access to all our free products and to the public side of our support forum.

Enjoy our subscriptions.

Each of our subscriptions allow you to enjoy the private side of the support forum and all the update of our products for a period ranging from 3 months to 1 year.

Payment And immediate download.

After subscribing to one of our subscription, the products are immediately downloadable.

Login

Or Register
Accueil / forum / Public Forum / Main Forum / ADSonContentBeforeSave event is useless

Support Availability Because we must sleep sometimes

Working days: Monday to Friday.
Reply time: Depending on the complexity of your support issue it's usually between a few hours to 48 hours.

Support is only guaranteed to paid subscribers

AdsManager - End of life

It is with great regrets that we have chosen to end the developpement of Adsmanager and its other associated components.

AdsManager is born 10 years ago and, as of today, the number of new subscriptions and downloads have fallen and we cannot maintain the component anymore.

All active subscribers will be able to continue enjoying support until the end of their subscription.

The components will be free and no support will be provided anymore for the other users.

×

Notice

The forum is in read only mode.

× OLD Forum post could be checked here : forum.joomprod.com

ADSonContentBeforeSave event is useless

More
11 years 7 months ago #10358 by thekrotek
ADSonContentBeforeSave event is useless was created by thekrotek
I've been trying to utilize ADSonContentBeforeSave even in my plugin, but it seems absolutely useless. This line:
$results = $dispatcher->trigger('ADSonContentBeforeSave', array ());

It dosen't pass any variables at all. There's nothing you can change before save. For example, if you try to do any changes to ad_text field, this will be impossible, because the whole post array is being processed BEFORE this event:
$content->bindContent(JRequest::get( 'post' ),JRequest::get( 'files' ), $conf,$this->getModel("adsmanager"),$plugins);

So if you even try to catch the input using JRequest::getVar('ad_text', ''), changes will not be saved.

I remember it worked once at least on front-end, but looks like you've changed something and now it doesn't work at all.

The fix it actually pretty easy: just add a $content object to your event trigger:
$results = $dispatcher->trigger('ADSonContentBeforeSave', array (&$content));

This will allow you to change anything you want.
More
11 years 7 months ago #10377 by loic
Replied by loic on topic ADSonContentBeforeSave event is useless
Hello,

Did you load the adsmanager plugins before calling this function ?

Like that :
$dispatcher = JDispatcher::getInstance();
JPluginHelper::importPlugin('adsmanagercontent');

Best regards.
More
11 years 7 months ago #10381 by thekrotek
Replied by thekrotek on topic ADSonContentBeforeSave event is useless
No, why should I?

I did as always and just defined a function in my plugin:
public function ADSonContentBeforeSave()
{
    // Some code.
}

Plugin is already in adsmanagercontent group. Never been in a need to run dispatcher in plugin, which is in the same group and utilizes the same event.
More
11 years 7 months ago #10403 by loic
Replied by loic on topic ADSonContentBeforeSave event is useless
Hello,

Sorry I thought you had modified the file that trigger this function.

I will run some test to see why you need to add a parameters.

Best regards.
More
11 years 7 months ago #10415 by thekrotek
Replied by thekrotek on topic ADSonContentBeforeSave event is useless
Well, I already told you, that it's impossible to affect content, because posted data is binded to $content object BEFORE trigger and event itself doesn't pass any variables. I need to change ad text, when ad is saved, for example. Not possible.
More
11 years 7 months ago #10452 by tompap
Replied by tompap on topic ADSonContentBeforeSave event is useless
It's right that no param is passed to the function.

I see the point of adding $content.
Right now we had only 1 plugin using this event, and $content was not needed.

A possible solution is to alter $POST and $GET data, but I agree that is not the best solution.

We will see if we can improve this for 3.0.5
Moderators: perry
Time to create page: 0.355 seconds
Powered by Kunena Forum