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.
So just prevent this profile from being edited? (rather than all profiles)
Code:
- <script type="text/javascript">
- <!--
- if(document.profile_form && document.profile_form.user && document.profile_form.user.value == "test-account-id") {
- var input = get('input', TAG);
- for(i = 0; i<input.length; i ++) {
- input.item(i).disabled = true;
- }
- } else if(location.href.match(/\/view_profile/)) {
- var a = get('a', TAG);
- for(i = 0; i<a.length; i ++) {
- if(a.item(i).href.match(/modify_profile\/user\/test-account-id(\/|$)/)) {
- a.item(i).style.display = 'none';
- a.item(i).parentNode.removeChild(a.item(i).nextSibling);
- break;
- }
- }
- }
- -->
- </script>
Replace both instances of "test-account-id" with the username.
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![]()
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![]()
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>
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:
- if(a.item(i).href.match(/modify_profile\/user\/guest1(\/|$)/)) {
- a.item(i).style.display = 'none';
- a.item(i).parentNode.removeChild(a.item(i).nextSibling);
- 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.
View Source might help you with that
View Source might help you with that
No need to bump threads that are a year old. Thanks![]()