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