Steps to reproduce:

1) Add a group type 'My Group'

2) Create a pathauto pattern for the group type just created (/admin/config/search/path/patterns/add)
(select 'group' from Pattern type dropdown)
(check 'My Group')
pattern: all-groups/[group:title]

3) Clear all caches

4) Add a group (/group/add/my_group)
title: 'Pizzaioli group'

5) The new group is now available ONLY at /group/1
and not at /all-groups/pizzaioli-group as expected

6) clear the cache just to be sure: does not resolve

7) Edit the group (just save it at /group/1/edit

8) Now the alias has been correctly created:
/all-groups/pizzaioli-group

Please fix this: the pathauto alias should be immediately available at group creation an not only at group edit/save

Thank you!

PS: tested also on simplytest.me -> https://dazi.ply.st/ (until available)

2018-04-17 UPDATE: the issue is thrown ONLY when the option:

Group creator must complete their membership

Is checked on the group edit settings.

(so when a further step is necessary to fill membership details)

Unchecking the above field (that it is fine only when there are no fields to fill in the membership relation) pathauto do correctly its work and the group alias is correctly created.

Comments

MXT created an issue. See original summary.

joshuami’s picture

I saw something similar. This appears to be a bug in pathauto: https://www.drupal.org/project/pathauto/issues/2950701 that has a patch in process.

joshuami’s picture

joshuami’s picture

That patch does not fix this issue, but I do think the issue has to do with traversing the parent:child relationship between entities. (The other issue was reported on a book page not inheriting its book hierarchy on node creation.)

mxt’s picture

UPDATE: the issue is thrown ONLY when the option:

Group creator must complete their membership

Is checked on the group edit settings.

(so when a further step is necessary to fill membership details)

Unchecking the above field (that it is fine only when there are no fields to fill in the membership relation) pathauto does correctly its work and the group alias is correctly created.

mxt’s picture

Issue summary: View changes
joshuami’s picture

@MXT, thanks for posting that work around. It suggests that the node save is being interrupted by the membership entity. I don't believe the related issue I added is applicable. I'm removing that.

hlopes’s picture

This also happens if there's an image field on the group (but only if you add an image).
Even with "Group creator must complete their membership" unchecked.

Meaning

UPDATE: the issue is thrown ONLY when the option:

Group creator must complete their membership

is not correct.

I've also noticed that replacing the method in the patch at #2950701 to ->createEntityAlias works.

/**
 * Implements hook_entity_insert().
 */
function pathauto_entity_insert(EntityInterface $entity) {
  \Drupal::service('pathauto.generator')->createEntityAlias($entity, 'insert');
}
ac’s picture

Also happens when there is a file field on the group. This seems like a bug (not sure if it is in pathauto or group).

bobbygryzynger’s picture

I am also seeing this behavior. Some debugging shows that, for whatever reason, pathauto_entity_insert is not called after group creation.

lolcode’s picture

I can confirm #5, #8 and #10.
The group will not get an url alias in either of these two cases:

  • "Group creator must complete their membership" is turned on
  • A file or image field attached to that group is populated during group creation

If both of the above are false then the url alias will be generated correctly.

lolcode’s picture

This issue has been reported more generally against Pathauto.
The second related issue I am adding provides a patch that fixes this for me.
"Alias is not generated when Pathauto widget is hidden"