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.


Custom Admin entries in Persona Bar (the easy way)

I was watching Joe Brinkman's demo on developing MVC modules some time ago, and something caught my attention. The way he was creating an admin entry in the Persona Bar was simple and efficient. I made a mental note of it at the time and today I was confronted with the same situation again. We had to manually create an admin page in Persona Bar. Apparently, you can't do that easily in DNN 9. In the page settings screen, the Admin page can't be chosen as the parent page. It's disabled. 

To manually create a page in Persona Bar

There is a workaround that Radu Niculcea from DNN Sharp found. I will give it to you here, though the purpose of this article is to show you how to do it programmatically. 

1. Change the permissions of the Admin page so it's viewable to Registered Users

2. Create the custom administration page and select the Admin page as the parent, which now is selectable

3. Remove the Registered User view permission for the Admin page

There is another workaround that was suggested by Josh Slaughter. That is, use the Add Multiple Pages feature from Persona Bar which does let you select Admin as the parent page.

Creating Persona Bar entries programmatically

Anyway, going back to creating the Persona Bar entry for a module, let me first give you an overview of how we used to do it before discovering this gem. We would use the IUpradebale interface that gets called when a module extension is installed/updated. In this interface, we would call DNN methods to create the page under admin. The solution is pretty much described in this article, except the code that creates the pages.

The problem with this solution is that as new portals are created, they didn't contain our admin page. So, in the end, we've implement an initialization method that gets called before other code to check that the admin page exists. We have quite some code for this and let me tell you, there's all sort of issues to take into account like what happens if the page is in recycle bin.

The awesome way to programmatically create Persona Bar entries

The discovery that I made is that DNN can actually automatically create the Persona Bar entry (which for DNN 8 is a page under Admin) with just a few lines of metadata added to the .dnn manifest. These lines go into the <desktopModule> node of the module that needs to be added to the admin page.

<desktopModule>
    ...
    <page type="Admin" common="true">
        <name>Configuration Manager</name>
        <icon>~/Icons/Sigma/Configuration_16X16_Standard.png</icon>
        <largeIcon>~/Icons/Sigma/Configuration_32X32_Standard.png</largeIcon>
        <description>Modify configuration settings for your site</description>
    </page>
    ....
</desktopModule>

That's all! DNN takes care of creating the page for all portals during module installation. It also takes care of creating the page for newly created portals. This feature actually saves us hundreds of lines of code. 

A bit of history

I couldn't find this feature documented anyway, so I dug up its history. Seems a lot of effort went into it. I found Issue DNN-7485 on DNN tracker that has very good documentation on intended use cases. I couldn't connect it to a particular commit, but to make sure it fits our purpose of being backwards compatible I downloaded DNN 8.0.0 source code and looked it up. And it was there. We plan to drop support for DNN 7 in January, so it looks like we'll use this feature a lot going forward.

Conclusions

Using the .dnn manifest approach makes it painless to create a custom administration page for a module. In DNN 9, it adds the entry in the Persona Bar under Manage section. On DNN 8, it creates the entry under Admin. There's also the option to add it under Host. The beauty of this approach is that requires very little code to manage and the entries are created for new portals as well.


Comments

Michael Tobisch
Great stuff, thanks for sharing!
Happy DNNing!
Michael
Michael Tobisch Friday, December 1, 2017 2:42 PM (link)
Josh Slaughter
I found an easier way to create Admin entries in the Persona bar in DNN 9 without messing with the permissions.

Instead of clicking the Add Page button to create a new page, click the Add Multiple Pages button

In the Branch Parent dropdown on the left, you can select Admin as the parent page, supply the Page Name in the box on the right, and click the Add Pages button at the bottom and you're all set!
Josh Slaughter Friday, December 1, 2017 8:17 PM (link)
Bogdan Litescu
Thanks Josh! I've updated the article to include your solution as well.
Bogdan Litescu Saturday, December 2, 2017 6:59 PM (link)

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