More in this section
Forums / General Discussions / Change image in block based on logged in user tag/custom field

Change image in block based on logged in user tag/custom field

The forums are in read-only mode. In case that you want to directly contact the Progress Sitefinity team use the support center. In our Google Plus group you can find more than one thousand Sitefinity developers discussing different topics. For the Stack Overflow threads don’t forget to use the “Sitefinity” tag.
2 posts, 0 answered
  1. James
    James avatar
    1 posts
    20 Jan 2015
    23 Mar 2015
    Link to this post


    Could someone tell me how I can have an image block (for example) that changes the image based on the user logged in, and the category/tag they have assigned


    2 users - custom field for home town, one user is set as OXFORD the other LONDON

    Image block on a page, shows the "Oxford" image when Oxford user is logged in, and the "London" image when London user is logged in

    If no user logged in, it shows another image

    I am not good with code, so if there is a way to do this without much code / its easy to understand I would be very grateful



  2. Grisha 'Greg' Karanikolov
    Grisha 'Greg' Karanikolov avatar
    156 posts
    08 Jan 2018
    23 Mar 2015
    Link to this post
    Hi James,

    What you would typically do is Get the currently logged in user, query data from his profile (e.g. the location he has set in his profile) and execute your logic against that.

    Here's our documentation article on how to get the currently logged in user and any properties that are related to him.

    Please let me know if that helps of you need more info!

    Grisha 'Greg' Karanikolov
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
2 posts, 0 answered