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

Forums / Developing with Sitefinity / Display thread per user basis

Display thread per user basis

9 posts, 0 answered
  1. Asit
    Asit avatar
    87 posts
    Registered:
    07 Nov 2009
    06 Jul 2010
    Link to this post
    Hi,

    can i dispaly the thread of a FORUM only to the created user and those who reply to it, not everyone ?

    and

    can other user without admin role write a new thread?
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    06 Jul 2010
    Link to this post
    Hi asit pani,

    You can use Telerik.Security.UserManager.GetCurrentUser() method to check the current use or GetCurrentUserRoles() inside Sitefinity\ControlTemplates\Forums\SingleForum.ascx then hide a row from the ASP.NET GridView control.

    Greetings,
    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. Asit
    Asit avatar
    87 posts
    Registered:
    07 Nov 2009
    06 Jul 2010
    Link to this post
    Hi Ivan,

    can other user without admin role write a new thread?

    and

    after getting the user how can i hide the rows from the gridview.

    plz help me it's urgent.

    regards
    Asit
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    06 Jul 2010
    Link to this post
    Hi asit pani,

    1. A user can create new thread if you have allowed "Create" permission of the role under which this belongs.

    2.About hiding rows, please take a look at


    Greetings,
    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. Asit
    Asit avatar
    87 posts
    Registered:
    07 Nov 2009
    06 Jul 2010
    Link to this post
    Hi

    How to get the username from this user control inside the gridview in single forum page.


    <asp:GridView ID="allThreads" runat="server" AutoGenerateColumns="false" CssClass="sf_forumsThreadsList"
            GridLines="none" onrowcreated="allThreads_RowCreated">
            <Columns>
     <prof:ManageProfile ID="lastPostAuthor" ShowAnonymousLabel="true" AnonymousLabel="<%$ Resources:Anonymous %>"
                            runat="server" >
                            <ViewTemplate>
                                <asp:Label ID="FirstName" runat="Server"></asp:Label
                                <asp:Label ID="LastName" runat="Server"></asp:Label>
                            </ViewTemplate>
                        </prof:ManageProfile>
    </Columns>
        </asp:GridView>
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    06 Jul 2010
    Link to this post
    Hello asit pani,

    This is an ASP.NET GridView control with a TemplateField inside it.

    sample code

    void allThreads_RowCreated(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            ManageProfile lastPostAuthor = (ManageProfile)e.Row.FindControl("lastPostAuthor");
            lastPostAuthor.PreRender += new EventHandler(lastPostAuthor_PreRender);
        
        }
    }
     
    void lastPostAuthor_PreRender(object sender, EventArgs e)
    {
        ManageProfile profiler = sender as ManageProfile;
    }


    Kind regards,
    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
  7. Asit
    Asit avatar
    87 posts
    Registered:
    07 Nov 2009
    07 Jul 2010
    Link to this post
    Hi ivan,

    Still i m not able to get the username.

    ManageProfile lastPostAuthor = (ManageProfile)e.Row.FindControl("lastPostAuthor");
                lastPostAuthor.PreRender += new EventHandler(lastPostAuthor_PreRender);
                string author = lastPostAuthor.Username;
                Label lbl = (Label)lastPostAuthor.FindControl("LastName");
  8. Asit
    Asit avatar
    87 posts
    Registered:
    07 Nov 2009
    07 Jul 2010
    Link to this post
    hi

    plz help me.it's urgent.......
  9. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    07 Jul 2010
    Link to this post
    Hi asit pani,

    Inside lastPostAuthor_PreRender you can get the username which is property of ManageProfile control. Then use ProfileCommon to get the FirstName/LastName of the user.

    The response time in forums is 72 hours.

    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
9 posts, 0 answered