Community Central User’s Guide, Part 1: How to Create a Custom Web Part to Display Scoring Statistics

Bamboo's Community Central application provides a number of capabilities which enhance and extend the social features available in SharePoint out-of-the-box. Additionally, users can create, through customization, a new system of scoring user activities that goes beyond the statistics which are already tracked by default (e.g., Top Experts, or Most Active Users). For example, your organization may have a desire or need to track something else, such as Most Helpful Users or Most Suggested Users.

Perhaps your organization is looking to increase user participation, and runs a contest (with a suitably desirable prize, such as an extra vacation day) to encourage suggestions. The Manage Scoring rule list lets an administrator set points for each category. There are defaults in place, but administrators have the ability to add custom settings. For example, we provide the default Top Experts (the people who provided the answers, with the answers verified by the people who asked the questions). Your organization may not care about the Top Experts, but would rather see the Top Suggested as Answer for the purposes of the contest. This post will show you how to do so, using two different methods: creating a New View for the Web Part properties, or making modifications using SharePoint Designer.

The scoring information can be tracked and validated based on Site Members and the site activities that they participate in. This feature allows us to track statistics based on who creates and responds to discussion board's topics, and we track five specific user activities: create a new forum topic, post a reply to a topic, author's post is verified as answer, author's post is suggested as Answer, and verify Answer from Suggested. In this article, we'll show users how to create a new List View Web Part of a Site Members list to display additional statistics, based on user activities and scoring rules. This can be accomplished two different ways:

  • Change Using Web Part Properties
  • Change Using SharePoint Designer

Change Using Web Part Properties:

1. Create a new view for the List Members titled Most Suggested View with the following sorting and filtering properties:

2. Edit the Forum site page. In the Web Part Gallery, add the List Members Web Part to the page:

3. Modify an existing xslt and create a new xslt.

  • Go to the site to which you want to add the Web Part. From the Skin folder, download the xslt file (in this example, we're using the file: Bamboo.Expert.xslt) to your local desktop:

  • Rename Bamboo.TopExperts.xslt to Bamboo.MostSuggested.xslt.
  • Edit the Bamboo.MostSuggested.xslt and replace NumberofAnswerVerified with NumberofAnswerSuggested:

  • Upload the new Bamboo.MostSuggested.xslt to the Skin folder.

4. Edit the Web Part: Change the title to Most Suggested and change the Selected View to Most Suggested View. In addition, make sure that the XSL Link points to Skin/Xsl/Bamboo.MostSuggested.xslt. Click Apply and OK:

5. The Web Part will now display as follows:

Change Using SharePoint Designer:

1. Modify an existing xslt and create a new xslt.

  • Go to the site to which you want to add the Web Part. From the Skin folder, download the xslt file (in this example, we're using the file: Bamboo.Expert.xslt) to your local desktop:

  • Rename Bamboo.TopExperts.xslt to Bamboo.MostSuggested.xslt.
  • Edit the Bamboo.MostSuggested.xslt and replace NumberofAnswerVerified with NumberofAnswerSuggested:

  • Upload the new Bamboo.MostSuggested.xslt file to the Skin folder.

2. Edit the Forum site page. In the Web Part Gallery, add the List Members Web Part to the page:

3. Open the site in SharePoint Designer. From All Files in the left navigation, click default.aspx to open the page:

  • In Split mode, go to the Web Part that you just added and click on default.aspx. Hover your mouse over the Web Part you just added. On the code area, it will be highlighted. You should see the following line in your code:
   1: <View Name="{xxxxx-xxxxx-xxxx-xxxx-xxxxx}"  MobileView="TRUE" Type="HTML" Hidden="TRUE" TabularView="FALSE" OrderedView="TRUE" DisplayName="" Url="/SA15/Engineering Forum/default.aspx" Level="1" BaseViewID="0" ContentTypeID="0x">
   2:  
  • Change the BaseViewID="x" to BaseViewID="0". BaseViewID="0" will prompt the application to use the custom view.
  • Next, find the title attribute and change to it to your new title. For this example, we're using the title Most Suggested.

  • Change the OrderBy and the ViewFields to filter the data for most suggested. To do this, replace the lines from <Query> to </View>. You will also need to order the NumberOfAsnswerSuggested field and get the value greater than 0.
   1: <Query>
   2: <OrderBy>
   3: <FieldRef Name="NumberOfAnswerSuggested" Ascending="FALSE"/>
   4: </OrderBy>
   5: <Where>
   6: <Gt>
   7: <FieldRef Name="NumberOfAnswerSuggested"/>
   8: <Value Type="Text">0</Value>
   9: </Gt>
  10: </Where>
  11: </Query>
  12: <ViewFields>
  13: <FieldRef Name="Member"/>
  14: <FieldRef Name="Point"/>
  15: <FieldRef Name="NumberOfAnswerSuggested"/>
  16: </ViewFields>
  17: <RowLimit Paged="TRUE">10</RowLimit>
  18: <Aggregations Value="Off"/>
  19: <Toolbar Type="Standard"/>
  20: </View>
  • Under the tag </XmlDefinition>, add this tag to use the new xslt:

<XslLink>Skin/Xsl/Bamboo.MostSuggested.xslt</XslLink>


  • Save the page in SharePoint Designer and refresh the page from the browser. You will now see that the following changes have been implemented:

Continue reading the Community Central User's Guide.

SharePoint

Applications

SharePoint apps are stand-alone applications that perform specific tasks on a SharePoint site. Apps can perform functions such as managing a discussion board or knowledge base, performing project management or time tracking tasks, or doing other workflow operations.

SharePoint

Product Suites

Experience greater power and savings by bundling our SharePoint apps and web parts.


Essentials


Essentials Plus


Bamboo Premier


Project Management Suite


Knowledge Management Suite


External User Manager


SharePoint

Web Parts

Extend SharePoint beyond its out-of-the-box capabilities by tailoring it to your requirements with Bamboo Solution’s growing portfolio of Web Parts. Web Parts are the building blocks of pages on a SharePoint site that can be used to customize the user interface and content of a site page. 

SharePoint

Product Suites

Experience greater power and savings by bundling our SharePoint apps and web parts.


Essentials


Essentials Plus


Bamboo Premier


Project Management Suite


Knowledge Management Suite


External User Manager


Office 365

Cloud Parts

Cloud Parts are functional components that extend your SharePoint environment whether it’s hosted, on-premises, or part of Microsoft Office 365. More than mere ports of existing software to the cloud, our Cloud Parts have been built from the ground up to take advantage of the best that the cloud has to offer.

SharePoint

Product Suites

Experience greater power and savings by bundling our SharePoint apps and web parts.


Cloud Parts Suite for O365/SP Onl.


Featured Services

SharePoint Health Check

A SharePoint Health Check will identify the causes of issues and risks associated with your specific environment, and is custom tailored to provide you with the best recommendations to optimize your SharePoint environment.

SQL Health Check

Document recommendations relating to performance, stability, availability, or a specific focus you request of your SQL Server database instances.

My SharePointXperts

The truth is that each SharePoint skill may not be a full time job for many organizations, and it is nearly impossible for one person to do everything you need – so augment your team with SharePointXperts; providing the skill sets you need when you need them!