The current workaround was to leave the global User URL alias pattern empty and let Rules alone handle user URL aliases, based on the profile field condition ("Anonymize Share Link?: Yes/No").
Condition when the user has "Yes" in the profile
- Generates e.g. "u/c5feff54e401c615c66f0973daa90744" as MD2
{ "rules_change_user_url_alias_yes" : {
"LABEL" : "Change user URL alias (Yes)",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules", "path" ],
"ON" : { "user_logout" : [] },
"IF" : [
{ "data_is" : { "data" : [ "site:current-user" ], "value" : [ "site:current-user" ] } },
{ "data_is" : {
"data" : [ "account:profile-privacy:field-anonymize-share-link" ],
"value" : "Yes"
}
}
],
"DO" : [
{ "path_alias" : { "source" : "user\/[account:uid]", "alias" : "u\/[random:hash:md2]" } }
]
}
}
Condition when the user has "No" in the profile
- Generates"u/johndoe"
{ "rules_change_user_url_alias_no" : {
"LABEL" : "Change user URL alias (No)",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules", "path" ],
"ON" : { "user_logout" : [] },
"IF" : [
{ "data_is" : { "data" : [ "site:current-user" ], "value" : [ "site:current-user" ] } },
{ "data_is" : {
"data" : [ "account:profile-privacy:field-anonymize-share-link" ],
"value" : "No"
}
}
],
"DO" : [
{ "path_alias" : { "source" : "user\/[account:uid]", "alias" : "u\/[account:name]" } }
]
}
}
Anyone interested can paste this in the rules import (and use any event). These are two separate rules. Again, this happens after logout.
The profile field field_anonymize_share_link
will be required, or replaced with an own name. The profile is called "Privacy".
The current workaround was to leave the global User URL alias pattern empty and let Rules alone handle user URL aliases, based on the profile field condition ("Anonymize Share Link?: Yes/No").
Condition when the user has "Yes" in the profile
- Generates e.g. "u/c5feff54e401c615c66f0973daa90744" as MD2
{ "rules_change_user_url_alias_yes" : {
"LABEL" : "Change user URL alias (Yes)",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules", "path" ],
"ON" : { "user_logout" : [] },
"IF" : [
{ "data_is" : { "data" : [ "site:current-user" ], "value" : [ "site:current-user" ] } },
{ "data_is" : {
"data" : [ "account:profile-privacy:field-anonymize-share-link" ],
"value" : "Yes"
}
}
],
"DO" : [
{ "path_alias" : { "source" : "user\/[account:uid]", "alias" : "u\/[random:hash:md2]" } }
]
}
}
Condition when the user has "No" in the profile
- Generates"u/johndoe"
{ "rules_change_user_url_alias_no" : {
"LABEL" : "Change user URL alias (No)",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules", "path" ],
"ON" : { "user_logout" : [] },
"IF" : [
{ "data_is" : { "data" : [ "site:current-user" ], "value" : [ "site:current-user" ] } },
{ "data_is" : {
"data" : [ "account:profile-privacy:field-anonymize-share-link" ],
"value" : "No"
}
}
],
"DO" : [
{ "path_alias" : { "source" : "user\/[account:uid]", "alias" : "u\/[account:name]" } }
]
}
}
Anyone interested can paste this in the rules import (and use any event). These are two separate rules. Again, this happens after logout.
The profile field
field_anonymize_share_link
will be required, or replaced with an own name. The profile is called "Privacy".