Products

Solutions

Resources

Partners

Community

About

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

The Community Blog is a personal opinion of community members and by no means the official standpoint of DNN Corp or DNN Platform. This is a place to express personal thoughts about DNNPlatform, the community and its ecosystem. Do you have useful information that you would like to share with the DNN Community in a featured article or blog? If so, please contact .

The use of the Community Blog is covered by our Community Blog Guidelines - please read before commenting or posting.


Social Communities in DNN platform – Part II

In part I of this blog series I discussed options for logging on to your community site the convenient way. Part II now covers the setup of user profile pages – i.e. those pages that your community members use to present their profile data, their personal activity stream an much more.

User profile pages are a set of regular pages within a DNN installation, they need to be bundled together below the main profile page, i.e. the one page that is being set as the user profile page in DNN site settings. (Admin > Site Settings > Advanced Settings > Page Management). This is what that set looks like in a default DNN installation:

pages In this setup Activity Feed is the actual user profile page from the sites’ settings and the pages below present all kind of information regarding a given user account. You can add other pages as you like, the only requirement here really is that pages must be below the main profile page and that in order to make sense they should contain whatever kind of modules that are able to present data based on the UserId of the current context. We’ll come to that later.

As you can guess from the screenshot, the Activity Feed page is hidden from the main navigation. And while this is not a requirement, I would still recommend to setting it up like that. The reason is simple; the profile pages all must be visited with a UserId querystring parameter in the URL, otherwise those pages don’t make much sense. Now when the page is visible in the main navigation, the link would only refer to the page as is, i.e. without any UserId context, which would make it a requirement to have modules on the page that correctly redirect to the current User context. By default, DNN takes care of that, but to be on the safe side I would recommend to never have any links point to that page without a UserId querystring parameter.

So, what modules do we need in order to get those profile pages present relevant information? Here is the breakdown:

  • View Profile
  • Journal
  • Console
  • Membership Directory

All those modules are available right from the Add New Module menu in the control panel and here is what they do.

Console Module

console-setup The console module is responsible for navigating between the various profile pages. It makes sure, that UserId is always present in the querystring and it adds an additional security layer so administrators can fine tune the visibility of links within the profile pages. In order to achieve that, the console module must be operated in profile mode and the place to configure that is the Console Settings tab in the module settings of the module.

As you can see in the screenshot, the profile mode allows you to set the visibility of all pages in the user profile tree, i.e. all pages below the main user profile page set in site settings, to a custom permission that can be either All Users, Friends or User. Links set to All Users are visible for everyone, no matter if authenticated or not. Once set to Friends, the link will only be visible once you are on the profile page of another user that you are friend with. Links set to User are only visible once your on your own profile pages. By default, the Messages page for instance is set to User and that makes a lot of sense because that page is supposed to display your own messages and notifications. How you want to set the visibility of the Friends page is personal taste really and how your community is supposed to work. If, for example, there also is a Blog page in that tree you would probably want to set that one to All Users so everyone can see the blog posts of a given user.

The console module has to be added to all pages in the profile tree and – unfortunately - its configuration has to be set up manually on all pages exactly the same. Since its settings are stored in TabModuleSettings, you can’t even use shadow copies, i.e. Add Existing Module, without setting it up every time the same way.

View Profile Module

View Profile is a very simple module that uses a token based html template to present profile data of the user account that is being pulled from the UserId querystring parameter. You can use it to display whatever kind of user data you like. In a default installation for instance there is a View Profile instance on all profile pages the just renders the Displayname of the current user account as the heading for the page or, in another instance, renders the current user’s profile image. A few notes on the templating here:

  • the [PROFILE:PHOTO] token can be used as the src attribute in an image tag and it will use the default image handler in DNN that is somewhat limited in its rendering capabilities. For instance the maximum image size is 120px when using that handler. There is an excellent open source project in the forge that gives you a much more flexible image handler. https://bbimagehandler.codeplex.com/
  • in the settings of the module there is a switch for turning on an edit button below the template. I recommend not turning that on and rather use [HYPERLINK:EDITPROFILE] and [HYPERLINK:MYACCOUNT]. This gives you more flexibility and control and leads to the same result.
  • A full list of tokens can be found in the DNN Wiki

Journal Module

The journal module presents an activity stream of the current user’s activities within the site. By default it resides on the main profile entry page. It is up to the site administrator to set up possible actions and / or entries in the settings of the module. You can choose to allow others to post directly to the user’s wall (Enable Journal Editor?) and if so, what kind of posts. Also you can set what kind of activities to show on that page. You will notice a whole bunch of journal types here that mostly are actually not supported but still displayed here. The reason here is that all those journal types are available in every DNN installation but not necessarily supported by the modules you are using. For instance a forum module is free to notify the journal data store about new forum posts but the module developer might have not implemented that functionality.

Membership Directory

The Membership Directory module is a pretty complex module that you can use in various scenarios to display a list of user accounts. On the profile pages it is typically used for two use cases:

  1. to render a list of friends of the current user on the Friends page
  2. to render friend and follow action links on the My Profile page

The first is trivial. In the settings of the module, in the section Filters and Sorting you set Filter By to Relationship > Friends, optionally Search Settings > Display Search to Simple Search and you’re good to go. The latter is bit tricky, many administrators not even find it right away. The reason is, that friend and follow actions are completely hidden once you’re on your own profile page and may there only be seen once you are on the page of another user. So, no matter if the module is there already (in a default installation) or you need to add it (in a blank installation), just make sure you got to the profile page of someone else first. Then, in the settings of the module set Filter By to Relationship > User and set the template to this:

<div class="friendProfileActions" data-bind="visible: !IsUser() && IsAuthenticated">
<ul>
<li><a href="" title="" class="ComposeMessage"><span data-bind="text: SendMessageText"></span></a></li>
<li>
<span>
<a href="" data-bind="click: addFriend, visible: FriendStatus() == 0"><span data-bind="text: AddFriendText"></span></a>
<span data-bind="click: addFriend, visible: IsPending()"><span data-bind="text: FriendPendingText"></span></span>
<a href="" data-bind="click: acceptFriend, visible: HasPendingRequest()"><span data-bind="text: AcceptFriendText"></span></a>
<a href="" data-bind="click: removeFriend, visible: IsFriend()"><span data-bind="text: RemoveFriendText"></span></a>
</span>
</li>
<li>
<span>
<a href="" data-bind="click: follow, visible: !IsFollowing()"><span data-bind="text: FollowText"></span></a>
<a href="" data-bind="click: unFollow, visible: IsFollowing()"><span data-bind="text: UnFollowText"></span></a>
</span>
</li>
</ul>
</div>

 

As you can see the syntax is slightly different from token based templates as most of us are used to. The reason is that the MD module is knockout.js driven rather than the regular codebehind modules we all know. The syntax and possibilities here are a topic for yet another blog post, to be honest.

Putting it all together

What I’ve outlined in the above paragraphs are general notes on how everything is tied together. For a detailed step-by-step instructions I would like to recommend Bruce Chapman’s excellent blog post on how to set up profile pages.

Extending the Defaults

As has been mentioned above, you are not limited to the profile pages listed in this article. Why not add another page called My Blogs and put a blog module on it? The blog module will give you a list of user blogs based on the UserId querystring parameter, so why not show a list of all blog posts by the current user? Or maybe you have that cool images module that shows a list of all images by a given user. The only requirement for the module really is that it should output user related data based on the UserId in the querystring.

Another hack I’ve been playing with is that you can create another module from the Host > Extensions page that points to DesktopModules/Admin/Security/EditUser.ascx, call the module Edit Profile and you have a module for editing your account details. The [HYPERLINK:EDITPROFILE] links will only point to editing your account within the edit skin while my “hack” will actually allow you to place a real module with some contextual content on any page.

This post is cross-posted from my personal blog on dnn-connect.org. I hope you liked it, if you have any question, leave me comment and I will do my best to get you an answer or even extend the article.

Comments

There are currently no comments, be the first to post one.

Comment Form

Only registered users may post comments.

NewsArchives


Aderson Oliveira (22)
Alec Whittington (11)
Alessandra Daniels (3)
Alex Shirley (10)
Andrew Hoefling (3)
Andrew Nurse (30)
Andy Tryba (1)
Anthony Glenwright (5)
Antonio Chagoury (28)
Ash Prasad (37)
Ben Schmidt (1)
Benjamin Hermann (25)
Benoit Sarton (9)
Beth Firebaugh (12)
Bill Walker (36)
Bob Kruger (5)
Bogdan Litescu (1)
Brian Dukes (2)
Brice Snow (1)
Bruce Chapman (20)
Bryan Andrews (1)
cathal connolly (55)
Charles Nurse (163)
Chris Hammond (213)
Chris Paterra (55)
Clint Patterson (108)
Cuong Dang (21)
Daniel Bartholomew (2)
Daniel Mettler (181)
Daniel Valadas (48)
Dave Buckner (2)
David Poindexter (12)
David Rodriguez (3)
Dennis Shiao (1)
Doug Howell (11)
Erik van Ballegoij (30)
Ernst Peter Tamminga (80)
Francisco Perez Andres (17)
Geoff Barlow (12)
George Alatrash (12)
Gifford Watkins (3)
Gilles Le Pigocher (3)
Ian Robinson (7)
Israel Martinez (17)
Jan Blomquist (2)
Jan Jonas (3)
Jaspreet Bhatia (1)
Jenni Merrifield (6)
Joe Brinkman (274)
John Mitchell (1)
Jon Henning (14)
Jonathan Sheely (4)
Jordan Coopersmith (1)
Joseph Craig (2)
Kan Ma (1)
Keivan Beigi (3)
Kelly Ford (4)
Ken Grierson (10)
Kevin Schreiner (6)
Leigh Pointer (31)
Lorraine Young (60)
Malik Khan (1)
Matt Rutledge (2)
Matthias Schlomann (16)
Mauricio Márquez (5)
Michael Doxsey (7)
Michael Tobisch (3)
Michael Washington (202)
Miguel Gatmaytan (3)
Mike Horton (19)
Mitchel Sellers (40)
Nathan Rover (3)
Navin V Nagiah (14)
Néstor Sánchez (31)
Nik Kalyani (14)
Oliver Hine (1)
Patricio F. Salinas (1)
Patrick Ryan (1)
Peter Donker (54)
Philip Beadle (135)
Philipp Becker (4)
Richard Dumas (22)
Robert J Collins (5)
Roger Selwyn (8)
Ruben Lopez (1)
Ryan Martinez (1)
Sacha Trauwaen (1)
Salar Golestanian (4)
Sanjay Mehrotra (9)
Scott McCulloch (1)
Scott Schlesier (11)
Scott Wilkinson (3)
Scott Willhite (97)
Sebastian Leupold (80)
Shaun Walker (237)
Shawn Mehaffie (17)
Stefan Cullmann (12)
Stefan Kamphuis (12)
Steve Fabian (31)
Steven Fisher (1)
Tony Henrich (3)
Torsten Weggen (3)
Tycho de Waard (4)
Vicenç Masanas (27)
Vincent Nguyen (3)
Vitaly Kozadayev (6)
Will Morgenweck (40)
Will Strohl (180)
William Severance (5)
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out