Read and display list of top 5 "my recent forum posts" and top 5 "my recent blog comments"

rated by 0 users
This post has 4 Replies | 2 Followers

Not Ranked
Posts 5
Points 70
kmoghim2 Posted: Wed, Jul 30 2008 3:44 PM

Whats the best way to get the list of top 5 "my recent forum posts" and top 5 "my recent blog comments" ? Please point me to the right direction or post a complete working code if possible I am so new to this your help is appreciated so much ,

For example please include whether my new page needs to inherit from any other page or what namespaces I need to import and such.

I need to display this information in the form of an IFrame so I do not want to display the master page stuff , header, footer, I just need the data post data

Thank you
 

  • | Post Points: 20
Top 75 Contributor
Posts 301
Points 4,410
andrevs replied on Thu, Jul 31 2008 2:20 AM

My reply to you post here  should also work for CS2007. You don't have to use an IFrame if you don't want the Master Page.

  • | Post Points: 20
Not Ranked
Posts 5
Points 70
kmoghim2 replied on Thu, Jul 31 2008 4:17 PM

When I dont use the master page it errors out on pretty much on all the controls , can you show a complete code which includes all the "imports" and retreive the "my top 5 forum" post for example? Thank you so much

  • | Post Points: 20
Top 75 Contributor
Posts 301
Points 4,410
andrevs replied on Thu, Jul 31 2008 9:24 PM

This example displays your 5 most recent blog posts.

<%@ Page EnableViewState="false" Language="C#" AutoEventWireup="true"   %>

<script runat="server" language="C#">

    void Page_Load()
    {
        int userID = CommunityServer.Components.CSContext.Current.User.UserID;
        ((WeblogPostList)CSControlUtility.Instance().FindControl(this, "BlogInformation")).QueryOverrides.UserID = userID;
    }
   
    DateTime lastDate = DateTime.MinValue;
    string lastDateKey = string.Empty;
    CommunityServer.Components.User user = CommunityServer.Components.CSContext.Current.User;
   
    public bool ShowDateHeader(string key, object date)
    {
        DateTime currDate = user.GetTimezone((DateTime)date).Date;
        if (currDate != lastDate || key != lastDateKey)
        {
            lastDateKey = key;
            lastDate = currDate;
            return true;
        }
        else
            return false;
    }

</script>

    <CSControl:ConditionalContent runat="server">
        <ContentConditions >
         <CSControl:Conditions runat="server" Operator="Not"><CSControl:UserPropertyValueComparison runat="server" UseAccessingUser="true" ComparisonProperty="IsAnonymous" Operator="IsSetOrTrue" /></CSControl:Conditions>
        </ContentConditions>
        <TrueContentTemplate>  
                <CSControl:PlaceHolder runat="server">
                    <DisplayConditions><CSControl:ApplicationPropertyValueComparison runat="server" ApplicationType="Weblog" ComparisonProperty="Enabled" Operator="IsSetOrTrue" /></DisplayConditions>
                    <ContentTemplate>
                        <div class="CommonContentBox Highlighted2">
                            <h4 class="CommonContentBoxHeader"><CSControl:ResourceControl runat="server" ResourceName="weblogs" /></h4>
                            <div class="CommonContentBoxContent">
                             <CSBlog:WeblogPostList runat="server" ID="BlogInformation" ShowHeaderFooterOnNone="true">
                                 <QueryOverrides BlogPostType="Article,Comment,Post" PageSize="5" PageIndex="0" IncludeCategories="false" IsAggregate="false" IsCommunityAggregatedOnly="false" PostConfig="Empty" />
                                 <HeaderTemplate><ul class="CommonContentBoxList"></HeaderTemplate>
                                 <ItemTemplate>
                                        <CSBlog:WeblogPostData runat="server" Property="Subject" TruncateAt="50" LinkTo="Post" Tag="LI" />
                                        <CSBlog:WeblogPostFeedbackData runat="server" Property="Subject" TruncateAt="50" LinkTo="Feedback" Tag="LI" />        
                                 </ItemTemplate>
                                 <NoneTemplate>
                                     <li><CSControl:ResourceControl runat="server" ResourceName="Home_NotPosted" /></li>
                                 </NoneTemplate>
                                 <FooterTemplate></ul></FooterTemplate>
                             </CSBlog:WeblogPostList>
                           </div>
                         </div>
                    </ContentTemplate>
                </CSControl:PlaceHolder>   
        </TrueContentTemplate>   
    </CSControl:ConditionalContent>

  • | Post Points: 20
Not Ranked
Posts 5
Points 70

Thanks for ur response , now I get the following error:

Type 'CommunityServer.Blogs.Controls.WeblogPostQuery' does not have a public property named 'IncludeCategories'.

I am using CS2007 and VS2008

  • | Post Points: 5
Page 1 of 1 (5 items) | RSS
Powered by Community Server (Commercial Edition), by Telligent Systems

Copyright© 2008 Telligent Systems Inc. All rights reserved
CommunityServer.com  •  Telligent.com