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.

Add a color + image to a specific group at the top of posts without JavaScript

+3
tikky
YoshiGM
كونان2000
7 posters

Go down

Add a color + image to a specific group at the top of posts without JavaScript Empty Add a color + image to a specific group at the top of posts without JavaScript

Post by كونان2000 April 11th 2024, 12:17 am

Hello everyone

With this trick, you can add a color to a specific group that appears at the top of posts
and You can also add photos to a specific group,

I know it's a common trick, but it was using JavaScript

Now you don't need to use JavaScript-jQuery

A trick I discovered that I wanted to share with you Bingo

Add a color + image to a specific group at the top of posts without JavaScript Ocia_a12
----------------------------------------------




phpBB2:



All versions
-------------

Find the next part in viewtopic_body template
Code:
<!-- BEGIN displayed -->

replace it with
Code:
 
<!-- BEGIN displayed -->
<div class="conan2000-flower">{postrow.displayed.POSTER_NAME}</div>


Save and publish Add a color + image to a specific group at the top of posts without JavaScript 644535217

Installing the CSS
Go to Administration Panel > Display > Colors > CSS stylesheet and paste the following rules in your stylesheet.
Code:
.conan2000-flower [style="color:؟؟؟؟؟"] {
pointer-events: none;
    cursor: default;
    color: #0000 !important;
    display: block;
    background: ؟؟؟؟؟;
}
 
.conan2000-flower,.conan2000-flower strong {
  pointer-events: none;
    cursor: default;
    color: #0000 !important;
}
.conan2000-flower {
  pointer-events: none;
    background: #bcc2c7;
  color: #0000 !important;
}
Replace question marks in CSS code with group color (HEX color OR color name i.e : red)


Add a color + image to a specific group at the top of posts without JavaScript Ocia_a14

CSS: An image of a specific group
Code:
.conan2000-flower [style="color:?????"] strong {
    background: url(https://i.servimg.com/u/f73/11/60/75/36/admini10.png) no-repeat;
}
Replace question marks in CSS code with group color


Add a color + image to a specific group at the top of posts without JavaScript Admini10 Add a color + image to a specific group at the top of posts without JavaScript Helper10 Add a color + image to a specific group at the top of posts without JavaScript Top10




Last edited by كونان2000 on September 17th 2024, 5:34 am; edited 2 times in total
كونان2000
كونان2000
Forumember

Male Posts : 284
Reputation : 120
Language : Arabic

https://anime.forumperso.com/

skouliki, YoshiGM, SarkZKalie, TonnyKamper, poesia-verses and Wizzard like this post

Back to top Go down

Add a color + image to a specific group at the top of posts without JavaScript Empty Re: Add a color + image to a specific group at the top of posts without JavaScript

Post by YoshiGM April 11th 2024, 4:21 pm

Hmm interesting.. We can save some loading resources using a simple template edit instead of a JS.

Good job :p
YoshiGM
YoshiGM
Active Poster

Male Posts : 1562
Reputation : 146
Language : Spanish & English
Location : Mexico

http://asistencia.foroactivo.com/u21373

Back to top Go down

Add a color + image to a specific group at the top of posts without JavaScript Empty Re: Add a color + image to a specific group at the top of posts without JavaScript

Post by tikky April 11th 2024, 6:46 pm

better is use the group as a reference (demo) but it's a good trick
tikky
tikky
Forumember

Posts : 922
Reputation : 160
Language : 🇵🇹

https://www.forumotion.com/create-forum/modernbb

Back to top Go down

Add a color + image to a specific group at the top of posts without JavaScript Empty Re: Add a color + image to a specific group at the top of posts without JavaScript

Post by كونان2000 April 11th 2024, 11:55 pm

Thanks @YoshiGM and @tikky ^^

tikky wrote:better is use the group as a reference (demo) but it's a good trick
Oh I didn't know about it before but Glasses
The trick is in my first post
It is easy to modify and does not require expert programmers
It works on all versions the same way
lol!






كونان2000
كونان2000
Forumember

Male Posts : 284
Reputation : 120
Language : Arabic

https://anime.forumperso.com/

Back to top Go down

Add a color + image to a specific group at the top of posts without JavaScript Empty Re: Add a color + image to a specific group at the top of posts without JavaScript

Post by Mihai April 26th 2024, 3:11 am

كونان2000 wrote:
Hello everyone

With this trick, you can add a color to a specific group that appears at the top of posts
and You can also add photos to a specific group,

I know it's a common trick, but it was using JavaScript

Now you don't need to use JavaScript-jQuery

A trick I discovered that I wanted to share with you Bingo

Add a color + image to a specific group at the top of posts without JavaScript Ocia_a12
----------------------------------------------




phpBB2:



All versions
-------------

Find the next part in viewtopic_body template
Code:
<!-- BEGIN displayed -->

replace it with
Code:
 
<!-- BEGIN displayed -->
<div class="conan2000-flower">{postrow.displayed.POSTER_NAME}</div>


Save and publish Add a color + image to a specific group at the top of posts without JavaScript 644535217

Installing the CSS
Go to Administration Panel > Display > Colors > CSS stylesheet and paste the following rules in your stylesheet.
Code:
* {
    text-decoration: none;
}

.conan2000-flower [style="color:?????"] {
    cursor: default;
    color: #0000 !important;
    display: block;
    background: ?????;
}

.conan2000-flower,.conan2000-flower strong {
    cursor: default;
    color: #0000 !important;
}
.conan2000-flower {
    background: #bcc2c7;
}
Replace question marks in CSS code with group color (HEX color OR color name i.e : red)


Add a color + image to a specific group at the top of posts without JavaScript Ocia_a14

CSS: An image of a specific group
Code:
.conan2000-flower [style="color:?????"] strong {
    background: url(https://i.servimg.com/u/f73/11/60/75/36/admini10.png) no-repeat;
}
Replace question marks in CSS code with group color


Add a color + image to a specific group at the top of posts without JavaScript Admini10 Add a color + image to a specific group at the top of posts without JavaScript Helper10 Add a color + image to a specific group at the top of posts without JavaScript Top10


_____________________________________________________________________
banana

Hello,

my suggestion is to make that color for each group for ModernBB and AwesomeBB for the header, where the title is included for the topic creations - and when someone replys (from the staff ofc, to show the color also... and so on!) - and for members to show default color...
Mihai
Mihai
Forumember

Male Posts : 961
Reputation : 39
Language : Romanian, English
Location : Bucharest, Romania

https://fgsuport.forumotion.com/

كونان2000 likes this post

Back to top Go down

Add a color + image to a specific group at the top of posts without JavaScript Empty Re: Add a color + image to a specific group at the top of posts without JavaScript

Post by كونان2000 April 27th 2024, 1:01 am

hi @Mihai
ok Dawa
: AwesomeBB:
كونان2000
كونان2000
Forumember

Male Posts : 284
Reputation : 120
Language : Arabic

https://anime.forumperso.com/

TonnyKamper likes this post

Back to top Go down

Add a color + image to a specific group at the top of posts without JavaScript Empty Re: Add a color + image to a specific group at the top of posts without JavaScript

Post by Mihai April 27th 2024, 3:15 am

كونان2000 wrote:hi @Mihai
ok Dawa
: AwesomeBB:
can you send an screenshot please? Also the tag </span-div> is totally wrong!
Mihai
Mihai
Forumember

Male Posts : 961
Reputation : 39
Language : Romanian, English
Location : Bucharest, Romania

https://fgsuport.forumotion.com/

Back to top Go down

Add a color + image to a specific group at the top of posts without JavaScript Empty Re: Add a color + image to a specific group at the top of posts without JavaScript

Post by كونان2000 April 27th 2024, 4:37 am

كونان2000
كونان2000
Forumember

Male Posts : 284
Reputation : 120
Language : Arabic

https://anime.forumperso.com/

Back to top Go down

Add a color + image to a specific group at the top of posts without JavaScript Empty Re: Add a color + image to a specific group at the top of posts without JavaScript

Post by Beyonder April 29th 2024, 10:45 am

Interesting!
Beyonder
Beyonder
Forumember

Male Posts : 726
Reputation : 29
Language : English
Location : Beyond Realm

http://fictionalomniverse.forumotion.com/

Back to top Go down

Add a color + image to a specific group at the top of posts without JavaScript Empty Re: Add a color + image to a specific group at the top of posts without JavaScript

Post by كونان2000 April 30th 2024, 1:06 am

Thanks @Beyonder ^^
كونان2000
كونان2000
Forumember

Male Posts : 284
Reputation : 120
Language : Arabic

https://anime.forumperso.com/

Back to top Go down

Add a color + image to a specific group at the top of posts without JavaScript Empty Re: Add a color + image to a specific group at the top of posts without JavaScript

Post by Joost August 29th 2024, 5:22 pm

@كونان2000 ,

For the PhpBB2 version, on my forum have i a problem to add the CSS for multiple group colors i can set only one color for all posts. Smile
Joost
Joost
Active Poster

Male Posts : 1408
Reputation : 194
Language : Dutch, English
Location : The Netherlands

https://ondersteun.actieforum.com/

TonnyKamper likes this post

Back to top Go down

Add a color + image to a specific group at the top of posts without JavaScript Empty Re: Add a color + image to a specific group at the top of posts without JavaScript

Post by YoshiGM August 29th 2024, 5:39 pm

I'm testing this in my forum (phpBB3 version) and the username for normal users appears repeated in the background:

Add a color + image to a specific group at the top of posts without JavaScript Image653
YoshiGM
YoshiGM
Active Poster

Male Posts : 1562
Reputation : 146
Language : Spanish & English
Location : Mexico

http://asistencia.foroactivo.com/u21373

Back to top Go down

Add a color + image to a specific group at the top of posts without JavaScript Empty Re: Add a color + image to a specific group at the top of posts without JavaScript

Post by كونان2000 August 29th 2024, 7:22 pm

Welcome @Joost @YoshiGM

Are you sure you did all the steps correctly?

phpBB3
Add a color + image to a specific group at the top of posts without JavaScript Png-tr10

PhpBB2
Add a color + image to a specific group at the top of posts without JavaScript Png-tr11
كونان2000
كونان2000
Forumember

Male Posts : 284
Reputation : 120
Language : Arabic

https://anime.forumperso.com/

Back to top Go down

Add a color + image to a specific group at the top of posts without JavaScript Empty Re: Add a color + image to a specific group at the top of posts without JavaScript

Post by Joost August 29th 2024, 8:04 pm

كونان2000 wrote:Welcome @Joost @YoshiGM

Are you sure you did all the steps correctly?

Yes, i have followed all the steps. guitar
Joost
Joost
Active Poster

Male Posts : 1408
Reputation : 194
Language : Dutch, English
Location : The Netherlands

https://ondersteun.actieforum.com/

TonnyKamper likes this post

Back to top Go down

Add a color + image to a specific group at the top of posts without JavaScript Empty Re: Add a color + image to a specific group at the top of posts without JavaScript

Post by كونان2000 August 29th 2024, 9:17 pm

hi

If you want more than one color, you have to repeat the code and put the new group color in the code.

Code:
.conan2000-flower [style="color:؟؟؟؟؟"] {
pointer-events: none;
    cursor: default;
    color: #0000 !important;
    display: block;
    background: ؟؟؟؟؟;
}
Add a color + image to a specific group at the top of posts without JavaScript Ocia_a26
كونان2000
كونان2000
Forumember

Male Posts : 284
Reputation : 120
Language : Arabic

https://anime.forumperso.com/

Joost likes this post

Back to top Go down

Add a color + image to a specific group at the top of posts without JavaScript Empty Re: Add a color + image to a specific group at the top of posts without JavaScript

Post by Joost August 30th 2024, 5:21 pm

I don't know what happened, it works now. Smile
Joost
Joost
Active Poster

Male Posts : 1408
Reputation : 194
Language : Dutch, English
Location : The Netherlands

https://ondersteun.actieforum.com/

TonnyKamper likes this post

Back to top Go down

Add a color + image to a specific group at the top of posts without JavaScript Empty Re: Add a color + image to a specific group at the top of posts without JavaScript

Post by كونان2000 August 31st 2024, 1:26 am

Great, it's good that things are going well now
Dawa
كونان2000
كونان2000
Forumember

Male Posts : 284
Reputation : 120
Language : Arabic

https://anime.forumperso.com/

Back to top Go down

Add a color + image to a specific group at the top of posts without JavaScript Empty Re: Add a color + image to a specific group at the top of posts without JavaScript

Post by Shek August 31st 2024, 2:35 am

Nice idea! With script this is possible also:
Code:
$(document).ready(function() {
    var vf_vs = _userdata["tpl_used"];var isso;var cor;var post_ = $('.post,.post-wrap');
   var classes = {
        'subsilver': 'tr.post .name strong a[href^="/u"] span',
        'prosilver': 'div.postprofile a[href^="/u"] span',
        'invision': '.postprofile-details a[href^="/u"] span',
        'punbb': 'div.user h4.username a[href^="/u"] span',
        'modernbb': 'div.postprofile-name a[href^="/u"] span',
        'awesomebb': '.post-body .post-author a[href^="/u"] span'
    };
    if(classes.hasOwnProperty(vf_vs)) {
      var selector = classes[vf_vs];
      post_.each(function() {
         isso = $(this);
         cor = isso.find(selector).attr('style').replace('color:', '');
         isso.find('div.post-head,div.post,tr.post').css('border-top', '5px solid ' + cor).addClass('st-rank');
      });
    } else {console.error('template no found on "classes". You use ' + vf_vs + ' version.');}
});
CSS:
Code:
.st-rank[style] {
    background-image: url(https://i.servimg.com/u/f21/16/89/96/68/chrome10.png);
    background-repeat: no-repeat;
    background-position: right 50%;
}
@كونان2000, you can suggest this on script also, please?
Shek
Shek
Active Poster

Male Posts : 1697
Reputation : 61
Language :  
Location : Brazil

https://publipos.net

Back to top Go down

Add a color + image to a specific group at the top of posts without JavaScript Empty Re: Add a color + image to a specific group at the top of posts without JavaScript

Post by كونان2000 August 31st 2024, 7:54 am

Shek wrote:@كونان2000, you can suggest this on script also, please?
hi @Shek
I did not understand your request, mwii
do you explain to me what you mean more?
كونان2000
كونان2000
Forumember

Male Posts : 284
Reputation : 120
Language : Arabic

https://anime.forumperso.com/

Back to top Go down

Add a color + image to a specific group at the top of posts without JavaScript Empty Re: Add a color + image to a specific group at the top of posts without JavaScript

Post by YoshiGM September 2nd 2024, 5:20 pm

Hello @كونان2000 , yes i checked twice the codes.

Even i changed the name of the div and the username still repeats in the bar

Add a color + image to a specific group at the top of posts without JavaScript Image98
YoshiGM
YoshiGM
Active Poster

Male Posts : 1562
Reputation : 146
Language : Spanish & English
Location : Mexico

http://asistencia.foroactivo.com/u21373

Back to top Go down

Add a color + image to a specific group at the top of posts without JavaScript Empty Re: Add a color + image to a specific group at the top of posts without JavaScript

Post by كونان2000 September 2nd 2024, 6:31 pm

hi @YoshiGM
It seems to me that your CSS codes are different
Here https://www.yoshifansclub.com/t25909-anunciado-un-nintendo-direct-partnershowcase-indie-world-para-el-27-08-24#229908

For this you have to add the code as follows:
Code:
.bak-st-yfc, .bak-st-yfc strong {
    pointer-events: none;
    cursor: default;
    color: #0000 !important;
}
كونان2000
كونان2000
Forumember

Male Posts : 284
Reputation : 120
Language : Arabic

https://anime.forumperso.com/

Back to top Go down

Add a color + image to a specific group at the top of posts without JavaScript Empty Re: Add a color + image to a specific group at the top of posts without JavaScript

Post by YoshiGM September 2nd 2024, 6:36 pm

Hmm not worked, sorry :/

If you pass your cursor in my profile and select the exact point of the username appears as i've showed before

Also, the code for a strange reason ignores the background of the staff bar :S
YoshiGM
YoshiGM
Active Poster

Male Posts : 1562
Reputation : 146
Language : Spanish & English
Location : Mexico

http://asistencia.foroactivo.com/u21373

Back to top Go down

Add a color + image to a specific group at the top of posts without JavaScript Empty Re: Add a color + image to a specific group at the top of posts without JavaScript

Post by كونان2000 September 2nd 2024, 6:50 pm

If you pass your cursor in my profile and select the exact point of the username appears as i've showed before
You can delete names using the following code:
Code:
.bak-st-yfc, .bak-st-yfc strong {
    pointer-events: none;
    cursor: default;
    color: #0000 !important;
    font-size: 0;
    padding: 8px;
}

Also, the code for a strange reason ignores the background of the staff bar :S
If you want more than one color, you have to repeat the code and put the new group color in the code.
Add a color + image to a specific group at the top of posts without JavaScript Ocia_a26
كونان2000
كونان2000
Forumember

Male Posts : 284
Reputation : 120
Language : Arabic

https://anime.forumperso.com/

Back to top Go down

Add a color + image to a specific group at the top of posts without JavaScript Empty Re: Add a color + image to a specific group at the top of posts without JavaScript

Post by YoshiGM September 2nd 2024, 8:22 pm

Ok for the repeated usernames in the bar. Add a color + image to a specific group at the top of posts without JavaScript 2705

But the CSS is not adding the staff color that i have in group.

Add a color + image to a specific group at the top of posts without JavaScript Image100

I'm doing anything wrong?
YoshiGM
YoshiGM
Active Poster

Male Posts : 1562
Reputation : 146
Language : Spanish & English
Location : Mexico

http://asistencia.foroactivo.com/u21373

Back to top Go down

Add a color + image to a specific group at the top of posts without JavaScript Empty Re: Add a color + image to a specific group at the top of posts without JavaScript

Post by كونان2000 September 2nd 2024, 9:33 pm

Yes because you changed the codes
You need a method that suits your forum

previous code
Code:
.bak-st-yfc, .bak-st-yfc strong {
    pointer-events: none;
    cursor: default;
    color: #0000 !important;
    font-size: 0;
    padding: 8px;
}

replace
Code:
padding: 8px;

Replace it with
Code:
height: 15px;


In the following way, set the color of the groups:
Code:
.bak-st-yfc [style="color:#04B50F"] {
    height: 15px;
pointer-events: none;
    cursor: default;
    color: #0000 !important;
    display: block;
    background: #04B50F;
}
كونان2000
كونان2000
Forumember

Male Posts : 284
Reputation : 120
Language : Arabic

https://anime.forumperso.com/

YoshiGM and TonnyKamper like this post

Back to top Go down

Add a color + image to a specific group at the top of posts without JavaScript Empty Re: Add a color + image to a specific group at the top of posts without JavaScript

Post by YoshiGM September 3rd 2024, 1:29 am

Alright!
Now works perfectly!

Thank you Very Happy
YoshiGM
YoshiGM
Active Poster

Male Posts : 1562
Reputation : 146
Language : Spanish & English
Location : Mexico

http://asistencia.foroactivo.com/u21373

كونان2000 likes this post

Back to top Go down

Add a color + image to a specific group at the top of posts without JavaScript Empty Re: Add a color + image to a specific group at the top of posts without JavaScript

Post by كونان2000 September 3rd 2024, 8:45 am

YoshiGM wrote:Alright!
Now works perfectly!

Thank you Very Happy
You're welcome! I'm glad to hear everything is working well. Shake
كونان2000
كونان2000
Forumember

Male Posts : 284
Reputation : 120
Language : Arabic

https://anime.forumperso.com/

Back to top Go down

Back to top

- Similar topics

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