How to display a link only for logged in users? - dotnetnuke

I am using dotnetnuke version 5.4. I want to display a link after the terms of use and privacy statement (at the bottom).
This link should be displayed only after a user logged in. Is there is any way to do this? I know how to add a link to the skin.ascx file, but I don't know how to identify whether a user is logged in or not.

In your skin, just add the following in the appropriate place.
VB.NET
<% If Request.IsAuthenticated %>
[Logged in]
<% End If %>
C#
<% if (Request.IsAuthenticated) { %>
[Logged in]
<% } %>
This will show the "[Logged in]" text only if the user is logged in.

The easiest thing would probably be to put the link in an HTML module that is in the footer pane and set it visible only to registered users, and visible on all pages.

<% If HttpContext.Current.User.Identity.IsAuthenticated=True Then %>
<!-- put your stuff here -->
<% End If %>
Stick that in your skin, that should do it.

Related

Displaying multi image from array with CarrierWave in Rails

I have a post with Thumbnail and Attachment. I'm using CarrierWave gem and it looks like uploading works. I can see the files in public/uploads folder and I can see the array in DB, but when it comes to listing in the view, it won't display the images but file names. What am I missing? I can display the thumb image as seen.
<%= image_tag #post.image_url.to_s %>
<% #post.attachment.each do |attachment| %>
<%= image_tag attachment.url.to_s %>
<% end %>
It looks like it is adding this %5B%22 and %22%5D that messes the correct path.
It looks like the Array doesn't loop.
<%= #post.attachment.count %>
returns
1

DNN custom skin gives jquery missing error

Whenever I try to make a custom skin object in Admin/Skins folder or Admin/Containers folder, I get the error
Uncaught ReferenceError: jQuery is not defined
I'm trying to add a bootstrap link skin object to be used in the template. DNN Newbie here!
<%# Control Language="C#" AutoEventWireup="false" Inherits="DotNetNuke.UI.Skins.Skin" Codebehind="Button.ascx.cs" %>
<%# Register TagPrefix="dnn" Namespace="DotNetNuke.UI.WebControls" Assembly="DotNetNuke.WebControls" %>
<asp:button id="btnButton" runat="server" cssclass="Normal" enableviewstate="False" MouseOverCssClass="LabelEditOverClass"
ToolBarId="titleToolbar" LabelEditCssClass="LabelEditTextClass" EditEnabled="True" EventName="none" LostFocusSave="false"></asp:button>
<DNN:DNNToolBar id="titleToolbar" runat="server" CssClass="eipbackimg containerTitle" ReuseToolbar="true"
DefaultButtonCssClass="eipbuttonbackimg" DefaultButtonHoverCssClass="eipborderhover">
<DNN:DNNToolBarButton ControlAction="edit" ID="tbEdit2" ToolTip="Edit" CssClass="eipbutton_edit" runat="server"/>
<DNN:DNNToolBarButton ControlAction="save" ID="tbSave2" ToolTip="Update" CssClass="eipbutton_save" runat="server"/>
<DNN:DNNToolBarButton ControlAction="cancel" ID="tbCancel2" ToolTip="Cancel" CssClass="eipbutton_cancel" runat="server"/>
</DNN:DNNToolBar>
Edit:
I'm trying to create various skin objects like button, title tags, body tags, which take in our CSS styling. So the Marketing department can just drop it to a location, edit the text/link of the button or edit the text in title, etc.
Looking a bit further, DNN does NOT load jquery automatically. You need to set up your custom skin to load it.
See: https://www.dnnsoftware.com/wiki/client-resource-management-api
The short answer to your question is that you can do all of this using the user control DnnJsInclude. Note that there is also a DnnCssInclude control.
As I understand things (from the referenced item), these load the js and CSS files only if they have not yet been loaded.
If you are looking for a model for a DNN Theme, have a look at nvQuickTheme on GitHub.
Thanks to Will Strohl for pointing me in the right direction ...

How to show language short names in language selection dropdown in dnn9

I am working on building dnn9 multilingual site. I put language selection dropdown in theme.
To show dropdown in theme I am using this code:
<% if Localization.ActiveLanguagesByPortalID(PortalSettings.PortalId) > 1 Then %>
<dnn:LANGUAGE runat="server" ID="LANGUAGE1" ShowMenu="True" ShowLinks="False" />
<% End If %>
Now it shows long language names, like that: English (United States). How can I make it show 3 latter language name, like ENG, instead?
I use the following:
<dnn:LANGUAGE runat="server"
ID="dnnLanguage"
ShowLinks="True"
ShowMenu="False"
ItemTemplate='<span class="Language" style="text-transform: uppercase;">[CULTURE:THREELETTERISOCODE]</span>'
AlternateTemplate='<span class="Language" style="text-transform: uppercase;">[CULTURE:THREELETTERISOCODE]</span>'
SelectedItemTemplate='<span class="Language selected" title="[CULTURE:NATIVENAME]" style="text-transform: uppercase;">[CULTURE:THREELETTERISOCODE]</span>'
/>
That displays links with the three letter ISO-Code, and a popup with the native name when hovering over them.
There is no need to check whether there is only one language or more, as the skin object is hidden automatically when only one languge is activated, or the current page is not translated (or the translations are not published) yet.

How to get name & link of parent page in DNN

I want to have a link on children pages that is not only the name of the parent page, but also links to the parent page in DNN.
Use this in your skin ascx file
<a href="<%= ((DotNetNuke.Entities.Tabs.TabInfo)PortalSettings.ActiveTab.BreadCrumbs[ PortalSettings.ActiveTab.Level - 1 ]).FullUrl %>">
<%= ((DotNetNuke.Entities.Tabs.TabInfo)PortalSettings.ActiveTab.BreadCrumbs[ PortalSettings.ActiveTab.Level - 1 ]).TabName %>
</a>
Note: this is for a C# skin.

Dotnetnuke Actions button missing from site

I am using DNN 5.1 on a project and something's happened that I cannot quite figure out. The control button which controls the actions of any html module has gone missing. If I check the event viewer of DNN, this is what I get:
Message: DotNetNuke.Services.Exceptions.ModuleLoadException: Object reference not set
to an instance of an object. ---> System.NullReferenceException: Object reference not
set to an instance of an object. at otNetNuke.UI.Containers.ActionBase.get_ActionRoot()
at DotNetNuke.UI.WebControls.SolPartActions.BindMenu() at
DotNetNuke.UI.WebControls.SolPartActions.Page_PreRender(Object sender, EventArgs e) ---
End of inner exception stack trace
It seems to be a problem with the Skin file because if I switch to another skin ,the Actions button is back as normal. What I am not getting though is how this has changed since the last time I successfully used it.
If someone has some suggestions I would appreciate it.
I would suggest looking into your module container .ascx file and remove the references to solpart! and replace with a different provider. I find the standard ones are very slow. I will grab the code from one of my container .ascx files for you to examine - this uses another menu provider to handle the little admin menu's
<%# Control Language="vb" Codebehind="~/admin/Containers/container.vb" AutoEventWireup="false"
Explicit="True" Inherits="DotNetNuke.UI.Containers.Container" %>
<%# Register TagPrefix="ddr" TagName="ACTIONS" src="~/DesktopModules/DDRMenu/Actions.ascx" %>
<%# Register TagPrefix="dnn" TagName="TITLE" Src="~/Admin/Containers/Title.ascx" %>
<%Dim ModuleTitle As String = DotNetNuke.UI.Containers.Container.GetPortalModuleBase(dnnTITLE).ModuleConfiguration.ModuleTitle()%>
<dnn:title runat="server" id="dnnTitle" visible="false" />
<h3><%= ModuleTitle %></h3>
<div class="tab_edging" id="ContentPane" runat="server" style="border:1px solid white">
</div>
<div class="spacer">
<ddr:ACTIONS runat="server" />
</div>
we have installed an extra menu provider from http://www.dnngarden.com/Download.T87.aspx which i suggest you take a look at!
The problem is probably the container or some errant javascript. I would try switching to a different default container first. If that doesn't do it, look to see if there is any Javascript that is throwing errors (I generally do this in the Firefox Error console, but there are many ways).

Resources