hiding login link
Last Post 03/25/2010 9:55 AM by Joseph Craig. 44 Replies.
Author Messages
freedom22
Posts:20


--
01/31/2009 6:12 AM
    I would like to build a dnn site where anonymous users do NOT see a register/login link, but administrators can login and edit the site by going to a separate page (e.g., www.sitename.com/admin) to login.

    Is this possible with DNN?

    Mark
    Joseph Craig
    DNN MVP
    Posts:11667


    --
    01/31/2009 9:30 AM
    Yes.

    Set your site to have no registrations (on the Admin, Site Settings page).

    The login page will be available at www.sitename.com/login.aspx.

    Joe Craig, Patapsco Research Group
    Complete DNN Support
    freedom22
    Posts:20


    --
    01/31/2009 9:37 AM
    Hi Joe,

    Thanks for your comment. Doesn't setting no registrations only remove the 'Register' link, but not the 'login' link? I(I tried setting up a site with "no registrations" and found the login link still visible.) Also, is www.sitename.com/login.aspx built in to the dotnetnuke framework? or do i have to set something up to get that? Would 'hiding' pages be of any use?

    Thanks
    Mark
    Joseph Craig
    DNN MVP
    Posts:11667


    --
    01/31/2009 11:11 AM
    Yes.  You are absolutely correct.  I should have had a cup this morning before answering.

    If you want to completely remove the login link, you can remove that skin object from within your skin file.  If you are working with an html version of the skin, you for "[LOGIN]" in the skin file, and just remove it.  If you want to remove the user skin object, that is "[USER]"

    The USER skin object displays "Register" (if permitted) to non-logged in users and the Display name to logged in users.

    The LOGIN skin object displays "Login" or "Logout"

    If you are working with .ascx skin files, then you'll want to look for and remove:

               < dnn:USER  runat="server" id="dnnUSER" / >
              < dnn:LOGIN runat="server" id="dnnLOGIN" / >


    Even if you don't want to display a login link to visitors, you might want to display the display name and a logout link once people have logged in.  John Mitchell (Snapsis.com) is the source of this code:

                < %  If DotNetNuke.Security.PortalSecurity.IsInRole("Registered Users")  Then% >
                        < div id="LoginUserContainer" >
                            < dnn:User cssclass="BannerLinks" runat="server" id="dnnUser" url="" / >  
                              | 
                            < dnn:Login runat="server" cssclass="BannerLinks" id="dnnLogin" / >                       
                        < /div >     
                 < % End If % >

    (note that I've added some spaces to that the html tags won't be interpreted as such when this message is posted - remove them to use it.)

    If you add the conditional stuff around the USER and LOGIN skin objects, they will only be displayed to registered users.  YOu can change the role if you want to do this only for Administrators, for instance.

    Visit Snapsis' DotNetNuke support forums and you'll find a thread that has other uses for conditional code in skin files.

    I left out another way to login.  Either of these should work, provided that you haven't altered the default login page:

               http://mysite.com/login.aspx
               http://mysite.com/?ctl=login

    There are also logoff.aspx and ?ctl=logoff.

    Joe Craig, Patapsco Research Group
    Complete DNN Support
    freedom22
    Posts:20


    --
    01/31/2009 11:32 AM
    Joe,

    Thanks again for your prompt reply. I can do that for the skin. Thanks.
    Maybe the reason I am getting nowhere with the http://localhost/dnn_451_test/login.aspx to no avail.
    Does the 'login.aspx' trick only work for sites that have a real domain name? e.g., www.domainname.com/login.aspx?

    Thanks
    Mark
    Joseph Craig
    DNN MVP
    Posts:11667


    --
    01/31/2009 11:37 AM
    That trick should work.

    If you browse to your site as http://localhost/dnn_451_test, then appending /login.aspx to the url should work.

    You can also click your existing login link, and copy the URL that appears in your browser when you get to the login page.  You can simplify what is there, particularly removing the returnurl stuff.   But, copy that url and see if pasting it into the address box works.  Then continue to simplify it.

    Joe Craig, Patapsco Research Group
    Complete DNN Support
    freedom22
    Posts:20


    --
    01/31/2009 11:51 AM

    Hi Joe,

    It turns out that if I click the login link to get to the site, and copy that URL and append the login.aspx, I can get to the site just fine. (In fact I simplified somewhat by getting rid of the returnURL part and just used

    localhost/dnn_451_test/Home/tabID/37/ctl/Login/Default.aspx/login.aspx)

     

    However, if I just use 'localhost/dnn_451_test/login.aspx' I get a server error

    "Server Error in '/DNN_451_Test' Application
    The resource cannot be found.
    Description HTTP 404
    Requested URL: /dnn_451_test/login.aspx

     

    Maybe with locally hosted sites I have to use the larger version of the URL?

     

    Mark

     

    Joseph Craig
    DNN MVP
    Posts:11667


    --
    01/31/2009 12:08 PM
    I say go with what works! 

    You might be able to removed tabID/37.  Keep pruning ... 

    (Localhost isn't special, so I don't know why the even simpler version won't work.(

    Joe Craig, Patapsco Research Group
    Complete DNN Support
    freedom22
    Posts:20


    --
    01/31/2009 12:30 PM

    Well, I will just go with what works then. I can't get the short version to work on my machine. Thanks for your help, Joe.

     

    Mark

     

    Déclic Vidéo FX
    Nuke Pro
    Nuke Pro
    Posts:93


    --
    09/25/2009 2:44 PM
    Hello,

    I would like to know if it is possible to show the LOGIN name instead of the DISPLAY NAME at the top of the page where the login appears (once the user is logged in).
    Thanks in advance,
    DV FX
    Déclic Vidéo FX - http://declic-video-fx.com
    Joseph Craig
    DNN MVP
    Posts:11667


    --
    09/25/2009 2:54 PM
    Perhaps the easiest way to do this would be to configure the Display Name to be the same as the Username.  You can do this on the User Settings page from User Accounts.

    Existing users will not be changed, but you can change it by running a SQL query to update DisplayName from Username.  Both are columns in the Users table.  So ... something like:

                UPDATE Users SET DisplayName = Username

    (Note that I didn't test this, so be sure to test it on a copy of your database before using it.  You can do this in the Host, SQL query window.)

                SELECT * FROM Users

    is the query you would use to check the results.

    Joe Craig, Patapsco Research Group
    Complete DNN Support
    Déclic Vidéo FX
    Nuke Pro
    Nuke Pro
    Posts:93


    --
    09/25/2009 3:13 PM
    Hello Jcraig,

    Thanks for the answer, but that's not what I am trying to do. In fact, it is related to this topic, I am searching to display the LOGIN-NAME at the top of the screen, instead of Display name. By doing what you propose, it mean that all my database is modified, and when using "displayname" in other module (like comments from Ventrian), it will display Username instead of displayname, and that's not what I want...

    In my skin (*.ascx), I just want to alter the < dnn:USER runat="server" id="dnnUSER" / > to something which show the USERNAME instead of DISPLAY NAME... Possible ??
    Is there any token for this ???...

    DV FX
    Déclic Vidéo FX - http://declic-video-fx.com
    Joseph Craig
    DNN MVP
    Posts:11667


    --
    09/25/2009 3:22 PM
    Create a content page where you want this to appear, and drop in a text/HTML module with token replacement enabled.  You have these tokens to work with:


    [User: DisplayName]

    User’s Display Name

    [User:Email]

    User’s Email Address

    [User:FirstName]

    User’s First Name

    [User:FullName]

    [deprecated]

    [User:LastName]

    User’s Last Name

    [User:Username]

    User’s Login User Name


    The TEXT skin object also supports token replacement (http://www.dotnetnuke.com/LinkClick...&mid=3944)

    You can use the TEXT and USER skin objects along with the conditional statemens shown in this thread to really customize things depending on whether the user is logged in or not, is a member of a specific role, etc.

    Joe Craig, Patapsco Research Group
    Complete DNN Support
    Déclic Vidéo FX
    Nuke Pro
    Nuke Pro
    Posts:93


    --
    12/30/2009 6:38 AM
    Hello,

    Sorry for bothering you with this, but I was unable to achieve what you described...
    :-(

    I would like to do the following: for all authenticated users, REPLACE the "login-name" which appears in my skin (all pages), with the "display-name"
    How could I achieve this ??
    I have seen that in my skin, there is the following:
    <dnn:USER runat="server" id="dnnUSER" CssClass="User_Link" />
    If I replace with dnnISPLAYNAME, it does not work.

    Can you guide me please ?
    Thanks,
    DV FX
    Déclic Vidéo FX - http://declic-video-fx.com
    Joseph Craig
    DNN MVP
    Posts:11667


    --
    12/30/2009 8:19 AM
    I'm a bit confused over your question.  If you are using the USER skin object in your skin, then it does display the DISPLAYNAME for authenticated users.

    Joe Craig, Patapsco Research Group
    Complete DNN Support
    Déclic Vidéo FX
    Nuke Pro
    Nuke Pro
    Posts:93


    --
    12/30/2009 8:34 AM
    Sorry, I make an error. I would like to replace displayname by login-name....

    DV FX
    Déclic Vidéo FX - http://declic-video-fx.com
    Joseph Craig
    DNN MVP
    Posts:11667


    --
    12/30/2009 8:47 AM
    OK, that makes sense! 

    The USER skin object doesn't have an option to display anything other than the display name.  So, you will have to make a modification.

    If I were doing this, I would take the existing skin object and create an alternative skin object.  You will need to have a tiny bit of programming skill.  For information on creating skin objects, take at look here.

    Take the existing skin object, and create a skin object named USER-ALT.  For an absolute minimum, change the line that refers to objuserInfo.DisplayName to refer to objuserInfo.UserName.

    If you want to make if somewhat more useful, add an attribute that lets you choose between UserName and DisplayName.

    If this is beyond you ... let me know.  If I have some free time over the weekend, I might get motivated to do this ...

    Joe Craig, Patapsco Research Group
    Complete DNN Support
    Joseph Craig
    DNN MVP
    Posts:11667


    --
    12/30/2009 10:05 AM
    It was a short time to the weekend, and I shirked doing what I should be doing this morning ... so see the attached file, which is an installable skin object for DNN 5.x.

    This will install in DesktopModules/User-A and you can reference it in your skin files.  The attached index 1024.ascx file is a modification to the corresponding file in the Minimal Extropy skin.  You will see an additional register tag and a slight change to the tag that references the skin object.  I added a DisplayOption attribute.  If DisplayOption = "UserName" then the username is displayed.  Otherwise, the DisplayName will be shown just like the original skin object.

    Joe Craig, Patapsco Research Group
    Complete DNN Support
    Déclic Vidéo FX
    Nuke Pro
    Nuke Pro
    Posts:93


    --
    01/02/2010 10:29 AM
    Wow Joe,

    THANKS SO MUCH !! I am very happy to have it done, because I do not know how you done this ! I am a completely novice with such kind of things.
    Nevertheless, I still have some problems, I tried to use it, but I have the following error message:

    Could Not Load Skin: /Portals/0/Skins/s00/home.ascx Error: c:\hosting\xxxxxxxxxxxxxx\DesktopModules\User-A\User-A.ascx.vb(143): error BC30451: Name 'RegisterURL' is not declared.
    (I have replaced the path with xxxxx)


    Here is what I done:
    1/ Download the two files you sent me.
    2/ HOST > Module Definition > Install New Module and I used 1123052696871.zip
    Everything went well
    Resource Upload Logs

    StartJob Starting Installation
    StartJob Reading files
    Info Loading user-a.ascx
    Info File user-a.ascx read successfully
    Info Loading user-a.ascx.vb
    Info File user-a.ascx.vb read successfully
    Info Loading user-a.dnn
    Info File user-a.dnn read successfully
    EndJob Reading files done.

    StartJob Reading Installation Manifest file
    Info DNN file is in valid 2.0 SkinObject format.
    Info xml loaded.
    Info Loading files info
    Info Loading Modules info
    Info Loading Control info for '' module
    EndJob Manifest file finished successfully

    StartJob Begin Sql execution
    EndJob Finished Sql execution

    StartJob Creating files
    Info Created c:\hosting\xxxxxxxxxxxxxx\DesktopModules\USER-A\user-a.ascx
    Info Created c:\hosting\xxxxxxxxxxxxxx\DesktopModules\USER-A\user-a.ascx.vb
    Info Created c:\hosting\xxxxxxxxxxxxxx\DesktopModules\USER-A\user-a.dnn.config
    EndJob Files created

    Info Registering Controls
    EndJob Registering finished

    EndJob Installation successful.

    3/ Then I downloaded the file 112305271154.zip, I extracted it, and then I copy the code into my skin.

    When accessing the home page, I have the error message:

    Could Not Load Skin: /Portals/0/Skins/s00/home.ascx Error: c:\hosting\xxxxxxxxxxxxxx\DesktopModules\User-A\User-A.ascx.vb(143): error BC30451: Name 'RegisterURL' is not declared.

    I am running DNN 4.9.5
    What could I do ??
    Thanks so much,
    DV FX
    Déclic Vidéo FX - http://declic-video-fx.com
    Joseph Craig
    DNN MVP
    Posts:11667


    --
    01/02/2010 10:51 AM
    Whoops. I did this for DotNetNuke 5.x. I think that this might not work with Version 4.x. I'll have to make a version for 4.x.

    Joe Craig, Patapsco Research Group
    Complete DNN Support
    Déclic Vidéo FX
    Nuke Pro
    Nuke Pro
    Posts:93


    --
    01/02/2010 10:53 AM
    I suppressed in user-a.ascx.vb the line:

    Response.Redirect(RegisterURL(HttpUtility.UrlEncode(NavigateURL()), Null.NullString), True)

    I then add an error: (145): error BC30451: Name 'ProfileURL' is not declared.
    Then I removed the line for "profileURL", and it works, but only for registered user...
    I can not stay like that, should I revert and remove the file or should I keep it ?

    DV FX
    Déclic Vidéo FX - http://declic-video-fx.com
    Déclic Vidéo FX
    Nuke Pro
    Nuke Pro
    Posts:93


    --
    01/02/2010 10:54 AM
    Posted By Joseph Craig on 02 Jan 2010 10:51 AM
    Whoops. I did this for DotNetNuke 5.x. I think that this might not work with Version 4.x. I'll have to make a version for 4.x.

    Wow, would be wonderful !!!!
    Give me your address and I will send you some swiss chocolate !!!
    ;-)

    DV FX
    PS: If you do a new version, should I re-install everything or just replace by FTP the .vb file ???
    Déclic Vidéo FX - http://declic-video-fx.com
    Joseph Craig
    DNN MVP
    Posts:11667


    --
    01/02/2010 11:05 AM
    OK, I got a copy of Version 4.x and made the modifications to that one.  Use the user-a.ascx.vb file that is attached and use it to replace the one in the zip file I uploaded earlier.  Keep the ascx and dnn files.  Hopefully this will work.  I haven't tested it because I don't have a running 4.9.x system.

    Let me know if there are any errors and I'll try to fix them.

    Joe Craig, Patapsco Research Group
    Complete DNN Support
    Joseph Craig
    DNN MVP
    Posts:11667


    --
    01/02/2010 11:07 AM
    Replacing the file with ftp should work!

    Don't worry about the chocolate ... but if my daughter moves to Geneva this spring ... 

    Joe Craig, Patapsco Research Group
    Complete DNN Support
    Déclic Vidéo FX
    Nuke Pro
    Nuke Pro
    Posts:93


    --
    01/02/2010 11:33 AM
    Hello Joe,

    Are you sure that you uploaded the correct zip ? I still have the same error...
    I try from the beginning and I will let you know !!
    But I insist for the swiss chocolate. If our daughter come here, for sure I can give it to her as well !!!

    DV FX
    Déclic Vidéo FX - http://declic-video-fx.com
    Joseph Craig
    DNN MVP
    Posts:11667


    --
    01/02/2010 11:37 AM
    Oops!  Try this one!

    Joe Craig, Patapsco Research Group
    Complete DNN Support
    Déclic Vidéo FX
    Nuke Pro
    Nuke Pro
    Posts:93


    --
    01/02/2010 2:52 PM
    IT WORKS PERFECTLLY !!!!!!!!! Thanks so much Joe !!!
    Does it affect my web performance ??

    How could I thank you please, I would like to send chocolates !!
    DV FX
    Déclic Vidéo FX - http://declic-video-fx.com
    Joseph Craig
    DNN MVP
    Posts:11667


    --
    01/02/2010 3:11 PM
    Performance should be almost identical to the original skin object.  The only substantial difference is an "If" statement.

    As for thanks, recommend DNNCreative to all of your friends.  I had fun doing this, and I may have learned some things.  That's a nice reward for me.

    Joe Craig, Patapsco Research Group
    Complete DNN Support
    Déclic Vidéo FX
    Nuke Pro
    Nuke Pro
    Posts:93


    --
    01/02/2010 3:44 PM
    Be sure I will do so (I am an old subscriber to your video) !!!!!!!

    As you may know, I am trying to compile a guide for DNN users with multi lingual portal... here: http://declic-video-fx.com/language...S/DNN.aspx
    I have just re-writted my small note regarding DNN Creative !

    DV FX
    Déclic Vidéo FX - http://declic-video-fx.com
    hanleyhansen
    Nuker
    Nuker
    Posts:17


    --
    01/26/2010 1:44 PM
    hanleyhansen
    Nuker
    Nuker
    Posts:17


    --
    01/26/2010 1:45 PM
    Posted By Joseph Craig on 31 Jan 2009 11:11 AM
    Yes.  You are absolutely correct.  I should have had a cup this morning before answering.

    If you want to completely remove the login link, you can remove that skin object from within your skin file.  If you are working with an html version of the skin, you for "[LOGIN]" in the skin file, and just remove it.  If you want to remove the user skin object, that is "[USER]"

    The USER skin object displays "Register" (if permitted) to non-logged in users and the Display name to logged in users.

    The LOGIN skin object displays "Login" or "Logout"

    If you are working with .ascx skin files, then you'll want to look for and remove:

               < dnn:USER  runat="server" id="dnnUSER" / >
              < dnn:LOGIN runat="server" id="dnnLOGIN" / >


    Even if you don't want to display a login link to visitors, you might want to display the display name and a logout link once people have logged in.  John Mitchell (Snapsis.com) is the source of this code:

                < %  If DotNetNuke.Security.PortalSecurity.IsInRole("Registered Users")  Then% >
                        < div id="LoginUserContainer" >
                            < dnn:User cssclass="BannerLinks" runat="server" id="dnnUser" url="" / >  
                              | 
                            < dnn:Login runat="server" cssclass="BannerLinks" id="dnnLogin" / >                       
                        < /div >     
                 < % End If % >

    (note that I've added some spaces to that the html tags won't be interpreted as such when this message is posted - remove them to use it.)

    If you add the conditional stuff around the USER and LOGIN skin objects, they will only be displayed to registered users.  YOu can change the role if you want to do this only for Administrators, for instance.

    Visit Snapsis' DotNetNuke support forums and you'll find a thread that has other uses for conditional code in skin files.

    I left out another way to login.  Either of these should work, provided that you haven't altered the default login page:

               http://mysite.com/login.aspx
               http://mysite.com/?ctl=login

    There are also logoff.aspx and ?ctl=logoff.


    This is exactly what I'm looking for. However, I'm fairly new to DNN so where do I have to add all this stuff in? Where do I put the conditionals?
    Joseph Craig
    DNN MVP
    Posts:11667


    --
    01/26/2010 8:29 PM
    Those go in your ascx skin.

    Take a look at the recent tutorials on skinning:

    Don't let the work "professional" scare you off as these are all quite accessible.


    Joe Craig, Patapsco Research Group
    Complete DNN Support
    hanleyhansen
    Nuker
    Nuker
    Posts:17


    --
    01/27/2010 6:04 AM
    Thank you! I will definitely take a look at that.
    hanleyhansen
    Nuker
    Nuker
    Posts:17


    --
    01/27/2010 12:02 PM
    What part of the ascx file does the conditional go in?
    hanleyhansen
    Nuker
    Nuker
    Posts:17


    --
    01/27/2010 12:03 PM
    Also, I made my skin in Artisteer so I have to ascx files, page.ascx and page-admin.ascx. Do i have to put it in both? Or how does that work?
    Joseph Craig
    DNN MVP
    Posts:11667


    --
    01/27/2010 12:58 PM
    I haven't used Artisteer, but I assume that you actually have two skin files.  One if for normal pages and one for admin type pages.

    I'd probably only put the conditional stuff on normal page skin.  The admin type pages will only be seen to logged in admins or in special situations.

    Joe Craig, Patapsco Research Group
    Complete DNN Support
    hanleyhansen
    Nuker
    Nuker
    Posts:17


    --
    01/27/2010 1:02 PM
    Makes sense. What part of the ascx file do I put it in? I would really appreciate your help because I have to get this done and it also serves me good for future ascx editing. Thank you.
    Joseph Craig
    DNN MVP
    Posts:11667


    --
    01/27/2010 1:08 PM
    I strongly recommend that you view the tutorials, as things may make a lot more sense.

    The short answer is that you need to find where the skin objects are located in the page, and then wrap the conditional code around them.

    Joe Craig, Patapsco Research Group
    Complete DNN Support
    hanleyhansen
    Nuker
    Nuker
    Posts:17


    --
    01/27/2010 1:12 PM
    The tutorials you sent me require a subscription. I'm assuming that the skin objects are defined here:

    <%@ Control language="vb" CodeBehind="~/admin/Skins/skin.vb" AutoEventWireup="false" Explicit="True" Inherits="DotNetNuke.UI.Skins.Skin" %>
    <%@ Register TagPrefix="dnn" TagName="LOGO" Src="~/Admin/Skins/logo.ascx" %>
    <%@ Register TagPrefix="dnn" TagName="LOGIN" Src="~/Admin/Skins/login.ascx" %>
    <%@ Register TagPrefix="dnn" TagName="BREADCRUMB" Src="~/Admin/Skins/breadcrumb.ascx" %>
    <%@ Register TagPrefix="dnn" TagName="ARTMENU" Src="~/DesktopModules/ArtMenuSO/ArtMenuSO.ascx" %>
    <%@ Register TagPrefix="dnn" TagName="STYLES" Src="~/Admin/Skins/Styles.ascx" %>
    <%@ Register TagPrefix="dnn" TagName="COPYRIGHT" Src="~/admin/Skins/copyright.ascx" %>
    <%@ Register TagPrefix="dnn" TagName="TERMS" Src="~/admin/Skins/terms.ascx" %>
    <%@ Register TagPrefix="dnn" TagName="PRIVACY" Src="~/admin/Skins/privacy.ascx" %>
    <%@ Register TagPrefix="dnn" TagName="TEXT" Src="~/admin/Skins/Text.ascx" %>

    So could I put the conditional under that?
    Joseph Craig
    DNN MVP
    Posts:11667


    --
    01/27/2010 1:14 PM
    No, you need to put the conditional code in the part of the skin where the LOGIN skin object is actually used.

    Joe Craig, Patapsco Research Group
    Complete DNN Support
    hanleyhansen
    Nuker
    Nuker
    Posts:17


    --
    01/27/2010 1:17 PM
    Ok, I see. Well the LOGIN skin object is called in this line:

    dnn:ARTMENU ID="ArtMenu1" ShowHiddenTabs="False" ShowAdminTabs="True" ShowDeletedTabs="False" ShowLoginTab="True" ShowUserTab="True" runat="server"

    So I can place it under there? Or am I misunderstanding?
    Joseph Craig
    DNN MVP
    Posts:11667


    --
    01/27/2010 1:24 PM
    Wrap that line with the conditional code.

    Joe Craig, Patapsco Research Group
    Complete DNN Support
    hanleyhansen
    Nuker
    Nuker
    Posts:17


    --
    01/27/2010 1:26 PM
    Got it, thank you very much!
    daCodez
    Nuke Newbie
    Nuke Newbie
    Posts:1


    --
    03/25/2010 9:51 AM
    How can i redirect a user to a page after logging in. The dnn login control does not have a url property that i can find.
    Joseph Craig
    DNN MVP
    Posts:11667


    --
    03/25/2010 9:55 AM
    Look at User Settings from the User Accounts page.  You can specify a "redirect after login" page.

    Joe Craig, Patapsco Research Group
    Complete DNN Support


    ---