+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / content based on user

content based on user

6 posts, 0 answered
  1. Mart
    Mart avatar
    66 posts
    Registered:
    10 Aug 2006
    16 May 2010
    Link to this post
    hello,

    I wonder if it is possible to display generic content based on the userid that is logged in?

    the scenario:
    i have a page with generic content module
    when user a is logged in the content is: "blabla bla"
    when user b is logged in the content is:  "nnfi4ivh54ihi"
     
    1) i suppose i have to ad a specicific field in one of de database table whitin sitefinity and to query against the
         content of this field. Which field(s) is it.
    2) i suppose i have to write a custom generic contetnt module but how?

    do you have experience whith this scenario an maybe an example?

    Thanks,

    Mart





  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    16 May 2010
    Link to this post
    Hi Mart,

    Here is a KB and blog post that show how to create a custom control that inherits from GenericContent control


    In Render you could set the content depending on the currently authenticated user. You could check the current user by calling UserManager.GetCurrentUserName. If you need to get a specific shared content you should use GetContent method.
    Sincerely yours,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. Mart
    Mart avatar
    66 posts
    Registered:
    10 Aug 2006
    30 Nov 2010
    Link to this post
    is it possible to save content in a generic control in sitefinity database tables per user?
    and what table do i need to make changes then?

  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    30 Nov 2010
    Link to this post
    Hi Mart,

    If you use shared content you can use the Owner property to identify the person that has created the item. There is a property Modifier that shows the user that has modified an item.

    If you have just a text in the GenericContent control you have to create a custom data layer which persists the username of your user.

    Best wishes,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. Mart
    Mart avatar
    66 posts
    Registered:
    10 Aug 2006
    01 Dec 2010
    Link to this post
    Hello Ivan,

    Thanks for your quick response.
    I have 2 questions:
    1. Do you have an example on making my own custom datalayer, or is there documentation on doing this?
    2. Is the way to fix this gone change for 4.0?

    Thanks

    Mart
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    01 Dec 2010
    Link to this post
    Hello Mart,

    1. Do you have an example on making my own custom datalayer, or is there documentation on doing this?


    You can use Open Access ORM or LINQ -SQL.

    2. In Sitefinity 4.0 there are granular permissions, so you can set which user is allowed to see a given content item.

    Sincerely yours,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Register for webinar
6 posts, 0 answered