Top 10 users on CommunityServer
This code will give you top 10 posters of Community Server application. Add this in /Themes/yourtheme/Common/home.aspx so that the list will be displayed in home page.
<% SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["SiteSqlServer"].ConnectionString); SqlDataAdapter da = new SqlDataAdapter("select top 10 postauthor, count (*) as posts from cs_posts group by postauthor order by posts desc", con); DataTable dt = new DataTable(); da.Fill(dt); foreach (DataRow dr in dt.Rows) { Response.Write("<li> <a href="http://kidoos.net/members/"+dr["postauthor"].ToString()+"/default.aspx">" + dr["postauthor"].ToString().Substring(0, 1).ToUpper() + dr["postauthor"].ToString().Substring(1,dr["postauthor"].ToString().Length-1) +" ("+dr["posts"].ToString()+")</a>"); } con.Dispose(); da.Dispose(); dt.Dispose(); %>
Related posts:























Leave a Reply
You must be logged in to post a comment.