2

I am developing a module that uses Paypal's IPN callback. So in my module code I need to put in the IPN URL.

But in EE the module is called using template tags, so it could be accessed by any URL that any EE developer decides to put the module on (the template group and name).

Is it possible to call the module without going through the EE template group and name? e.g. www.mydomain.co.uk/mymodule/paypalipn

I could probably still pass the IPN URL depending on what template we are on, but I am also only allowing logged in users to access this module, but the IPN should not be for logged in users. The login script is controlled in the template. I dont want to have to write conditionals in the template whether its the IPN method or not. Hope that makes sense!

Thanks

4

Yes via ACTion URLs, tutorial here.

Basically in your install method (in your upd. file):

    //###   Create ACTion IDs for the relevant functions   ###
    $formActions = array(
        "YOUR-METHOD-NAME"
    );
    foreach ($formActions as $method) {
        $data = array(
            'class' => $this->class,
            'method' => $method
        );
        $this->EE->db->insert('actions', $data);
    }//###   End of foreach

This then creates Action ID that will trigger your modules method (in mod. file) - see exp_actions table for other ACTion IDs for other modules.

Some modules display the ACT URL in the backend settings (e.g. for setting up a cronjob), others will have a frontend tag that will output the link, either way get the ACTion ID like so:

$actionID = $this->EE->functions->fetch_action_id(__CLASS__, 'YOUR-METHOD-NAME');

Typically a URL will look like this:

www.your-domain-name.com?ACT=45

Can also be done via POST data (so {site_url} for the form action and hidden field for ACT value).

| improve this answer | |
  • Of course! ACT. I see that everywhere and never really made the connection! Will try this out and get back to you. I also have a cron job script too. Thanks! – Laurence Cope Aug 22 '13 at 17:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.