When a candidate applies to a job an email notification is generated and the employer is sent the applicants email address and a link to their resume.

My installation is doubling up a part of url, below is the example.

What is happening; http://myservco.com/jared/jared/user/13
What should be happening; http://myservco.com/jared/user/13

Where is the extra "jared" coming from?

Comments

lapith’s picture

This is my first time working with Drupal and I am also relatively new to PHP in general, but this is the first module that I have been looking at to be used on a site that I am building. I too was having the problem that is described here and was able to find a solution. I am hoping that my solution proves valid and does not break other functionality that I am unaware of.

In the job.module there is a function: function theme_job_mail($job_node, $job_user, $resume_node, $resume_user)

This is the function that puts together the user readable e-mail. In the creation of the body variable you will find where the extra jared is coming from.

$body .= t("\nJob URL: @url", array('@url' => $base_url . "/node/$job_node->nid"));

If you compare the above code with yours you will note that I have taken out the call to the url() and have added a leading '/' to the url string. I just solved this problem and I have not yet done much research into the functionality of the url(), if I find any problems with my solution (or if you find any problems) please let me know.

lapith’s picture

I actually just did a bit more research into the url() and I believe that I found an even better solution to our problem:

As seen in the drupal documentation (http://api.drupal.org/api/function/url/5) there is built in functionality in the url() that will allow us to force an absolute link which is exactly what is needed here! Check out the revised code:

$body .= t("\nJob URL: @url", array('@url' => url("node/$job_node->nid", NULL, NULL, TRUE)));

Also I hate to go on a tangent but I tried to recreate this theme function in my template.php file (naming it mythemename_job_mail) but it did not seem to override the existing function, is this not the correct place to override? I had to actually edit my module code, which I know is not the desired method.

iaminawe’s picture

I can confirm that this is an issue. Only applying the line of code above didn't work for me. Any ideas why?

It seems like a pretty serious issue as having the employer click in the link in the e-mail to view the job hunters resume is a crucial link to be correct.

At current it puts a double version of username and breaks the link after the main url in the e-mail so the link is not clickable.

Thanks

magoo’s picture

Version: 5.x-1.x-dev » 5.x-2.0
Category: support » bug

This is a bug and is also present in the 5.X-2.0 version of the module.

The code used in that version is:

$body .= t("\nJob URL: @url", array('@url' => $base_url . url("node/$job_node->nid")));

why don't we "simply" use the base of the site and just add the job_node related part after ?

--
magoo

Andy Galaxy’s picture

Status: Needs work » Active

#1 Worked for me.

Peace,
Andy

kbahey’s picture

Status: Active » Needs work

Can someone submit a working patch, so the module contains the fix?

iaminawe’s picture

Yes Please... a patch would be appreciated

xamount’s picture

Assigned: Unassigned » xamount
Status: Active » Needs review
StatusFileSize
new1.65 KB

I have attached the patch to fix this issue. I have tested on with both clean urls on and off. community feedback would be appreciated.

kbahey’s picture

Status: Needs review » Needs work

Instead of using $base_url, you can remove it and use the option to make it absolute, like so:

url('blah', NULL, NULL, TRUE);

Makes the code more compact.

xamount’s picture

Status: Needs work » Needs review
StatusFileSize
new1.85 KB

new patch attached.

kbahey’s picture

I assume you tested it and it does the same. Right?

If so, then it is good to go, after you change null to NULL as per code style.

You can commit it. Make sure you checkout DRUPAL-5--2 and commit to it.

For a separate issues, you can run the module thru the coder module to fix all code styles in one go.

xamount’s picture

Status: Needs review » Patch (to be ported)
StatusFileSize
new1.85 KB

Yes I have tested it. I have attached the final patch.

cvs access is blocked at my current location, so I'll commit it a little later. I found some other issue when I ran the coder module. I'll open a separate issue for that....its nothing critical though....just style issues.

kbahey’s picture

Status: Patch (to be ported) » Reviewed & tested by the community

Looks good.

Go ahead and commit it to the DRUPAL-5--2 tag.

xamount’s picture

Status: Reviewed & tested by the community » Fixed

commited

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.