I have a custom php file that is used to create nodes, and it is sitting two directories off of the drupal root like this:

drupal_root/folder_1/folder_2/custom.php

When a node is created via that script, I have a rule that emails the administrator the aliased path to that node. The alias should be like this:

http://domain.com/9384024834

However, the URL being sent is:

http://domain.com/folder_1/folder_2/9384024834

I think this has something to do with a chdir in order to bootstrap Drupal. Here's how it is done in my custom.php file:

chdir('../../../drupal_root');
    define('DRUPAL_ROOT', getcwd());
    require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
    drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

Any solutions?

Comments

nevets’s picture

Is the actual path alias incorrect or is it only the path in the email?

bpeicher’s picture

It is only the path in the email. The actual path is correct. Very strange...

bpeicher’s picture

In the rules email I am using [node:url]

nevets’s picture

I would guess the token is incorrect in this case.

How about instead of [node:url] try [site:url]/node/[node:nid]. (Note I am guessing at the token strings, they may need to be adjusted)

bpeicher’s picture

It had something to do with where the file was - I created a custom module and the problem is fixed. Thanks for the feedback!