Masking event title if marked as "private" (Views, Pathauto…) I'm creating a calendar in D7 using an Event content type, which will include a Private checkbox. If it's set:


Users with the appropriate permission will see the node title as it was entered.
Everybody else will see "Private event" as the node title.


How would you approach this? (A code-based solution is fine.) Immediate concerns are ensuring "Private title" gets substituted in regular node displays, views -- and also pathauto URLs. Thanks!



Edit -- Alternate strategy:


Leave the node title alone (as "Private event" if the event is private), which will enable desired pathauto functionality without any changes.
Add a "private title" text field. This is where admin users would enter the actual name of the event, for internal reference.
On display, if the current user has admin permissions, alter the node title to display the private title value.


This seems like it would be a much simpler strategy. What do you think?
hook_node_load() should be suitable for changing the title based on the private status and current user.

Changing the path will be the hard bit.

Pathauto can only have 1 configuration per bundle so you'll need to use hook_node_insert() and hook_node_update()
to act on events being added or altered to set the private path alias. path_save() can be used to actually save the new alias, but you will need to code the logic to come up with the alias yourself. This post on drupal.org may help.

Once the additional alias is set you will need to make sure to use the correct alias when building links to the content based on the current users permissions.