When I create a node it does not give me the new alias. But when I run the bucl update function under node path settings, it works fine?!

CommentFileSizeAuthor
#20 new_node_no_pid_bulk_175830.patch2.08 KBgreggles

Comments

greggles’s picture

Status: Active » Postponed (maintainer needs more info)

which kinds of aliases?
what is your pattern setting?

storbaek’s picture

I had to give it some testing before coming back to you. It's really strange as it has worked before, but now I can only update using batch operation.

I'm using the newest version (5.x-2.x-dev) and token version 5.x-1.x-dev. I cannot get it to work with any titles when I add any type of content. I've done a lot of scenario testing, but I have no more ideas to test. I have also tried to remove pathauto, download a new version and install this. Same problem!!

greggles’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

Closing because there are no concrete steps to repeat the issue and nobody else has reported this

I suggest visiting update.php and also submitting the "admin/build/modules" page as that may clear a cache that is causing a problem.

blockedmind’s picture

have the same problem here.
drupal 5.3 w/ pathauto-5.x-2.0

blockedmind’s picture

term based tokens do not work, while creating a node. but it succesfully creates aliases via bulk generation on the pathauto page.

blockedmind’s picture

term based tokens do not work, while creating a node. but it succesfully creates aliases via bulk generation on the pathauto page.

blockedmind’s picture

term based tokens do not work, while creating a node. but it succesfully creates aliases via bulk generation on the pathauto page.

greggles’s picture

Status: Closed (fixed) » Active

@blockedmind - did you run the update.php?

blockedmind’s picture

@greggles - yes, i've tried it many times. nothing changes. why only taxonomy based tokens broke up? why does it only happens only when creating a node?

greggles’s picture

Status: Active » Postponed (maintainer needs more info)

blockedmind, I don't know why this happened. In general the taxonomy support got much better in the 2.x version.

What is your pattern for the content type(s) where this doesn't work?

blockedmind’s picture

[term-raw]/[title], [term]/[title] or anthing has "term" in it do not work as I said before.

greggles’s picture

You said term based, but that didn't make it clear which pattern. Since they come from different places I wanted to be sure.

Are you creating nodes via the node/add/etc interface or via an external tool and xmlrpc?

Another question, if you create a test site and install everything from scratch does it happen again?

blockedmind’s picture

i am creating nodes via the node/add/etc interface...
didn't try, not sure whether if gonna happen on a test site, it was working at first, i don't know what cause this occur, maybe a module installed later? is there any previously convicted module or setting for that?

greggles’s picture

@blockedmind - this isn't familiar to me, that's why I'm suggesting the test site. Then you can start from scratch with only pathauto and token and taxonomy and see if it's happening. If not, you add more and more modules/settings copying the site where the problem exists until you find the one module that causes the problem.

storbaek’s picture

blockedmind, I have the exact same issue. It did work, but not anymore. Only with batch operation does it work. I've been testing with [title] and [title-raw], but I cannot even get that to work. It could be some other module interferring that stops it from working. I am running on a test site, but a rather complex site, which is why I haven't started from scratch again.

kecinzer’s picture

It doesn't work, because, "Automatic alias" is not selected when I crating a new node.

kecinzer’s picture

And here is the problem:

function pathauto_form_alter($formid, &$form) {
  if (isset($form['#id']) && ($form['#id'] == 'node-form')) {
    $pattern = variable_get('pathauto_node_'. $form['type']['#value'] .'_pattern', FALSE);
    if (!$pattern) {
      $pattern = variable_get('pathauto_node_pattern', FALSE);
    }
    $path = $form['path']['path']['#default_value'];
    $pid = db_result(db_query("SELECT pid FROM {url_alias_extra} WHERE dst = '%s'", $path));
    if ($pattern && user_access('create url aliases')) {
      $output = t('An alias will be generated for you. If you wish to create your own alias below, untick this option.');
      if (user_access('administer pathauto')) {
        $output .= t(' To control the format of the generated aliases, see the <a href="@pathauto">Pathauto settings</a>.', array('@pathauto' => url('admin/settings/pathauto')));
      }

      drupal_add_js(drupal_get_path('module', 'pathauto') .'/pathauto.js');

      $form['path']['pathauto_perform_alias'] = array('#type' => 'checkbox',
        '#title' => t('Automatic alias'),
        '#default_value' => $pid, // this is not working, or I don't know, where set.
        '#description' => $output,
        '#weight' => 0
      );
    }
  }
}
greggles’s picture

I found that one some of my sites they weren't being created only for certain users.

Since you posted code I assume you have a solution - if so can you post it as a patch?

http://drupal.org/patch/create

Otherwise I'll look into this and find a solution.

Thanks.

Nueaf’s picture

I'm very new to Drupal, only second day of messing with it. So not sure if this is the "correct way" to fix it. But adding:

'#attributes' => array('checked' => 'checked')

To the checkbox after '#weight' => 0, does the trick for me. Hope that it's helpfull.

greggles’s picture

Category: support » bug
Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new2.08 KB

@Nueaf - your fix ignores the functionality of "if an alias was created by hand then leave the checkbox unchecked on subsequent edits".

Here's a patch that I believe fixes this problem by checking to see whether the path exists before looking it up in the DB and also checks whether.

I believe that this is a slightly different problem from what storbaek and blockedmind were discussing so when we fix this we'll create a new issue for that...

greggles’s picture

Status: Needs review » Fixed

This was annoying enough that I've committed it perhaps a bit faster than anyone could be expected to test/review it. Post-commit reviews are, of course, always welcome.

@blockedmind and @storbaek - I know this wasn't the same as your problem so I created a new issue for the problem we were originally discussing - http://drupal.org/node/194996

Anonymous’s picture

Status: Fixed » Closed (fixed)

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

blockedmind’s picture

Status: Closed (fixed) » Active
greggles’s picture

@blockedmind - care to leave a comment why you re-opened this issue?

blockedmind’s picture

can it be just because the issue is not "fixed" at all?

greggles’s picture

The fix was committed to the 5.x-2.x-dev branch. While that has bugs, can you confirm whether using that on a *test* site removes the problem for you?

greggles’s picture

Status: Active » Closed (fixed)

@blockedmind - also, I created a separate issue for your problem - http://drupal.org/node/194996

Let's move discussion of your problem there since this issue got turned into a similar but different problem.