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.

Group post profile bakground

4 posters

Go down

Group post profile bakground Empty Group post profile bakground

Post by Mimóza Sat 2 Jan - 15:38

Hello,
I'd like to add different background images to the different group's post profile.
Anyone could help me, please? Very Happy 

Group post profile bakground Customizeable

Group post profile bakground Bgadmin

punbb 
http://escvillage.createtopic.com/
Mimóza
Mimóza
Forumember

Female Posts : 676
Reputation : 278
Language : Hungarian, English

https://graphicballoon.forumotion.com/

Back to top Go down

Group post profile bakground Empty Re: Group post profile bakground

Post by 10spetter10 Sat 2 Jan - 16:18

I haven't really tested it but I guess this should do.

It takes the value of the title attribute of the rank image and place that as a classname to the profile.

Javascript, on the topics:
Code:
$(function () {
  $('div.author-info').each(function () {
      if($(this).find('img').length) {
        var rank = $(this).find('img').attr('title');
        var contProfile = $('this').parent();
        contProfile.addClass(rank);
      }
  });
});

css:
Code:
div.topic-author.Admin {
  background: red;
}
10spetter10
10spetter10
Forumember

Posts : 195
Reputation : 82
Language : Dutch

Back to top Go down

Group post profile bakground Empty Re: Group post profile bakground

Post by YoshiGM Sat 2 Jan - 16:36

Hi @Mimóza,
First, Go To : ACP > Modules > Javascript codes management.

And create a new one:

Code:
$(function() { $('st-admin').closest('div.topic-author').addClass('st-admin');
});

Place: In All Pages.

Next, Go Users & Groups > Rank Administration > Modifi your admin rank (click on :modify: ) and add this span class in the rank title:

Code:
<span class="st-admin">Rank Title</span>

And hit Save.

Finally, add this on your CSS (ACP > Display > Colors > CSS Stylesheet)

Code:
.topic-author, .st-admin {
    background-color: #FFE346;
}

You can add background-image: url('IMAGE LINK HERE'); or any other option that you want in the special ranks.

If you want a different background for each staff member, only add in the javascript a new class:

Code:
$('st-name').closest('div.topic-author').addClass('st-name');

I hope it helps you ^^
Have a nice day,

Yoshi ~
YoshiGM
YoshiGM
Active Poster

Male Posts : 1492
Reputation : 144
Language : Spanish & English
Location : Mexico

http://asistencia.foroactivo.com/u21373

Back to top Go down

Group post profile bakground Empty Re: Group post profile bakground

Post by Mimóza Sat 2 Jan - 18:03

Thank you, guys! Very Happy
@10spetter10, unfortunately, nothing happened when I added those codes. Smile
@YoshiGM, the codes you have given changed all the members's background to the same. Very Happy Could it be restricted to groups?
Mimóza
Mimóza
Forumember

Female Posts : 676
Reputation : 278
Language : Hungarian, English

https://graphicballoon.forumotion.com/

Back to top Go down

Group post profile bakground Empty Re: Group post profile bakground

Post by Ace 1 Sun 3 Jan - 19:30

I think that would only work if the users are in a group.

My guess is create multiple classes via javascript.

Follow what @YoshiGm said
Ace 1
Ace 1
Helper
Helper

Male Posts : 843
Reputation : 64
Language : English - French?
Location : Druid Hill Park

https://help.forumotion.com

Back to top Go down

Group post profile bakground Empty Re: Group post profile bakground

Post by 10spetter10 Sun 3 Jan - 23:58

Yoshi's code and mine should do actually the same thing. Except the part that in mine is a little error.

quick fix:
Code:
$(function () {
  $('div.author-info').each(function () {
      if($(this).find('img').length) {
        var rank = $(this).find('img').attr('title').toLowerCase();
        var contProfile = $(this).closest('.topic-author');
        contProfile.addClass(rank);
      }
  });
});

My guess for Yoshi's idea is that you have forgotten to update your rank image. Now it is for the admin:
Code:
<img src="http://i1370.photobucket.com/albums/ag257/AppleDrink/administrator.png" alt="Admin" title="Admin">

But you should change it to:
Code:
<img src="http://i1370.photobucket.com/albums/ag257/AppleDrink/administrator.png" alt="Admin" title="Admin" class="st-admin">


Because it search to a class, mine does search to the title.
10spetter10
10spetter10
Forumember

Posts : 195
Reputation : 82
Language : Dutch

Back to top Go down

Group post profile bakground Empty Re: Group post profile bakground

Post by Mimóza Mon 4 Jan - 16:30

Well, yeah... this is were my copypaste-skills fail. I can't make it work! Group post profile bakground 1f605  
And I'm not sure if I want it to work anymore. Thank you so much for your time, anyway! Very Happy 

The topic may be garbaged. Group post profile bakground 1f601
Mimóza
Mimóza
Forumember

Female Posts : 676
Reputation : 278
Language : Hungarian, English

https://graphicballoon.forumotion.com/

Back to top Go down

Group post profile bakground Empty Re: Group post profile bakground

Post by 10spetter10 Mon 4 Jan - 18:20

One last thing before it goes into the garbage.

While I was looking for the code of your hashtag-links I saw that you were trying to make it work, but there was a small mistake in your css.

You used:
Code:
.topic-author, .st-admin {
    background-color: #FFE346;
}

But it should be:
Code:
.topic-author.st-admin {
    background-color: #FFE346;
}

The profile container (topic-author) has both class' so there is no need for a komma. You only use a komma as an 'if' but in this case you need an 'and' (elements with classname 'topic-author' and 'st-admin').
10spetter10
10spetter10
Forumember

Posts : 195
Reputation : 82
Language : Dutch

Back to top Go down

Group post profile bakground Empty Re: Group post profile bakground

Post by Mimóza Mon 4 Jan - 20:15

Geez, I feel so lame! Very Happy I tried again, but it's not working. This feature just wasn't meant for me. Very Happy 
Thank you for all your time, 10spetter10!! You're very caring and helpful! Very Happy
Mimóza
Mimóza
Forumember

Female Posts : 676
Reputation : 278
Language : Hungarian, English

https://graphicballoon.forumotion.com/

Back to top Go down

Back to top

- Similar topics

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