I am using the Rules to create some default group content upon creation of an organic group. The rule is copied below and works well except that the url pattern for the default content is not being generated as I want it to be.

I would like url pattern to be [node:og-group-ref]/content/[node:title] and I have this working for regular group content which is created manually once a group exists.

The problem is that default content created by rules is missing [node:og-group-ref] in the url. If I edit the generated content I see that the setting to 'Generate automatic URL alias' is unchecked. If I then enable this and re-save the url ends up as I need it.

And I am guessing that pathauto is not aware of the og-group-ref value when the node is first created by rules and can not use this token.

I have tried including an action to create a url in the rule, but this seems to get overriden by pathauto.

So my question is - How to set the url alias of a node created by Rules?

{ "rules_og_create_group_content_timetable" : {
"LABEL" : "OG Create group content - Timetable",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules", "og" ],
"ON" : { "node_insert--og_group" : { "bundle" : "og_group" } },
"DO" : [
  { "entity_fetch" : {
      "USING" : { "type" : "node", "id" : [ "node:nid" ] },
      "PROVIDE" : { "entity_fetched" : { "entity_fetched" : "Fetched entity" } }
    }
  },
  { "entity_create" : {
      "USING" : {
        "type" : "node",
        "param_type" : "og_page",
        "param_title" : "[entity-fetched:title] Timetable",
        "param_author" : [ "node:author" ]
      },
      "PROVIDE" : { "entity_created" : { "entity_created__page_stub" : "Created entity page stub" } }
    }
  },
  { "entity_save" : { "data" : [ "entity-created--page-stub" ], "immediate" : "1" } },
  { "og_group_content_add" : {
      "entity" : [ "entity-created--page-stub" ],
      "group" : [ "entity-fetched" ]
    }
  }
]
} }

Comments

MrPaulDriver created an issue.