I've tried this on a couple servers. Added ads, deleted ads, and tried just about everything.

Everything works great - except

Clicking on an add takes me to /ad/redirect/11/t4/ (or something like it) with a "page not found" error. additionally, clicks are not being counted.

This is a fresh drupal installation. Please help! :)

Comments

g10tto’s picture

also having this issue on a new drupal install.

drjonez’s picture

Priority: Normal » Critical

/ad/redirect/20/@HOSTID___

Sometimes it redirects to that url. HELP

Frank.Poulsen’s picture

I had a similar problem and craeted a patch, which is posted in "Convert base ad.module to Drupal 6", post #12.

The problem is apparently caused by a change to the menu system, so Drupal dont know which handler to use for the redirect.

The patch fixed the redirect problem for me, and I have a working site. Try the patch and please post here if it was successfull.

drjonez’s picture

I got

patching file ad.module
Hunk #1 FAILED at 3.
Hunk #2 FAILED at 58.
Hunk #3 succeeded at 203 (offset -5 lines).
Hunk #4 FAILED at 1260.
3 out of 4 hunks FAILED -- saving rejects to file ad.module.rej

I also changed ad.module to reflect the function in #6 (theme_ad_display)

Ads are still forwarding to something like /ad/redirect/20/t3/

Is there some sort of redirect engine that I'm missing here?

Frank.Poulsen’s picture

drjonez, Im sorry to hear the patch didnt work for you. Have you run any other patches on the ad.module?

The change I had to make was in the function ad_menu(). I added

$items["ad/redirect/%/%"] = array(
      'access arguments' => array('show advertisements'),
      'type' => MENU_CALLBACK, 
      'page callback' => 'ad_redirect',
      'page arguments' => array(2,3));//array($aid, $group, $hostid));

just before the callback section.

If the patch doesnt work for you, you can try to edit it manually.

drjonez’s picture

Thanks for your response.

I changed ad.module to reflect what you have above

Still getting the issue. I even deleted and recreated the ad.

drjonez’s picture

Category: support » bug
Priority: Critical » Normal

Okay, for some reason now it's working. I'm not absolutely sure it's the patch you mentioned that fixed it, but I haven't done anything with it since, so I'm assuming it did.

I'm not really sure how this all works, but I'm going to assign this as a bug that needs to get fixed in future developments

Thanks :)

haagendazs’s picture

@Frank.Poulsen and drjonez: I had the exact same experience as drjones. The patch didn't even start running due to an error message, so I modified lines 1265 through 1270 from ad.module (revision 1.2.2.29.2.83.2.2) with the code from post 5 in this thread. Initially, that didn't work either, but one day later, the ads redirect correctly.

g10tto’s picture

Do you run the patch by adding the ad.module.patch to the ads directory, or do you copy and paste this in?

drjonez’s picture

I just copied and pasted #5 in. The .patch didn't work for me.

jeremy’s picture

Status: Active » Closed (duplicate)

Marking as duplicate. (And here).

g10tto’s picture

Got this working. Thanks!