Hi,

I see that the URL alias gets updated after changing a profile. 

My experiment though is to give user accounts a hashed URL for public sharing, which gets renewed after logging out. [works] . 

So If the hash is e.g. /u/68fbeeef366abf7a75928465c9694eef,  and the user makes a profile update, it becomes /u/56bfadee7352350867f7ccb088870ff7 - which would render the shared link instantly useless (404). 

How can this be disabled? 

Accepted answer

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". 

Comments

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".