Not sure if this is a possible bug or a configuration issue and i have searched and not found anything relevant, anyway i have drupal 4.6 and pathauto (i tried the cvs version of pathauto and got the same result) i have the path module and pathauto setup and working with the following patterns;

[vocab]/[catpath]/[title].html
[vocab]/[catpath].html
user/[user].html

So if i do a bulk update pathauto goes and generates all these lovely seo urls which is great, the problem occurs when i go back in and edit a piece of content after the bulk update, so i click edit and can see in the path alias windows the correct url e.g. "category/term/pagetitle.html" but when i click submit it gets changed to just "pagetitle.html" - any ideas?

CommentFileSizeAuthor
#13 pathauto_node_0.inc9.9 KBmikeryan
#12 pathauto_node.inc10.03 KBmikeryan

Comments

mikeryan’s picture

Assigned: Unassigned » mikeryan

What do you have for "Update action" on the pathauto settings page? If it's "Create a new alias in addition to the old alias", and you had a previous alias in the "pagetitle.html" form, that alias will remain and will be the favored one (displayed in the browser address bar).

puredrivel’s picture

I've checked that already i'm afraid, the update action i have set is;

Create a new alias, replacing the old one

So lets say i run pathauto to bulk update all nodes then i go and edit a piece of content called

/vocab/catpath/title.html

i see this in the "path alias:" /vocab/catpath/title.html then lets say i change it to anything it just completeley ignores what ever is typed into this window as well and reverts itself back to an alias of "title.html"

puredrivel’s picture

I've also dumped the contents of the url alias table to see if it was due to some kind of corruption and done the bulk update from scratch and the problem remains.

puredrivel’s picture

Ok well i guess the work around is to set the update action is to "do nothing" then when editing content the alias does not get changed to just be "[title].html" and if i make a manual change to the path alias entry when editing content the manual change is saved correctly.

mikeryan’s picture

I'm a little confused - can you give me a step-by-step of what you're doing (including exactly what you're changing when you edit the node, and what aliases are already in the url_alias table for the node before you start)?

Thanks...

coolhat’s picture

Title: Editing content after bulk update ignores pathauto patterns » Editing content ignores pathauto patterns

I am experiencing the same problem. Please advise of any updates.

puredrivel’s picture

Ok well an example of this is a piece of content i have with the title of;

"Red Hat Enterprise Linux"

It is in the category "Red Hat" and has the term "Enterprise Linux" associated with it and the pathauto path pattern for all nodes is this; [vocab]/[catpath]/[title].html

So the path alias should be;

"red_hat/enterprise_linux/red_hat_enterprise_linux.html"

Which is exactly what happens when a bulk update occurs, so so far everything is functioning perfectly now i want to edit the piece of content note that in the pathauto settings the update action is "Create a new alias, replacing the old one"

When i edit the content it shows the path alias to be "red_hat/enterprise_linux/red_hat_enterprise_linux.html" which is correct, however when i click submit the path alias gets changed to this "red_hat_enterprise_linux.html"

Hope this helps?

- This is using the very latest version changelog file date is 03/10/05 6:08PM

coolhat’s picture

Ok I just switched my hosting provider from my previous one who did not allow "lock tables" mysql permissions and this problem seems to have disappeared. So far so good unless it recurs. Check your logs to see if you are also getting the the same error.

puredrivel’s picture

We host our own server and mysql permissions aren't an issue, although i checked the logs anyway and couldn't generate any error messages when testing edit/updating the content.

mikeryan’s picture

I still can't reproduce this issue, or see any reason in the source for this to happen other than something interfering with the taxonomy terms being available when pathauto_nodeapi() is called. Could someone who is seeing this problem provide a list of contributed modules they're using, particularly any involving taxonomy?

Thanks.

puredrivel’s picture

Currently the list of enabled modules i have is as follows;

attachment
banner
filemanager
forms
glossary
image
img_assist
menu
node
nodelist
path
pathauto
poormanscron
print
search
simplenews
story
taxonomy
tinymce
upload
urlfilter

Seeing as you haven't been able to find anything i'll try and replicate the issue over the next couple of days with a seperate instance/database with maybe just drupal/pathauto and no other modules installed and see what happens.

Thanks for the assistance!

mikeryan’s picture

StatusFileSize
new10.03 KB

Sorry, even enabling that set of modules I can't reproduce it. Here's a couple of thing to try... I'm attaching a version of pathauto_node.inc with some debugging strings added, please try that and let me know what's printed when you edit a node...

mikeryan’s picture

StatusFileSize
new9.9 KB

...and here's one that explicitly loads the taxonomy into the node (it shouldn't be necessary, in my environment the terms are always there, but let's see if it works)...

puredrivel’s picture

Unfortunatley i don't have permission to access those files in your previous posts - do i have to request a higher level of access on the site? Anyway i can confirm that a clean install of drupal + just pathauto doesn't have any issues and functions correctly with 4.6.3 and the latest pathauto so i'm guessing that perhaps another module that i have installed and maybe removed? has knocked the pathauto functionality? Editing content and creating new content create the alias that is defined in the pathauto settings properly with the new instance. So i'm going to move data to the new setup and keep loading modules and see what happens if i can repeat what caused the problem on this new instance i'll post again otherwise i think that the issue can probably be closed. Thanks for all the assistance.

puredrivel’s picture

Ok well i'm postin again because i'm getting the same problem on my new drupal instance, however i've downloaded the pathauto.inc files as suggested and can report that when editing content i see the following when pathauto works

* [cat]=HP_9000
* [vocab]=Hewlett_Packard
* [catalias]=hewlett_packard/hp_9000/index.html
* [catpath]=HP_9000/
* Created new alias hewlett_packard/emulex_lp9002s.html for node/106, replacing emulex_lp9002s.html
* The story was updated.

however when changing to the category/term in my previous post "Red Hat/Red Hat Enterprise Linux" the following happens and obviously pathauto doesn't work;

* [cat]=
* [vocab]=
* [catalias]=
* [catpath]=
* Created new alias emulex_lp9002s.html for node/106, replacing hewlett_packard/emulex_lp9002s.html
* The story was updated.

by the way my pathauto settings for nodes is the following;

[vocab]/[title].html

Perhaps there is a problem in the length number of spaces of the category or term that could be causing the problem???

mikeryan’s picture

Sorry, still can't reproduce it. I was suspecting the slash in the term name, but I created vocabulary Hewlett-Packard with term Red Hat/Red Hat Enterprise Linux, changed my node pattern to [vocab]/[title].html, and edited a couple of nodes to change their category to that Red Hat term - it worked fine.

Did you try that second version of pathauto_node.inc I provided? That one explicitly loads the term info into the node, if it works for you then we know that the issue is that the term info isn't getting loaded automatically into the node in your environment (and we have a work-around just in case I can't figure out why).

Thanks.

puredrivel’s picture

Yeah you're right I don't believe that there is an issue related to the length of the term field or special characters - unfortunatley i tried that second pathauto_node.inc file and i think there maybe a bug in it? as it seems to break my site blank pages when logging in after submitting on editing content etc.

Thanks.

puredrivel’s picture

Or maybe that is a sympton of the issue? A clash with something else maybe?

puredrivel’s picture

Ah should check my logs before posting this is the error recorded in the log

Cannot modify header information - headers already sent by (output started at /var/www/drupal2/modules/pathauto/pathauto_node.inc:270) in /var/www/drupal2/includes/common.inc on line 192.

mikeryan’s picture

Make sure no blank lines crept into the end of pathauto_node.inc (trim anything after ?>).

puredrivel’s picture

Yeah i've double checked that retested etc. with that second one but without success, the first one works fine...

puredrivel’s picture

The site is now live by the way check it out here http://www.icesystems.com.au its been converted over from Mambo which we have been running for the last 2 years.

mikeryan’s picture

Sometimes attachments here end up downloading as HTML (with code highlighting)... Go back to the CVS/4.6 version of pathauto_node.inc and add the following after "if (module_exist('taxonomy')) {" at or about line 152 -

    if (!$node->taxonomy) {
      $node->taxonomy = array_keys(taxonomy_node_get_terms($node->nid));
    }

I think there's something blocking (or removing) the term data from the node object in your environment, this should make sure it's there for pathauto's processing...

Thanks.

puredrivel’s picture

Still no luck i'm afraid although i think you're right something else is blocking the taxonomy information loading when editing the content - one thing i noticed although i don't know exactly how this could cause the issue is i have the following categories for example;

HP BladeSystem
then a bunch of Image Gallery categories
Red Hat Enterprise Linux

what seems to happen is that pathauto correctly work i.e. picks up the taxonomy for categories located before the image gallery categories and cannot for those located after the image gallery categories (alphabetically only i.e. as they are displayed in administer/categories not as they appear in the database) i tested this by creating a new vocab called A with a new term B and another new vocab called Z with a term Y - when changing a story to A/B pathauto worked and a new urlalias was created correctly according to the rules, however when the story was moved to Z/Y it could not pickup the taxonomy and the urlalias was created using the title of the story only, wierd eh?

mikeryan’s picture

Status: Active » Fixed

Got it! The problem was triggered when you had a vocabulary with no selected terms before the first selected term. The select box for the unselected vocabulary results in a 0 at the beginning of the term array, which pathauto was taking as the first term - since there isn't really such a term, nothing gets used for the category. I've changed the code to always call taxonomy_node_get_terms(), to be sure of getting the real list of terms from the database.

Thanks for your patience...

puredrivel’s picture

Ah ha nice work finding the issue mikeryan and i can confirm that it works in my environment as well woohoo!!! However it looks like the fix may have had a knock-on effect so i didn't want to create a seperate report for it, anyway when editing content i noticed that the pathauto alias is only getting updated when submitted the second time, e.g. i create a story called test and put it in a category called "A" then click submit and the page is created but no pathauto alias is created when i edit that content again and just click submit the pathauto alias is then created and when changing the category the change to the path alias only occurs when the content is edited a second time so i'm assuming that the module is not registering that the category has changed on the page and is only reading the change when it occurs in the database. Thanks for the effort!

mikeryan’s picture

Thanks for catching that, I've now fixed my fix...

puredrivel’s picture

Ah that brought back the previous issue where pathauto would work properly when changing to categories listed before the Image Gallery categories but not for ones after and would just create an alias based on the title. :)

mikeryan’s picture

Sigh... Took a shortcut, using the second term if the first was zero, but if you've got three vocabularies and no terms selected from the first two, there are actually two zero entries in the taxonomy array. So, doing it right now - traversing the array until I find a non-zero term.

puredrivel’s picture

Thats the ticket, it works like a charm! Thanks Mike great work!

Anonymous’s picture

Status: Fixed » Closed (fixed)
jamespvg’s picture

Version: » 4.7.x-1.x-dev

I'm having exactly this problem with 4.7-beta-4 and Pathauto 4.7.

Pathauto story type is set to [catpath]/[title].

When bulk updating, this works perfectly. However, when creating a new article, the url is created as [title].