vForums Support > Programming & Coding :: Database of Codes/Hacks/Mods :: > Mini Profile Background Image

Mini Profile Background Image - Posted By Michael (wrighty) on 31st Dec 07 at 1:04am
This will allow your users to add a background to their mini profile.

Global Footer

Code:
 
  1. <script>
  2. /*Mini Profile BG Image
  3. Created By Wrighty
  4. support.virtualforums.co.uk*/
  5.  
  6. if(document.profile_form && document.profile_form.hidden){
  7. var f  = document.profile_form;
  8. r = f.avatar_height.parentNode.parentNode.parentNode.parentNode.insertRow(16);
  9. r.insertCell(0).innerHTML = '<font size=2>Mini-Profile Bg:</font>';
  10. r.insertCell(1).innerHTML = '<input type="text" size="25" name="vf_mp">';
  11. r.insertCell(2).innerHTML = '<font size=1>Enter a URL to the image you want to use as the background for your miniprofile.</font>';
  12. f.vf_mp.value=(f.hidden.value.match(/{vf_mp:(.+?)}/))?RegExp.$1:'';
  13. f.hidden.value = f.hidden.value.replace(/{vf_mp:(.+?)}/,'');
  14. function save(){
  15. if(!f.vf_mp.value == "" ){
  16. f.hidden.value = '{vf_mp:'+f.vf_mp.value+'}' +f.hidden.value;
  17. }}
  18. if(document.addEventListener){
  19. f.addEventListener('submit', save,false);
  20. }else{
  21. f.attachEvent('onsubmit', save);
  22. }}
  23. if(location.href.match(/view/)) {
  24. var x=document.getElementsByTagName('td');
  25. for(i=0;i<x.length;i++){
  26. if(x[i].width=="20%"){
  27. var d = x[i].getElementsByTagName('span')[0];
  28. BgImg= (d.innerHTML.match(/{vf_mp:(.+?)}/))?RegExp.$1:'';
  29. x[i].style.backgroundImage = 'url("'+BgImg+'")';
  30. }}}
  31. </script>
 

Re: Mini Profile Background Image - Posted By Nick (nickb) on 31st Dec 07 at 1:24am
For the second post, on my forum it does not show the background, but on my first post it shows.

Example:

Darkmage

Re: Mini Profile Background Image - Posted By Michael (wrighty) on 31st Dec 07 at 1:35am
Recopy the code! {Smile}

Re: Mini Profile Background Image - Posted By Nick (nickb) on 31st Dec 07 at 1:44am
ok thanks ^_^

EDIT: Now its not working at all {Unsure}
http://ffnation.virtualforums.co.uk/action/view_profile/user/admin/

Re: Mini Profile Background Image - Posted By Michael (wrighty) on 31st Dec 07 at 1:54am
recopy... hmm strange..

I just recopied from my forum.

Re: Mini Profile Background Image - Posted By Nick (nickb) on 31st Dec 07 at 1:58am
{Unsure} Nope it still don't, and the image fully goes in.

Re: Mini Profile Background Image - Posted By Michael (wrighty) on 31st Dec 07 at 2:03am
haha I win!

I beat the code! {Tongue Out}

I know why it was, I had it coded to work with the tabulated mini profile, it now works with both side mini profiles! {Smile}

Re: Mini Profile Background Image - Posted By Nick (nickb) on 31st Dec 07 at 2:08am
ok thanks. Do I have to re copy?

Re: Mini Profile Background Image - Posted By Michael (wrighty) on 31st Dec 07 at 2:09am
ya.. sorry

Re: Mini Profile Background Image - Posted By Nick (nickb) on 31st Dec 07 at 2:12am
ok thanks ^_^