Is there a way to make a link to a user profile conditional on whether the viewer has permission to view user profiles? This functionality exists in the core behaviour for the submitted by text.

So, for example, on a site where only authenticated users are granted permission to view user profiles, anonymous users would see "Submitted by Jane Smith" with no link to the profile page on the name, whereas authenticated users would get the same text but with the link on the name.

I couldn't get the module to do this, so I expect the function doesn't exist, but it would be a nice addition. And it would mean that you can get the full, original core behaviour on some content types, while customizing others.

Comments

NancyDru’s picture

Status: Active » Postponed (maintainer needs more info)

This module does not provide the data; they are provided as tokens. So, if some module provided such a token, it could be used. I don't believe the User or Node modules provide such a token.

pkiff’s picture

I must confess that I am still learning how Drupal processes tokens and variables on a page, and what the order of the processing is. So I'm not sure if this helps, or is just obvious:

The conversion from a plain username to a username with a link, I think happens via the template_preprocess_username, which generates variables that are then plugged into the theme_username function. Is there any possibility of simply duplicating some of that logic? Or does the submitted by module act on the content too late?

NancyDru’s picture

Again, this module does not create the data; it only allows tokens to be used. The User module does not provide such a token.

pkiff’s picture

Got it!

Thanks for all your hard work on the module.

NancyDru’s picture

Status: Postponed (maintainer needs more info) » Closed (works as designed)

No further update.