The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Profile background

+2
Ange Tuteur
Tonight
6 posters

Go down

Solved Profile background

Post by Tonight 29/1/2015, 15:02

Hi, is it possible to give members ability to have their personal profile background? Something with similar script as this: https://help.forumotion.com/t137498-profile-song-javascript-help

Forum version: phpBB3


Last edited by Tonight on 31/1/2015, 06:50; edited 1 time in total
Tonight
Tonight
Forumember

Male Posts : 312
Reputation : 80
Language : Estonian, English, Russian
Location : Estonia

Back to top Go down

Solved Re: Profile background

Post by Ange Tuteur 29/1/2015, 15:57

Hello @Tonight,

Create a new profile field that has these options :

Type : Text field
Display : Profiles

The rest is up to you.


Next go to Administration Panel > Modules > JavaScript codes management > Create a new script

Title : Your choice
Placement : In all the pages
Paste the code below :
Code:
window.location.pathname.match(/\/u\d+/) & $(function() { $('#profile-tab-field-profil dl').click(function() { alert(this.id) }) });

Go to your profile and click on the field that you just added. Copy the ID which shows up, and then you can remove this script.


Now create another script :

Title : Your choice
Placement : In all the pages
Paste the code below :
Code:
window.location.pathname.match(/\/u\d+/) && $(function() {
  var field = 'field_id-11';
  document.body.style.backgroundImage = 'url(' + $('#'+field+' .field_uneditable').text() + ')';
});

All you need to do is replace field_id-11 with the ID which you copied before, and you should be set. Wink
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13207
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

Solved Re: Profile background

Post by Tonight 30/1/2015, 04:16

Hey, works great. Smile But is there a way to have default background as well? So if member hasn't picked a custom background, then there will be default background chosen by me.
Tonight
Tonight
Forumember

Male Posts : 312
Reputation : 80
Language : Estonian, English, Russian
Location : Estonia

Back to top Go down

Solved Re: Profile background

Post by Ange Tuteur 30/1/2015, 04:24

Try this :
Code:
window.location.pathname.match(/\/u\d+/) && $(function() {
  var field = 'field_id-11', default_bg = '', bg = $('#'+field+' .field_uneditable').text();
  bg.length ? bg = bg : bg = default_bg;
  document.body.style.backgroundImage = 'url(' + bg + ')';
});

You'll see a variable named default_bg place your image between the quotes. Wink
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13207
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

Solved Re: Profile background

Post by Rupture 30/1/2015, 05:00

Hello,

When I click on otheer tabs the background becomes black. Like on Profile it's fine but on Wall it's just black.
Also is there a way to hide the link from the public profile page?
Also, when I try to edit the picture link, I can't tripple click to highlight the whole link, which means I have to manually highlight the link.

Are there ways to fix this? Thanks


EDIT: Another problem is that if someone doesn't upload a pipcture, the background becomes black.
Rupture
Rupture
Forumember

Male Posts : 328
Reputation : 6
Language : English, Español, Deutsch, Catalá
Location : Earth

http://raptorgaming.forumotion.com

Back to top Go down

Solved Re: Profile background

Post by Tonight 30/1/2015, 06:45

Yeah, there's a slight problem. It takes background-color as default, I'd like it to take background-image.
Tonight
Tonight
Forumember

Male Posts : 312
Reputation : 80
Language : Estonian, English, Russian
Location : Estonia

Back to top Go down

Solved Re: Profile background

Post by _Twisted_Mods_ 30/1/2015, 06:57

i havent used or tested this so im not 100% on this but

put a img url in
Code:
default_bg = 'imageurl.gif'

as for hiding the field this should work
Code:
window.location.pathname.match(/\/u\d+/) && $(function() {
  var field = 'field_id-11', default_bg = '', bg = $('#'+field+' .field_uneditable').text();
  $('#'+field).css('display','none');
bg.length ? bg = bg : bg = default_bg;
  document.body.style.backgroundImage = 'url(' + bg + ')';
});

as for everything else u have to wait on ange its his code
_Twisted_Mods_
_Twisted_Mods_
Helper
Helper

Male Posts : 2083
Reputation : 336
Language : English
Location : Ms

http://liquidcode.forumotion.com

Back to top Go down

Solved Re: Profile background

Post by Rupture 30/1/2015, 08:04

If I put the default bg image the other one won't appear on the main profile tab. 

I have yet to mess with the second code as it how you gave it removes the location, will have to change the id. And about the second code, is there a way to also remove the white line? Because then all it shows is one line after then next on the profile.

Thanks a ton!
Rupture
Rupture
Forumember

Male Posts : 328
Reputation : 6
Language : English, Español, Deutsch, Catalá
Location : Earth

http://raptorgaming.forumotion.com

Back to top Go down

Solved Re: Profile background

Post by Michael_vx 30/1/2015, 08:55

hello
how about you do the 1st worked answer from Ange
https://help.forumotion.com/t138649-profile-background#939026
then do this
but while you creating the new field add the image link in the
Default content and save
or Edit the filed you did add the Default content save then use replace content
here images of what i say
Profile background Image
Profile background Image
i hope that help Very Happy
Michael_vx
Michael_vx
Forumember

Male Posts : 659
Reputation : 29
Language : Arabic and some English
Location : Egypt

Back to top Go down

Solved Re: Profile background

Post by Tonight 30/1/2015, 09:36

Using default content feature doesn't solve problems with other tabs in profiles. :/
Tonight
Tonight
Forumember

Male Posts : 312
Reputation : 80
Language : Estonian, English, Russian
Location : Estonia

Back to top Go down

Solved Re: Profile background

Post by Michael_vx 30/1/2015, 10:03

other taps ?
What the fuck ?!?
im a bit confused now
Michael_vx
Michael_vx
Forumember

Male Posts : 659
Reputation : 29
Language : Arabic and some English
Location : Egypt

Back to top Go down

Solved Re: Profile background

Post by _Twisted_Mods_ 30/1/2015, 10:13

he wants the bg image to display on the other profile tabs but it wont because it has no image url to grab on those pages .. you would have to use ajax to request the main profile page to get the image url or have the url saved to your local storage until the page no longer contains the user id ... idk its ange project ill let him do it
_Twisted_Mods_
_Twisted_Mods_
Helper
Helper

Male Posts : 2083
Reputation : 336
Language : English
Location : Ms

http://liquidcode.forumotion.com

Back to top Go down

Solved Re: Profile background

Post by Rupture 30/1/2015, 13:06

The code would work fine if the main image as displayed on the other tabs, but for it to go completely black is downer...
Rupture
Rupture
Forumember

Male Posts : 328
Reputation : 6
Language : English, Español, Deutsch, Catalá
Location : Earth

http://raptorgaming.forumotion.com

Back to top Go down

Solved Re: Profile background

Post by Tonight 30/1/2015, 15:03

_Twisted_Mods_ wrote:he wants the bg image to display on the other profile tabs but it wont because it has no image url to grab on those pages .. you would have to use ajax to request the main profile page to get the image url or have the url saved to your local storage until the page no longer contains the user id ... idk its ange project ill let him do it
Problem is that Ange's script loses forum's original background. If anyone clicks on other tabs, then he sees just black (or whatever is your bg color) instead of original image.
Tonight
Tonight
Forumember

Male Posts : 312
Reputation : 80
Language : Estonian, English, Russian
Location : Estonia

Back to top Go down

Solved Re: Profile background

Post by Michael_vx 30/1/2015, 16:06

@Tonight
i Remember i have tried that Script from Ange before and it was working cool on phpbb3
try to remove the original BG color
that could help
Michael_vx
Michael_vx
Forumember

Male Posts : 659
Reputation : 29
Language : Arabic and some English
Location : Egypt

Back to top Go down

Solved Re: Profile background

Post by Ange Tuteur 30/1/2015, 18:30

Here, try this :
Code:
window.location.pathname.match(/\/u\d+/) && $(function() {
  var field = 'field_id-11', default_bg = 'http://i38.servimg.com/u/f38/18/45/41/65/red10.gif', url = window.location.pathname.match(/(\/u\d+)/)[1],bg;
 
  if (window.location.pathname != url) {
    $.get(url,function(data){
      bg = $('#'+field+' .field_uneditable',data).text().trim();
      setBG();
    });
  } else {
    bg = $('#'+field+' .field_uneditable').text().trim();
    $('#'+field+',#'+field+'+div').hide();
    setBG();
  }
  function setBG() { bg.length > 1 ? bg = bg : bg = default_bg; document.body.style.backgroundImage = 'url(' + bg + ')'; };
});

Replace https://i.servimg.com/u/f38/18/45/41/65/red10.gif by the default BG you want to display. Wink
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13207
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

Solved Re: Profile background

Post by Tonight 31/1/2015, 06:49

Thank you, solved. Razz
Tonight
Tonight
Forumember

Male Posts : 312
Reputation : 80
Language : Estonian, English, Russian
Location : Estonia

Back to top Go down

Solved Re: Profile background

Post by Ape 31/1/2015, 13:00

Topic solved and archived


Profile background Left1212Profile background Center11Profile background Right112
Profile background Ape_b110
Profile background Ape1010
Ape
Ape
Administrator
Administrator

Male Posts : 19435
Reputation : 2010
Language : fluent in dork / mumbojumbo & English haha

http://chatworld.forumotion.co.uk/

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum