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.
The forum of the forums
3 posters

    How to change the background in user profiles?

    Storyteller of Wonderland
    Storyteller of Wonderland
    Forumember


    Female Posts : 108
    Reputation : 10
    Language : Russian, German, French, English.
    Location : Russia

    Solved How to change the background in user profiles?

    Post by Storyteller of Wonderland June 3rd 2019, 12:08 pm

    Hello!

    Please help me. I have a script that changes the design of categories on the forum, but I’m new to scripts and don’t understand how to change a user’s profile in the same way, that is, I want three or four users to have a different background in their profile, while the links in the script, i.e. indicate on which pages the script should work.


    The script itself that I install in overal_footer_end before the </ body> tag. Although there is no difference. He also put scripts in the control panel for displaying on all pages. Does not work!

    Code:
    jQuery(document).ready(function(){

    if (jQuery('.nav a').is("[href*='c1-category']")) {
    jQuery("img#i_logo").attr('src', 'http://i15.servimg.com/u/f15/17/37/83/89/nddd3310.jpg'),
    jQuery("body").addClass("darkbody")
    }
    else {jQuery("#i_logo").show()
    }

    });

    CSS settings:

    Code:
    .darkbody {
    background: #35298B url("http://i15.servimg.com/u/f15/17/37/83/89/chbpol10.gif") top center !important;
    }

    .darkbody .bodyline {
    background-color: #1D1D22 !important;
    border: 1px solid #666 !important;
    -moz-border-radius: 5px;
    -webkit-border-radius: 5px;
    border-radius: 5px;
    -moz-box-shadow: 0px 0px 8px #000;
    -webkit-box-shadow: 0px 0px 8px #000;
    box-shadow: 0px 0px 8px #000;
    }

    .darkbody #i_logo {
    border: 1px solid #666 !important;
    }

    I take this line
    Code:
    if (jQuery('.nav a').is("[href*='c1-category']")) {

    and change the address:

    Code:
    if (jQuery('.nav a').is("[href*='u9']")) {

    The problem is that when we allow a link to a profile instead of a category, then when I view this page it shows me that there are no changes!

    why it happens ? please help me...

    Here you just need to correctly put a link to use the script on the desired page. But I dont know how ...


    Last edited by Storyteller of Wonderland on June 6th 2019, 6:38 pm; edited 1 time in total
    Storyteller of Wonderland
    Storyteller of Wonderland
    Forumember


    Female Posts : 108
    Reputation : 10
    Language : Russian, German, French, English.
    Location : Russia

    Solved Re: How to change the background in user profiles?

    Post by Storyteller of Wonderland June 4th 2019, 2:56 pm

    up
    Draxion
    Draxion
    Helper
    Helper


    Male Posts : 2518
    Reputation : 321
    Language : English
    Location : USA

    Solved Re: How to change the background in user profiles?

    Post by Draxion June 4th 2019, 6:38 pm

    Hi there,

    Are you looking for something that gives the user the power to change their own background or moderation have full control?
    Storyteller of Wonderland
    Storyteller of Wonderland
    Forumember


    Female Posts : 108
    Reputation : 10
    Language : Russian, German, French, English.
    Location : Russia

    Solved Re: How to change the background in user profiles?

    Post by Storyteller of Wonderland June 4th 2019, 10:01 pm

    Draxion wrote:Hi there,

    Are you looking for something that gives the user the power to change their own background or moderation have full control?



    Hello, Draxion!

    Ideally, to look for a non-standard choice is almost unreal. or not ?

    I want to personally change the profile design for some users. Avatar, background and other details in general. But this is not as important as the fact that I need the right link to the profile I need.

    I own the design settings perfectly, but the scripts are something ... I understand them in part, but I showed an example above that nothing came of it.

    In the last topic I asked for something funny. Ie the use of information about users in the list of users on another page. It turned out to be easy. I am writing a normal tutorial to share it.

    However, I really do not understand why the link is not active? How to correctly explain the script that you need to work on the desired page?

    no matter how I connect the script, it does not work
    SLGray
    SLGray
    Administrator
    Administrator


    Male Posts : 51498
    Reputation : 3523
    Language : English
    Location : United States

    Solved Re: How to change the background in user profiles?

    Post by SLGray June 5th 2019, 1:23 am

    Are you talking about this profile:  https://help.forumotion.com/u109089 ?



     How to change the background in user profiles? Slgray10

    When your topic has been solved, ensure you mark the topic solved.
    Never post your email in public.
    Draxion
    Draxion
    Helper
    Helper


    Male Posts : 2518
    Reputation : 321
    Language : English
    Location : USA

    Solved Re: How to change the background in user profiles?

    Post by Draxion June 5th 2019, 5:10 am

    Looking at your scripts, are you looking for something like this?
    Code:
    if (top.location.pathname === "/u9") {
      // execute code...
    }

    "/u9"
    means the profile view page of that user.
    Storyteller of Wonderland
    Storyteller of Wonderland
    Forumember


    Female Posts : 108
    Reputation : 10
    Language : Russian, German, French, English.
    Location : Russia

    Solved Re: How to change the background in user profiles?

    Post by Storyteller of Wonderland June 5th 2019, 10:45 pm

    SLGray wrote:Are you talking about this profile:  https://help.forumotion.com/u109089 ?

    Hello, SLGray, beu

    Yes Yes.

    Draxion wrote:Looking at your scripts, are you looking for something like this?
    Code:
    if (top.location.pathname === "/u9") {
      // execute code...
    }

    "/u9"
    means the profile view page of that user.

    So, but it does not work and destroys other scripts ...

    I used your string and combined it with the code, but it did not work ...
    Draxion
    Draxion
    Helper
    Helper


    Male Posts : 2518
    Reputation : 321
    Language : English
    Location : USA

    Solved Re: How to change the background in user profiles?

    Post by Draxion June 6th 2019, 2:18 am

    Think Hmm... it should work just the same, even if you used that by itself. I do have a script that I use on my site you can use that gives the user the power to change the background of their profiles. It simply takes the link out of the profile field and puts that as a background. Do you want it?

    If you want full control, you can simply allow moderators to edit the field.
    Storyteller of Wonderland
    Storyteller of Wonderland
    Forumember


    Female Posts : 108
    Reputation : 10
    Language : Russian, German, French, English.
    Location : Russia

    Solved Re: How to change the background in user profiles?

    Post by Storyteller of Wonderland June 6th 2019, 1:38 pm

    Draxion wrote:Think Hmm... it should work just the same, even if you used that by itself. I do have a script that I use on my site you can use that gives the user the power to change the background of their profiles. It simply takes the link out of the profile field and puts that as a background. Do you want it?

    If you want full control, you can simply allow moderators to edit the field.

    Oooooh! Of course!

    If possible, please give me such a script! That's cool! groar guitar Smooch
    Draxion
    Draxion
    Helper
    Helper


    Male Posts : 2518
    Reputation : 321
    Language : English
    Location : USA

    Solved Re: How to change the background in user profiles?

    Post by Draxion June 6th 2019, 5:32 pm

    Here's the script.

    ACP(Admin Control Panel) > Modules > HTML & JAVASCRIPT > Javascript codes management > Javascript codes management

    Title: Whatever you like
    Placement: All pages
    Code:
    /\/u\d+/.test(window.location.href) && $(function() {
      var field = document.getElementById('field_id9'), bg;
      if (field) {
        bg = $('.field_uneditable', field)[0];
        if (bg) document.body.style.backgroundImage = 'url(' + bg.innerHTML + ')';
      }
    });

    In the code, you change the value field_id9 with whatever field you have chosen to use for the background URL. If you don't want users to have control, simply hide the field via CSS or Java but do not remove the element as that will not allow the script to work. If you still need assistance with this, please ask.
    Storyteller of Wonderland
    Storyteller of Wonderland
    Forumember


    Female Posts : 108
    Reputation : 10
    Language : Russian, German, French, English.
    Location : Russia

    Solved Re: How to change the background in user profiles?

    Post by Storyteller of Wonderland June 6th 2019, 6:25 pm

    Draxion wrote:Here's the script.

    ACP(Admin Control Panel) > Modules > HTML & JAVASCRIPT > Javascript codes management > Javascript codes management

    Title: Whatever you like
    Placement: All pages
    Code:
    /\/u\d+/.test(window.location.href) && $(function() {
      var field = document.getElementById('field_id9'), bg;
      if (field) {
        bg = $('.field_uneditable', field)[0];
        if (bg) document.body.style.backgroundImage = 'url(' + bg.innerHTML + ')';
      }
    });

    In the code, you change the value field_id9 with whatever field you have chosen to use for the background URL. If you don't want users to have control, simply hide the field via CSS or Java but do not remove the element as that will not allow the script to work. If you still need assistance with this, please ask.

    Oh my God! It is working! Thank you buddy! Evil or Very Mad Twisted Evil TT ouou beu Super For you Flowers Cheer

    Wait! But now how to add CSS properties to this class?

    I want it to be background-attachment: fixed; and background-size: cover;
    Draxion
    Draxion
    Helper
    Helper


    Male Posts : 2518
    Reputation : 321
    Language : English
    Location : USA

    Solved Re: How to change the background in user profiles?

    Post by Draxion June 6th 2019, 6:30 pm

    You can simply add more to the script in terms of CSS with this part.
    Code:
    document.body.style.backgroundImage = 'url(' + bg.innerHTML + ')';

    Just add another line with this.
    Code:
    document.body.style.backgroundAttachement = 'fixed';

    So you the script would like this...
    Code:
    /\/u\d+/.test(window.location.href) &&
      $(function() {
        var field = document.getElementById("field_id9"),
          bg;
        if (field) {
          bg = $(".field_uneditable", field)[0];
          if (bg) document.body.style.backgroundImage = "url(" + bg.innerHTML + ")";
          document.body.style.backgroundAttachment = "fixed";
          document.body.style.backgroundSize = "cover";
        }
      });
    Storyteller of Wonderland
    Storyteller of Wonderland
    Forumember


    Female Posts : 108
    Reputation : 10
    Language : Russian, German, French, English.
    Location : Russia

    Solved Re: How to change the background in user profiles?

    Post by Storyteller of Wonderland June 6th 2019, 6:37 pm

    Draxion, does it seem to me or are you a wizard? Thank you very much! Embarassed For you

    The issue is resolved! Moderator
    Draxion
    Draxion
    Helper
    Helper


    Male Posts : 2518
    Reputation : 321
    Language : English
    Location : USA

    Solved Re: How to change the background in user profiles?

    Post by Draxion June 6th 2019, 6:39 pm

    You're very welcome!
    Problem solved & topic archived.
    Please read our forum rules: ESF General Rules

      Current date/time is September 22nd 2024, 6:30 pm