Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

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!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...User Profile in readonly and edit mode depending on roleUser Profile in readonly and edit mode depending on role
Previous
 
Next
New Post
2/10/2009 2:52 PM
 

Hi
I wonder if you can help me. I would like to set up the User Credentials page to be in edit mode for when an administrator is on that page for any user, but if a user is in their own user credentials page, it should be readonly. We want to do this to avoid people just changing their email address after they have registered.

Is this possible or is there a different way of doing this?

Thanks

 
New Post
2/10/2009 3:06 PM
 

Roy-
Instead of leveraging the USER ACCOUNT module to display user credentails for non-admins, use a Text/HTML module with DNN tokens to display the same info in a read-only manner.  You can do this for all user PROFILE fields as well.

Example: Your credentials/profile page could be a Text/HTML module (with tokens enabled under module SETTINGS) with the following content:

   Login/Username: [User: Username]
   First Name: [User: FirstName]
   Last Name: [User: LastName]
   Email:  [User: Email]
   Account added on: [Membership: CreatedDate]
  

Here's a list of available tokens:
 
   http://www.datasprings.com/Resources/ArticlesInformation/DNNTextHTMLTokenReplacementOptions/tabid/866/language/en-US/Default.aspx

Cheers!
-mamlin


esmamlin atxgeek.me
 
New Post
2/10/2009 3:27 PM
 

Hi Mamlin
Thanks for the quick reply.

Under normal circumstances that is a brilliant way to go, but I do want the user to be able to handle their own password and User Profile pages as per normal, I just was hoping there would be a way to make the User Credentials page readonly. Without wishing to write a module to do this, can you suggest a method of having a page with your suggestion as well as the password and User Profile pages in one section. I'm guessing I may need to be a bit creative and think outside the box?

Thanks

 
New Post
2/10/2009 4:42 PM
Accepted Answer 

Roy Thakur wrote

Hi Mamlin
Thanks for the quick reply.

Under normal circumstances that is a brilliant way to go, but I do want the user to be able to handle their own password and User Profile pages as per normal, I just was hoping there would be a way to make the User Credentials page readonly. Without wishing to write a module to do this, can you suggest a method of having a page with your suggestion as well as the password and User Profile pages in one section. I'm guessing I may need to be a bit creative and think outside the box?

Thanks

 
Hhhmmm....well, if you prefer not to alter core module code (I always try to avoid that myself) and if you're creating a page for the USER ACCOUNT info, you could make two fairly easy additions to the page to get the UI you want.  Note, however, that if preventing users from updating credentials is an absolute must  then this approach is simply not secure enough to prevent users from doing so (with an appropriate browser tool such as DebugBar).

The easy workaround (read: hack):

(1) The credential fields are contained by a table element with ID = "dnn_ctr_ManageUsers_User_UserEditor_tbl".  Add javascript to the page to parse the INPUT elements (getElementsByTagName) contained within the table (getElementById) and set the following attribute for each INPUT element:  disabled = "disabled"

(2) Add a Text/HTML module that is admin-view only.  Add javascript to perform reverse operation on INPUT tags:  disabled = "false"

Also -- it's probably best to insure your javascript waits until the page is fully loaded before executing.  An easy way to do this client-side is detailed here:

   Force JavaScript to run AFTER a DotNetNuke page is fully loaded
   http://www.eguanasolutions.com/DNN_Blog/EntryID/4.aspx

 
Alternate Hack....er...Method
If you prefer to do this in a single action (i.e., only disable if current user is non-admin) you could instead use a SQL module to query the DB to see if current user is an admin or superuser.  If so, do nothing -- if not, return the "disable input tags" javascript.  I've done similar with the free AdvancedDatagrid and SQLView modules -- both support use of a token to pass USERID parameter to the DB as part of a SQL query.

 
EDIT:  Also please note that this solution is easily broken if updated versions of DNN alter the layout and/or IDs of elements in the USER ACCOUNT module.  Therefore you'll need to re-validate the solution each time you upgrade DNN.  Please treat this as a potential temporary workaround rather than a permanent solution.  You'll still want to investigate module-based solutions such as the cool Dynamic Registration module by Data Springs.


-mamlin


esmamlin atxgeek.me
 
New Post
2/10/2009 4:48 PM
 

mamlin wrote


Alternate Hack....er...Method
If you prefer to do this in a single action (i.e., only disable if current user is non-admin) you could instead use a SQL module to query the DB to see if current user is an admin or superuser.  If so, do nothing -- if not, return the "disable input tags" javascript.  I've done similar with the free AdvancedDatagrid and SQLView modules -- both support use of a token to pass USERID parameter to the DB as part of a SQL query.

 
-mamlin

That's the one for me. Thanks for the help!!!

 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...User Profile in readonly and edit mode depending on roleUser Profile in readonly and edit mode depending on role


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out