Hi,
thanks for the great module, I have only a big problem with redirection. As soon as I enable Cache I'm redirected only for first time to external URL, after that I'm landing on page with the title "Redirect Ads" ( /simpleads/redirect/[nid] ).

I would appreciate any help with this issue.

Thanks,
Damian

Comments

miro_dietiker’s picture

Project: Simplenews » SimpleAds

This queue is about Simplenews, not Simpleads. Redirecting.

cocoonfx’s picture

Version: 7.x-1.x-dev » 7.x-1.8

I have the same issue... I have 4 ads 3 or them work and the 4th one doesn't. Needs a rapid fix..

minnur’s picture

Please give this module a try http://drupal.org/project/cacheexclude (I haven't test it myself).

minnur’s picture

Assigned: Unassigned » minnur
Status: Active » Needs review
bxtaylor’s picture

StatusFileSize
new569 bytes

Changing this line: header("Location: " . $url); to drupal_add_http_header('Location', $url); seemed to fix the bug for me.

Patch attached.

Status: Needs review » Needs work

The last submitted patch, cache-redirect-1652880-5.patch, failed testing.

bxtaylor’s picture

Edit: that was against 7.x-1.x-dev

bxtaylor’s picture

Version: 7.x-1.8 » 7.x-1.x-dev
bxtaylor’s picture

Status: Needs work » Needs review

#5: cache-redirect-1652880-5.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, cache-redirect-1652880-5.patch, failed testing.

bxtaylor’s picture

Err...I'm guessing the TestBot doesn't work for contrib. Sorry for the flood.

minnur’s picture

No problem, once someone else confirm this patch works then I will apply it manually.
Thanks for sharing this.

bayousoft’s picture

#5 fixed the issue for me as well.

Arngrim’s picture

#5 did the trick for me, too

thetoast’s picture

This works with drupal cache, but it doesn't work if you're using the boost module.

jamix’s picture

StatusFileSize
new546 bytes

I'm wondering why header() is used for redirection at all. Changing it to drupal_goto() fixed the issue in Boost as per #1176534: Bypass caching on redirects. Please test with core caching, patch attached.

jamix’s picture

Status: Needs work » Needs review
minnur’s picture

Status: Needs review » Needs work

The last submitted patch, simpleads-cache-redirect-1652880-16.patch, failed testing.

Lann’s picture

The issue is in the business logic behind what is going on. Most users ads probably link to external pages so why would an administrator want to view the ad node when clicking his own ads? I removed this piece and changed it so that it simply does not record clicks for administrators but still redirects the user.

Replace the code at line 399 with this:

if (!user_access('administer nodes') && !user_access('access ad node')) {
// Only save the click for non administrators
_simpleads_save_click($node);
}
$url = _simpleads_validate_url($url);
module_invoke_all('simpleads_redirect', $url, $delta);

http://www.minus-reality.com

minnur’s picture

Please try install development release. Similar issue: #1555988: Memcache problems on redirect?

minnur’s picture

Status: Needs work » Closed (duplicate)