0

I have a user role called "Residents" in D7, and created a view the show profile information. I want to add colorbox to the User Picture, but there is only one token available [picture]. How do I add the image path as the destination if I can only use one token (see attachment)?

The Rewrite option for this field only allows for one token to be used.

3
  • If you haven't got live users on the site, now is the time to stop using user picture and add an image field to the user entity instead. Much easier to work with, and you can then install modules that work with image fields and have them work right away. Commented Jul 27, 2018 at 18:05
  • I believe there’s active users, but a high percentage of them don’t have profile pictures. So that may be a good solution. Thanks! Commented Jul 28, 2018 at 1:50
  • I'll write it up as an answer. Commented Jul 28, 2018 at 12:37

2 Answers 2

0

Please take a look at these two solutions:

https://www.drupal.org/node/2396813#comment-11571515

and

Getting user photo url and profile url using views_json

0

Generally I would advocate using an image field on the user entity over the legacy user picture feature. The latter has a lot of limitations and you have just discovered one of them. If you try solving this issue by in the theme layer you'll find in the template that all you have to work with is an opaque "picture" variable containing the image html plus the original account object, meaning that to do anything different you have to re-implement the logic that generated the image html yourself. Not very helpful.

By using a custom image field you have access to a whole raft of contrib modules that integrate with it - including colorbox - without the need for custom code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.