vForums Support Banner



 

Welcome Guest! Please Login or Register
vForums Support :: Programming & Coding :: Code Requests & Support :: Provent A Profile From Being Edited - View Topic
Topic Rating: *****
Printable View
This topic was locked 30th Dec 09 at 9:51am by Graham
dog199200
Guest
Provent A Profile From Being Edited (13th Oct 08 at 2:52am UTC)
OK I need a code taht will prevent an users profile from being edited, not even by them. I am requesting this because I have a guest accoutn setup on my forum so people can see the API system on the website, and i need to make sure people can not edit the guest profile on the forum and add in bad things and stuff. I would try to cod ethis myself, but I ain't got a clue where to start.
Ross
Administrator
*****

[Avatar]

Posts: 3,709
Status: Offline
Gender: Male
Age: 9 14
Joined:  

Additional Groups:
Support Team
***


Reputation: 45%  


pmwwwtwittergtalkvForum
Re: Provent A Profile From Being Edited (16th Oct 08 at 9:53am UTC)
So just prevent this profile from being edited? (rather than all profiles)

Code:
 
  1. <script type="text/javascript">
  2. <!--
  3.  
  4.     if(document.profile_form && document.profile_form.user && document.profile_form.user.value == "test-account-id") {
  5.         var input = get('input', TAG);
  6.         for(i = 0; i<input.length; i ++) {
  7.             input.item(i).disabled  = true;
  8.         }
  9.     } else if(location.href.match(/\/view_profile/)) {
  10.         var a = get('a', TAG);
  11.         for(i = 0; i<a.length; i ++) {
  12.             if(a.item(i).href.match(/modify_profile\/user\/test-account-id(\/|$)/)) {
  13.                 a.item(i).style.display = 'none';
  14.                 a.item(i).parentNode.removeChild(a.item(i).nextSibling);
  15.                 break;
  16.             }
  17.         }
  18.     }
  19.  
  20. -->
  21. </script>
 


Replace both instances of "test-account-id" with the username.

Image
dog199200
Guest
Re: Provent A Profile From Being Edited (16th Oct 08 at 3:28pm UTC)
ok i see how you did it, ok ty


edit: one small thing i didn't account for, can i possible get it so that only the admin account can edit the guest account and no one else can? I forgot that i still need to be able to edit it {Smile}
Ross
Administrator
*****

[Avatar]

Posts: 3,709
Status: Offline
Gender: Male
Age: 9 14
Joined:  

Additional Groups:
Support Team
***


Reputation: 45%  


pmwwwtwittergtalkvForum
Re: Provent A Profile From Being Edited (16th Oct 08 at 11:24pm UTC)
Posted By dog199200 on 16th Oct 08 at 3:28pm
 
ok i see how you did it, ok ty


edit: one small thing i didn't account for, can i possible get it so that only the admin account can edit the guest account and no one else can? I forgot that i still need to be able to edit it {Smile}


The simplest way for you to do that would be to wrap it in an if statement which checks the value of vf_username. eg:

<script type="text/javascript">
<!--

// Check that it is not being loaded by "admin"
if(vf_username != "admin") {

    // ... Code to disable form & remove link here ...

}

//-->
</script>

Image
dog199200
Guest
Re: Provent A Profile From Being Edited (16th Oct 08 at 11:36pm UTC)
ah ok so that would work, i didn't think it would so i didn't try..

man i forgot about guests having other features..

I tried to do duplicate this part of the code i order to remove all other profile options, but it wasn't working to well, in fact it was breaking the code:

Code:
 
  1. if(a.item(i).href.match(/modify_profile\/user\/guest1(\/|$)/)) {
  2. a.item(i).style.display = 'none';
  3. a.item(i).parentNode.removeChild(a.item(i).nextSibling);
  4. break;
 


Where it says "modify_profile" i tried putting in the other links names like "view_buddies" or "notifications"

Sorry I am still learning, I hope soon that I won't have to ask for help anymore.
Aiken
Full Member
***

[Avatar]

Posts: 333
Status: Offline
Gender: Male
Location: In a very lonely place, the domain of despair
Age: 35
Joined:  
Reputation: 12%  


pmtwitterskypemsnyahooxfire
Re: Provent A Profile From Being Edited (30th Dec 09 at 6:19am UTC)
View Source might help you with that

vF forums:
Perfect World RP
BLEACH Universe - Under Construction / Testing Phase
Xen Qarna RP - Stage I
Vyren Entar Battle Network RP - Under Construction / Maintenance Mode Enabled
the Final Anime Hideout
Graham
Support Administrator
*****

[Avatar]

Posts: 1,642
Status: Offline
Gender: Male
Location: Sussex, UK
Age: 40
Joined:  

Additional Groups:
Support Team
***


Reputation: 57%  


pmwww
Re: Provent A Profile From Being Edited (30th Dec 09 at 9:51am UTC)
 
View Source might help you with that


No need to bump threads that are a year old. Thanks {Smile}
 Printable View

All times are GMT+0 :: The current time is 3:46am
Page generated in 0.749 seconds
This Forum is Powered By vForums (v2.4)
Create a Forum for Free | Find Forums