Active
Project:
Auto Expire
Version:
6.x-1.0-rc1
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Reporter:
Created:
21 Apr 2008 at 19:28 UTC
Updated:
16 Sep 2010 at 21:04 UTC
I am using drupal 5.7 and 5.x-1.0 of auto expire. I have clean URLs turned on. I received an email with an expiration notice for a node, but the URL was malformed. It left the actual site address out. The exact form received was: http:///node/86
What could cause that?
I set this up in a test environment before loading it into production and it worked fine, but I had a slightly different version of Drupal (5.4) and no clean urls.
Comments
Comment #1
marcvangendBrad, I know this issue has remained unanswered for a long time, sorry about that. Have you ever discovered the cause of this error? I'm trying to figure out if we still have to look into this, or if this issue can be closed.
Comment #2
jontyler commentedI see this incorrect behavior on D6.0 using Auto Expire 6.x-1.0-rc1. The offending code fragment appears to be in:
function _auto_expire_notify_warning($nid, $title, $type, $days, $subject, $body $args = array(
'!type' => $type,
'!title' => $title,
'!url' => url('node/'. $nid, array('absolute' => TRUE)),
'!days' => $days,
'!date' => format_date(_auto_expire_get_expire($nid)),
'!daysleft' => format_interval(_auto_expire_get_expire($nid) - time()),
'!site' => variable_get('site_name', ''),
'!siteurl' => url('', array('absolute' => TRUE)),
);
But I don't know how to fix it.
Comment #3
marcvangendJon, thanks for your bug report.
The url() function is used correctly in that chunk of code (see http://api.drupal.org/api/function/url/6) so I'm wondering if it has anything to do with your site configuration (like it was in #243468: Reminder email links don't have the site's domain). Can you check your settings.php to see if the $base_url variable has been set? If set, make sure it is correct. If not set, then set it and see if that solves the problem.
Comment #4
jontyler commentedmarcvangend, thanks for your quick support!
I made the change to $base_url as you suggested.
Because I didn't expect such a fast response, I did some digging and came up with the API (I probably shouldn't be there). But according to http://api.drupal.org/api/function/url/6 , shouldn't 'external' => TRUE be defined to guarantee an external url. Please pardon my ignorance, but I just don't know.
Thanks again,
Jon
Comment #5
marcvangendJon, if you like to know more about the internals of Drupal, you're definitely invited to the API documentation.
The 'external' option is meant to create url's that are outside the current Drupal installation. For instance, compare these two lines of code:
Since Auto Expire is generating a url inside it's own Drupal installation, 'external' is not applicable here. However the 'absolute' option is TRUE, because we want Drupal to include http:// and the base url so it will also work when clicked from an email.
Anyway: you say you changed the $base_url variable, but does it actually work?
Comment #6
jontyler commentedThanks for the explanation.
I won't know until 11/04/2009 if the change worked. That's when the next piece of content is set to expire. Is there a way to test it?
Comment #7
marcvangendAre you using the devel module? If you do, enable the 'Execute PHP' block, enter
print url('node', array('absolute' => TRUE))and click the 'execute' button. If all is well, you will see the correct url to the /node page printed in the messages area on your page.Comment #8
jontyler commentedI'm not using the devel module (yet), but I had one come through this morning that appears to work. I had replaced !url with !siteurl, but I received a valid link to the site, so unless it reverts, thank you.
Comment #9
yymoto2 commentedI'm using Auto Expire 6.x-1.0-rc1, some strange behavior appear on the '!url' and '!siteurl' field when email received, sent out using the default auto expire email message, both appears as follow, it doesn't convert my base url properly:
!siteurl:
http://default/home/my_folder/html/mydomain.com/public/scripts/
!url
http://default/home/my_folder/html/mydomain.com/public/scripts/path/to/node
However, when I added a trailing space immediately after both '!url' and '!siteurl' into the auto expire email message that's going to send out:
!siteurl(space)
!url(space)
both url in the email message received appears to convert my base url properly, except this time it becomes http'S' instead of http (I have ssl enabled):
!siteurl:
httpS://www.mydomain.com/
!url:
httpS://www.mydomain.com/path/to/node
Does anyone have any comment on this? Why is it behave so?
Comment #10
pobster commentedOne reason people are getting weird output is because variable_get in the module has no default set for site_name, the correct way to retrieve the variable is to use;
variable_get('site_name', 'Drupal');Else Drupal does tend to get a bit confused.
I will address this (and other issues) when I get home from work tonight on http://drupal.org/node/313280.
Pobster
Comment #11
weka commentedI am using Auto Expire 6.x-1.0-rc1 with the Expiration Warning Notification Email template as follows:
The Email body sent out has 'http://default/node/25' instead of 'http://www.example.com/node/25' in the message body.
Everything else is working fine.
Thank you very much for the otherwise great working module.