Skip to Content Skip to Menu

🏖 Mid-Summer sale is here! Get 20% off professional and developer memberships with code SUMMER-2026!

Default Canvas image by category

  • huntrdog
  • huntrdog
  • OFFLINE
  • Posts: 36
  • Thanks: 5
  • Karma: 0
1 month 3 weeks ago #344076 by huntrdog
Default Canvas image by category was created by huntrdog
We are using Canvas profile layouts in Community Builder and would like different default canvas images depending on profile category (Artist, Musician, Restaurant, Business, etc.) when no canvas image has been uploaded by the user.Is this supported natively through Template Builder, substitutions, or conditional layouts, or would this require a template override/custom PHP?

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 50620
  • Thanks: 8673
  • Karma: 1474
1 month 3 weeks ago #344080 by krileon
Replied by krileon on topic Default Canvas image by category
There's no built in functionality for that specifically, but you should be able to do that with the Layout parameters. Example as follows.

Profile Value Layout
Code:
[cb:if canvas=""] [cb:if cb_profile_category="artist"]<img src="images/profiles/canvas/artist.jpg" class="cbImgCanvas cbFullCanvas" />[/cb:if] [cb:if cb_profile_category="musician"]<img src="images/profiles/canvas/musician.jpg" class="cbImgCanvas cbFullCanvas" />[/cb:if] [cb:if cb_profile_category="restaurant"]<img src="images/profiles/canvas/restaurant.jpg" class="cbImgCanvas cbFullCanvas" />[/cb:if] [cb:if cb_profile_category="business"]<img src="images/profiles/canvas/restaurant.jpg" class="cbImgCanvas cbFullCanvas" />[/cb:if] [cb:if cb_profile_category=""][value][/cb:if] [cb:else][value][/cb:else] [/cb:if]

You'll likely want to deal with thumbnail display as well, which is used by the userlist layout. Example as follows.

Userlist Value Layout
Code:
[cb:if canvas=""] [cb:if cb_profile_category="artist"]<img src="images/profiles/canvas/artist_thumbnail.jpg" class="cbImgCanvas cbThumbCanvas" />[/cb:if] [cb:if cb_profile_category="musician"]<img src="images/profiles/canvas/musician_thumbnail.jpg" class="cbImgCanvas cbThumbCanvas" />[/cb:if] [cb:if cb_profile_category="restaurant"]<img src="images/profiles/canvas/restaurant_thumbnail.jpg" class="cbImgCanvas cbThumbCanvas" />[/cb:if] [cb:if cb_profile_category="business"]<img src="images/profiles/canvas/restaurant_thumbnail.jpg" class="cbImgCanvas cbThumbCanvas" />[/cb:if] [cb:if cb_profile_category=""][value][/cb:if] [cb:else][value][/cb:else] [/cb:if]

Similar to profile, but you'll want to point to thumbnail images.

For the most part you can use whatever HTML you want there, but it's really only intended to expect a div with a background image, an image element, or an svg element.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
The following user(s) said Thank You: huntrdog

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum