vForums Support Banner


Visit Base Classics - Gaming Chairs

 

Welcome Guest! Please Login or Register
vForums Support :: Programming & Coding :: Code Requests & Support :: Modify Profile ReLinking - View Topic
Topic Rating: *****
Printable View
dog199200
Guest
Modify Profile ReLinking (10th Sep 09 at 3:02am UTC)
Resolved
I need a code that will allow me to change where the Modify profile button is linked to unless the user is an administrator. The reason for this is because i'm using the api and have it so the information is updated off the forum so I can keep information in all the databases up to date at the same time.
Dreg[Bot]
Moderator
*****

[Avatar]
Broken

Posts: 415
Status: Offline
Gender: Male
Age: 37
Joined:  

Additional Groups:
Coding Team
***


Reputation: 14%  


pm
Re: Modify Profile ReLinking (10th Sep 09 at 4:48pm UTC)
Code:
 
  1. <script type="text/javascript">
  2. <!--
  3.  
  4. var vf_admin = false;
  5.  
  6. for (var i = 0; i < vf_usergroup.length; i ++)
  7. {
  8.     if(vf_usergroup[i] == '1')
  9.     {
  10.         vf_admin = true;
  11.     }
  12. }
  13.  
  14. if ( ! vf_admin && get('profile_links', ID))
  15. {
  16.     var pro_link = get('profile_links', ID).getElementsByTagName('a')[0];
  17.         
  18.     if (pro_link.href.match(/modify_profile/i))
  19.     {
  20.         pro_link.href = 'http://google.com';
  21.     }
  22. }
  23.  
  24. //-->
  25. </script>
  26.  
  27.  
 




Image

Now obsession rules my mind
This commotion makes me blind
Searching out who ever runs
Or has stolen away my life

But i've already said

Don't ever back down
Don't ever turn around
My end has come
So now I come for you....

dog199200
Guest
Re: Modify Profile ReLinking (10th Sep 09 at 5:25pm UTC)
it does the redirect perfectly fine, but it doesn't check to see if the user is an admin in order to remove the redirect.
Dreg[Bot]
Moderator
*****

[Avatar]
Broken

Posts: 415
Status: Offline
Gender: Male
Age: 37
Joined:  

Additional Groups:
Coding Team
***


Reputation: 14%  


pm
Re: Modify Profile ReLinking (10th Sep 09 at 8:03pm UTC)
it checks if your admin and group: 1, check your group value in the source code and change as needed.


Image

Now obsession rules my mind
This commotion makes me blind
Searching out who ever runs
Or has stolen away my life

But i've already said

Don't ever back down
Don't ever turn around
My end has come
So now I come for you....

dog199200
Guest
Re: Modify Profile ReLinking (10th Sep 09 at 10:04pm UTC)
i'm still clueless the admin group is 1, "var vf_usergroup = Array('1', '4');" 1 = Admin, 4 = Paid Member. I'm not sure why I can't get the group check to work at all.... I might have to add all the admins in manually by their username, which would just be redundant over time.
Dreg[Bot]
Moderator
*****

[Avatar]
Broken

Posts: 415
Status: Offline
Gender: Male
Age: 37
Joined:  

Additional Groups:
Coding Team
***


Reputation: 14%  


pm
Re: Modify Profile ReLinking (11th Sep 09 at 1:35am UTC)
Fixed bug, try now =]


Image

Now obsession rules my mind
This commotion makes me blind
Searching out who ever runs
Or has stolen away my life

But i've already said

Don't ever back down
Don't ever turn around
My end has come
So now I come for you....

dog199200
Guest
Re: Modify Profile ReLinking (11th Sep 09 at 2:21am UTC)
all good, thank you.
Dreg[Bot]
Moderator
*****

[Avatar]
Broken

Posts: 415
Status: Offline
Gender: Male
Age: 37
Joined:  

Additional Groups:
Coding Team
***


Reputation: 14%  


pm
Re: Modify Profile ReLinking (11th Sep 09 at 8:00am UTC)
{Cool}


Image

Now obsession rules my mind
This commotion makes me blind
Searching out who ever runs
Or has stolen away my life

But i've already said

Don't ever back down
Don't ever turn around
My end has come
So now I come for you....

 Printable View

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