Just installed the 6.x-1.x-dev version from May 14 and when I set up path auto using the following tokens, the tokens show up in the path instead of the desired alias

[parent-node-gallery-path] The path of the parent Gallery.
[parent-node-gallery-path-raw]n Unfiltered path of the parent Gallery. WARNING - raw user input.
[parent-node-gallery-title] The title of the parent Gallery.
[parent-node-gallery-title-raw] Unfiltered title of the parent Gallery. WARNING - raw user input.

Here's a path example

gallery/[parent-node-gallery-path-raw]/p5190348jpg

Comments

dddave’s picture

Version: 6.x-1.x-dev » 6.x-2.0-alpha9

Could be a support request but I suspect it to be a bug. ;)

I only manage to get paths like in the example above. Tried various replacements but no success. Is this supposed to work already?

dddave’s picture

Title: Path auto » Path auto problems - replacement patterns not working
dddave’s picture

Priority: Normal » Critical

Bumping priority because this could really affect the usability on a live site.

Has anybody else tested the replacement patterns?

dddave’s picture

Version: 6.x-2.0-alpha9 » 6.x-2.x-dev

correct version

dddave’s picture

Version: 6.x-2.x-dev » 6.x-2.0-alpha10

issue still exists

blueminds’s picture

The token replacements work fine when images are uploaded into gallery as at that moment $node object caries the gid value. However, when you edit an image through regular node edit form the gid value is not present and therefore the token replacements do not work. Here is a fix that work for me:

function node_gallery_token_values($type, $object = NULL, $options = array()) {
  $tokens = array();
  
  if ($type == 'node' && in_array($object->type, (array)node_gallery_get_types('image'))) {
  	
        //if there is no gid value, find it out
  	if (!is_numeric($object->gid)) {
  	  $gallery = db_fetch_object(db_query("SELECT * FROM {node_galleries} WHERE nid = %d", $object->nid));
  	  $object->gid = $gallery->gid;  		
  	}
  	
    $parent_path = 'node/'. $object->gid;
    if (module_exists('path')) {
      $parent_path = drupal_get_path_alias($parent_path);
    }
      
    // Load up the title of the parent
    $parent_title = db_result(db_query("SELECT title FROM {node} WHERE nid = '". $object->gid ."'"));
    $tokens['parent-node-gallery-path'] = decode_entities(check_plain($parent_path));
    $tokens['parent-node-gallery-path-raw'] = $parent_path;
    $tokens['parent-node-gallery-title'] = decode_entities(check_plain($parent_title));
    $tokens['parent-node-gallery-title-raw'] = $parent_title;

    return $tokens;
  }
}
dddave’s picture

Status: Active » Needs review

What do the maintainers think?

dddave’s picture

Version: 6.x-2.0-alpha10 » 6.x-2.x-dev

Looks like the .dev from 01/07 still has this problem.

Is #6 a good fix?

kmonty’s picture

dddave and anyone else:

Have you tested this patch? Any issues?

kmonty’s picture

Assigned: Unassigned » kmonty

Will commit with more review

kmonty’s picture

Status: Needs review » Postponed (maintainer needs more info)

Okay. Using the latest dev branch, I *cannot* verify this issue exists.

Steps taken:

1) Set Gallery pathalias to "gallery/[title-raw]"
2) Set Gallery Image to "[parent-node-gallery-path-raw]/[title-raw]"
3) Created a gallery that resulted in the path "/gallery/sample-gallery"
4) Uploaded four images that resulted in "/gallery/sample-gallery/image#"
5) Deleted the path aliases for the images
6) Went to node/13/edit (a gallery image node), checked "Automatic Alias" and saved.
7) The path alias had returned to "/gallery/sample-gallery/image13"

What is the problem people are having? Can I get exact steps to test?

dddave’s picture

No problems on my side - just to dump to use it correctly I suspect. Sorry for the inconvenience.

dbeall’s picture

using alpha10... save node, token works.. edit node token is as [token-raw].. delete url alias, bulk generate aliases, the proper path is generated.

edit.. The #6 fix works in alpha 10 for me to

dbeall’s picture

clarifiy...alpha10
Steps taken:

1) Set Gallery pathalias to "gallery/[title-raw]"
2) Set Gallery Image to "gallery/[parent-node-gallery-path-raw]/[title-raw]"
3) Created a gallery that resulted in the path "/gallery/sample-gallery"
4) Uploaded four images that resulted in "/gallery/sample-gallery/image#"
5) Went to gallery, edit image name or file name (a gallery image node), "Automatic Alias" is checked
6) Save changes
6) The path alias had returned as "/gallery/[parent-node-gallery-path-raw]/image13"

IF
1) goto url alias and delete that alias, then bulk generate node aliases with pathauto, generates proper path.

#6 fixes it.. Live site. Very nice module, I just love it!

dbeall’s picture

@ddave, i did have your original issue at first just after install and set up.. the token didn't work, don't know what made it start working.. It may have been a cron run or cache clear.. that is actually a different issue than path token after editing an image node.. I guess we may have 2 issues going here?? just thought i would speak up so you don't go crazy about it.

dbeall’s picture

@future assassin, @kmonty, @dddave, and others that may be interested...
I just did a new install of 6.x-2.0-alpha10 on live site and the tokens worked just fine right from the start, no hang ups, no problems..
I had patched alpha10 with #6 divamys fix before uploading module. Great module !

dddave’s picture

As I stated in #12 I got it working. It was a mistake on my side.

dddave’s picture

Status: Postponed (maintainer needs more info) » Fixed

So this is working fine now for everybody?

kmonty’s picture

Status: Fixed » Postponed (maintainer needs more info)

It should like @dbeall needed to patch the module before it worked. I'll have to look into the suggested code snippet.

kmonty’s picture

Status: Postponed (maintainer needs more info) » Needs review
kmonty’s picture

Status: Needs review » Fixed

I adapted some of the changes from #6. If anyone was continuing to experience issues, it should be fixed by this commit.

Status: Fixed » Closed (fixed)

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