Quick and easy way to extend the News module by making use of the Sitefinity provider model

Quick and easy way to extend the News module by making use of the Sitefinity provider model

August 31, 2011 0 Comments

The content you're reading is getting on in years
This post is on the older side and its content may be out of date.
Be sure to visit our blogs homepage for our latest news, updates and information.

In this blog post I will share with you a specific Sitefinity use case and how to go about it.

User story

“As a website administrators I want to have 3 different News modules just like the built-in Sitefinity News module because we have 3 different news authors who should have access to manage only their own news section.”

Solution

Make use of the Sitefinity provider model to create a total of 3 providers for the News module and set permissions for each news provider respectively.

How-to

News module providers can be created entirely through the Sitefinity admin interface in just 5 steps:

Step 1

Login to Sitefinity CMS and go to Administration -> Settings -> Advanced settings

Step 2

Locate News in the left panel and go to News -> Providers, then click on the Create new button in the right panel and fill the new provider properties

sample values:

Name: CommunityNews

Title: Community News

Description: News about our user community.

Provider type: Telerik.Sitefinity.Modules.News.Data.OpenAccessNewsProvider

Make sure you check the Enable checkbox before saving the changes.

image

Step 3

Select the newly created provider from the left panel and add an application name parameter for it

Sample values:

Key: applicationName

Value: /CommunityNews

image

Step 4

Repeat the steps to add one more provider with a different name (e.g. ProductNews) and different value for its applicationName parameter (e.g. /ProductNews)

Step 5

Restart the website from the IIS web server for the changes to take effect. That's it!

You now have 3 different News providers that store news data in the same Sitefinity database and it is possible to assign permissions for each provider. The news data can also be manipulated through the API.

Let’s go to Content Types -> News to see our providers and create one news article under the CommunityNews provider.

image

Only users who have access to the CommunityNews provider will be able to manage this newly created article. You can set permissions for your issues by going to the Permissions link in the right panel of the screen above and selecting the respective provider to set its permissions.

Display news from a provider

News articles for different News providers can be displayed on Sitefinity pages utilizing the built-in News widget and all its features. To display our community news article on a page, you should add the News widget onto that page, click Edit and go to its advanced properties (bottom right corner of the edit dialog) and then go to the ControlDefinition button to update the ProviderName property of the widget with the name of the desired News provider.

image

The news widget will then display only news articles from the specified News module data provider. You can also leverage all its features such classification filters, sorting, paging, custom widget templates, and much more.

Limitations

If you create custom fields for the News content type in general, these custom fields will be applied across all providers. But if all custom fields are the same for all news providers then this approach is perfect for our user story. In case you want to have different custom fields for the 3 different news sections, then you should develop a new content type for the two additional News module.

Benefits

The provider approach is a very quick and easy way to separate and delegate News management to different stakeholders of the website. You don’t need to write a single line of code to do it.

What do you think about this approach? How do you find its use?

progress-logo

The Progress Team

View all posts from The Progress Team on the Progress blog. Connect with us about all things application development and deployment, data integration and digital business.

Comments
Comments are disabled in preview mode.
Topics
 
 
Latest Stories in
Your Inbox
Subscribe
More From Progress
New_Mobile_Dev_Ebook_Progress_Website_Thumbail
The New Mobile Development Landscape
Download Whitepaper
 
IDC Spotlight Sitefinity Thumbnail
Choosing the Right Digital Experience Platform to Improve Business Outcomes
Download Whitepaper
 
TheFastestWayToBuildMobileAppsArtboard-2
The Fastest Way to Build Mobile Apps With Cloud Data
Watch Webinar