John Mitchell Administrator
 Veteran Member
 Posts:4384

 | | 20 Mar 2007 10:28 PM |
| If you are looking for a way to have conditional content shown in your skin without having to use a module, you can do it with some inline code. <% If DotNetNuke.Security.PortalSecurity.IsInRoles(PortalSettings.AdministratorRoleName) %> Admin only content here <% End If %> | | | |
|
cgrill
 New Member
 Posts:5
 | | 06 Apr 2007 09:32 AM |
| Is there a way to conditionally show content from every page once logged, and not just from admin pages. I'd like to provide page editors with some additional restricted content. Great tips. Keep them coming! thanks, cpg | | | |
|
cgrill
 New Member
 Posts:5
 | | 06 Apr 2007 09:36 AM |
| oops, that first part show read "...from every page once logged in" | | | |
|
John Mitchell Administrator
 Veteran Member
 Posts:4384

 | | 10 Apr 2007 08:06 AM |
| Sorry I didn't get to this sooner. If you put the above code into your skin it will show on every page that uses that skin. Put it in as many skins as you need to get it on all the pages that you want. If you want the code for specifying other roles then let me know. | | | |
|
nina
 New Member
 Posts:34
 | | 17 Apr 2007 05:05 PM |
| Hi John - I want to add another role on skincovered. I want to put my CSS icons so that only they see them.
What do I change in the code to allow specific roles to see things.
Nina | | | |
|
John Mitchell Administrator
 Veteran Member
 Posts:4384

 | | 17 Apr 2007 05:25 PM |
| Hi Nina,
That would be done like this:
<%If DotNetNuke.Security.PortalSecurity.IsInRole("Skincovered Role") Then %>
Role Based Content
<% End If %> | | | |
|
nina
 New Member
 Posts:34
 | | 17 Apr 2007 05:51 PM |
| Thanks - so I can make the careful assumption on putting the actual name of the role in, exactly as it's displayed.
I'll give it a try.
Cheers
Nina | | | |
|
dnncreative
 New Member
 Posts:19
 | | 23 May 2007 05:51 AM |
| Hi John,
Is it possible to use this method to display content to users who are not in a role? ie taking ninas example any users that do not have the "Skincovered Role"
Thanks, | | | |
|
nina
 New Member
 Posts:34
 | | 23 May 2007 06:19 AM |
| Hi Lee Wouldn't that be the Unauthenticated users role.. that's everyone who's not logged in? Nina | | | |
|
dnncreative
 New Member
 Posts:19
 | | 23 May 2007 06:29 AM |
| Hi Nina,
Thanks for responding - It's been a while since we have had a chat - hope everything is going ok over at your end of the world!
Unfortunately it's not that simple. - There are registered users who are logged in and unauthenticated users that I want to display content to if they do not have a 'subscriber' security role. - So I want to display content to every security role except the 'subscriber' role.
Thanks,
Lee | | | |
|
nina
 New Member
 Posts:34
 | | 23 May 2007 06:51 AM |
| Everything is going well - not enough hours in the day - perhaps I can borrow some of your daylight hours - :-) No doubt you're keeping busy too. I wonder if John would know any code that has an 'exclusion' instead of 'inclusion'. But by default the registered users are also the subscribers of information - they share that role - so I think you'd need an exclusion - that said - ok you're a registered user but NOT a subscriber.. so you see this.. Does that make sense - either way - John will see this and may come up with suggestion. Nina | | | |
|
dnncreative
 New Member
 Posts:19
 | | 23 May 2007 07:08 AM |
| Hi Nina,
Glad to hear all is ok, yes keeping busy over here as well!
Yes it's an exclusion type code that I need as a user can be in several roles at once - a NotIn type rule | | | |
|
John Mitchell Administrator
 Veteran Member
 Posts:4384

 | | 23 May 2007 07:40 AM |
| Hi Lee, Thanks for the question. That can be done by adding one word to the logic -
<%If NOT DotNetNuke.Security.PortalSecurity.IsInRole("Skincovered Role") Then %>
Put Content here for everyone not in the subscriber role
<% End If %> | | | |
|
dnncreative
 New Member
 Posts:19
 | | 23 May 2007 07:43 AM |
| ha ha brilliant of course!
Thanks John | | | |
|
dnncreative
 New Member
 Posts:19
 | | 23 May 2007 07:53 AM |
| ok that works great in the skin code, is there a way to get this to work in a Text / HTML module?
Thanks,
Lee | | | |
|
John Mitchell Administrator
 Veteran Member
 Posts:4384

 | | 23 May 2007 07:57 AM |
| No, it is server side code that is processing, but I will be adding that ability to PageBlaster soon.
The only thing you can do for now in an html module is set view access to every other role but that one. | | | |
|
dnncreative
 New Member
 Posts:19
 | | 23 May 2007 08:41 AM |
| Very interesting, I haven't looked at PageBlaster yet so I've just read through the manual, this looks to be a very powerful module. - Takes me back to those MagicGadget days in dnn2 ;-) - I've got several clients who are stuck in DNN2 because of magic gadget but this may solve all of their problems!
I know you are very busy but do you have any idea when you will be adding it to the module? - I'm needing to find a solution to the text / html content for a re-design I'm currently doing for DNN Creative. - I've gone the pure css skin route and I'm literally having to recode every single text / html module and tab across the entire site. If I can integrate this module in while I am doing these changes that would be great. - I'm hoping to have a localhost version completed by June is there any chance in PageBlaster being ready by then?
Thanks, | | | |
|
John Mitchell Administrator
 Veteran Member
 Posts:4384

 | | 23 May 2007 08:51 AM |
| Yes, it is like MagicGadget and a lot more. Did you know you can also use it to make your pages validate XHTML strict? I'd like to work with you on getting DNNCreative.com using PageBlaster.
Send me an e-mail by replying directly to the notification from this post. | | | |
|
dnncreative
 New Member
 Posts:19
 | | 23 May 2007 09:08 AM |
| I've sent you an email, thanks, Lee | | | |
|
jncraig
 New Member
 Posts:88
 | | 23 May 2007 07:47 PM |
| To paraphrase the Mastercard ad ..
This thread: $1000's
Getting to watch John, Nina, and Lee collaborate: PRICELESS!
Seriously, this is a valuable thread! | | | |
|