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.

Staff colors without changing them in the editor

+2
Razor12345
eupdorguk
6 posters

Go down

Solved Staff colors without changing them in the editor

Post by eupdorguk Sun Oct 30, 2022 6:36 pm

Technical Details


Forum version : #ModernBB
Position : Founder
Concerned browser(s) : Google Chrome
Who the problem concerns : All members
Forum link : https://community.eupd.org.uk

Description of problem

Hello all,

I was hoping for somewhere you could point me to, possibly a tutorial or somewhere I can learn how to change staff colours, so for example, in a topic message a staff member is a purple colour in their text. I want to do this with code instead of having to do it from the text editor, so the code would automatically change the staffs colours to purple for example.


Last edited by eupdorguk on Mon Oct 31, 2022 11:19 am; edited 1 time in total
eupdorguk
eupdorguk
New Member

Posts : 24
Reputation : 1
Language : English

https://community.eupd.org.uk

Back to top Go down

Solved Re: Staff colors without changing them in the editor

Post by Razor12345 Sun Oct 30, 2022 9:37 pm



Staff colors without changing them in the editor Screen51
Razor12345
Razor12345
Support Moderator
Support Moderator

Male Posts : 1530
Reputation : 264
Language : Ukr, Rus, Eng
Location : Ukraine

Back to top Go down

Solved Re: Staff colors without changing them in the editor

Post by SLGray Sun Oct 30, 2022 9:47 pm

I believe the member means text in messages, not usernames.


Staff colors without changing them in the editor Slgray10

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

Male Posts : 51539
Reputation : 3519
Language : English
Location : United States

https://forumsclub.com/gc/128-link-directory/

Back to top Go down

Solved Re: Staff colors without changing them in the editor

Post by eupdorguk Sun Oct 30, 2022 10:04 pm

SLGray wrote:
I believe the member means text in messages, not usernames.

That is correct, I meant in text messages, without having to keep changing it in the text editor.
eupdorguk
eupdorguk
New Member

Posts : 24
Reputation : 1
Language : English

https://community.eupd.org.uk

Back to top Go down

Solved Re: Staff colors without changing them in the editor

Post by كونان2000 Mon Oct 31, 2022 12:31 am

hi
code java
Placement : In the topics
Code:
(function($) {
    'use strict';
 
    $(function() {
        $('.post-wrap').each(function() {
            var $post = $(this);
          var color = $post.find('[style="color:xxxx"]').css('color');
 
            if (!color.length) return;
            $post
               
                .find('.post-content')
                .css({
                    'color': 'yyyy'
                });
        });
 
    });
})(jQuery);

Replace
Code:
xxxx
with the color of the group
Staff colors without changing them in the editor Ocia_a52

Replace
Code:
yyyy
with the text color you want to be for the group


version AwesomeBB
كونان2000
كونان2000
Forumember

Male Posts : 217
Reputation : 100
Language : Arabic

https://anime.forumperso.com/

TonnyKamper and eupdorguk like this post

Back to top Go down

Solved Re: Staff colors without changing them in the editor

Post by eupdorguk Mon Oct 31, 2022 12:38 am

كونان2000 wrote:hi
code java
Placement : In the topics
Code:
(function($) {
    'use strict';
 
    $(function() {
        $('.post-wrap').each(function() {
            var $post = $(this);
          var color = $post.find('[style="color:xxxx"]').css('color');
 
            if (!color.length) return;
            $post
               
                .find('.post-content')
                .css({
                    'color': 'yyyy'
                });
        });
 
    });
})(jQuery);

Replace
Code:
xxxx
with the color of the group
Staff colors without changing them in the editor Ocia_a52

Replace
Code:
yyyy
with the text color you want to be for the group


version AwesomeBB


Thanks for this, but unfortunately, that did not work. The text color is still the same. Staff colors without changing them in the editor Forums10
Staff colors without changing them in the editor Forums10
eupdorguk
eupdorguk
New Member

Posts : 24
Reputation : 1
Language : English

https://community.eupd.org.uk

Back to top Go down

Solved Re: Staff colors without changing them in the editor

Post by كونان2000 Mon Oct 31, 2022 12:49 am

hi
new java code
I added to it the color of your forum group
https://community.eupd.org.uk/t7-my-introduction

Code:
(function($) {
    'use strict';
 
    $(function() {
        $('.post-wrap').each(function() {
            var $post = $(this);
          var color = $post.find('[style="color:#744DB3"]').css('color');
 
            if (!color.length) return;
            $post
                
                .find('.post-content')
                .css({
                    'color': '#744DB3'
                });
        });
 
    });
})(jQuery);

Check the java settings

Staff colors without changing them in the editor Ocia_a37
Staff colors without changing them in the editor Ocia_010
كونان2000
كونان2000
Forumember

Male Posts : 217
Reputation : 100
Language : Arabic

https://anime.forumperso.com/

eupdorguk likes this post

Back to top Go down

Solved Re: Staff colors without changing them in the editor

Post by eupdorguk Mon Oct 31, 2022 12:51 am

Hi, still didn't unfortunately. Here's the settings. Staff colors without changing them in the editor Settin10

Edit: It's changing everything else, but the text its self in a message.
eupdorguk
eupdorguk
New Member

Posts : 24
Reputation : 1
Language : English

https://community.eupd.org.uk

Back to top Go down

Solved Re: Staff colors without changing them in the editor

Post by كونان2000 Mon Oct 31, 2022 12:55 am

I'm sorry, I made a mistake in editing the code

Try the following new code
Code:
(function($) {
    'use strict';
 
    $(function() {
        $('.post-wrap').each(function() {
            var $post = $(this);
          var color = $post.find('[style="color:#744DB3"]').css('color');
 
            if (!color.length) return;
            $post
               
                .find('.post-content')
                .css({
                    'color': '#744DB3'
                });
        });
 
    });
})(jQuery);
كونان2000
كونان2000
Forumember

Male Posts : 217
Reputation : 100
Language : Arabic

https://anime.forumperso.com/

TonnyKamper likes this post

Back to top Go down

Solved Re: Staff colors without changing them in the editor

Post by eupdorguk Mon Oct 31, 2022 12:57 am

Thank you, how do I do, different colors for different ranks please?

Edit: It seems to be working only on a certain thread, please can you advise on what to do next? Thank you.
eupdorguk
eupdorguk
New Member

Posts : 24
Reputation : 1
Language : English

https://community.eupd.org.uk

Back to top Go down

Solved Re: Staff colors without changing them in the editor

Post by كونان2000 Mon Oct 31, 2022 1:15 am

hi

We'll make a new one, wait for me tomorrow

Very Happy
كونان2000
كونان2000
Forumember

Male Posts : 217
Reputation : 100
Language : Arabic

https://anime.forumperso.com/

Back to top Go down

Solved Re: Staff colors without changing them in the editor

Post by eupdorguk Mon Oct 31, 2022 1:16 am

كونان2000 wrote:hi

We'll make a new one, wait for me tomorrow

Very Happy

As you can see from the tests I have done, it's no longer working for administrators now either, It just seems to be old messages. Thanks!
eupdorguk
eupdorguk
New Member

Posts : 24
Reputation : 1
Language : English

https://community.eupd.org.uk

Back to top Go down

Solved Re: Staff colors without changing them in the editor

Post by كونان2000 Mon Oct 31, 2022 3:22 am

hi @eupdorguk

code java
Placement : In the topics
Code:
$(function() {
var pseudos_couleur = ["xxxx","xxxx"];
var color_texte_admin = "yyyy";
  function estPseudoCouleur(pseudo){
  for(i=0;i<pseudos_couleur.length;i++){   
    if(pseudo == pseudos_couleur[i]){        return true;      }  }  return false;}
$(function() { 
  $("span.post-author-name strong").each(function(){ 
    if(estPseudoCouleur($(this).text())){   
    $(this).parents(".post-body").find(".post-content").css('color',color_texte_admin);
    }  });});
 
  });


$(function() {
var pseudos_couleur = ["xxxx","xxxx"];
var color_texte_admin = "yyyy";
  function estPseudoCouleur(pseudo){
  for(i=0;i<pseudos_couleur.length;i++){   
    if(pseudo == pseudos_couleur[i]){        return true;      }  }  return false;}
$(function() { 
  $("span.post-author-name strong").each(function(){ 
    if(estPseudoCouleur($(this).text())){   
    $(this).parents(".post-body").find(".post-content").css('color',color_texte_admin);
    }  });});
 
  });



$(function() {
var pseudos_couleur = ["xxxx","xxxx"];
  var color_texte_admin = "yyyy";
  function estPseudoCouleur(pseudo){
  for(i=0;i<pseudos_couleur.length;i++){   
    if(pseudo == pseudos_couleur[i]){        return true;      }  }  return false;}
$(function() { 
  $("span.post-author-name strong").each(function(){ 
    if(estPseudoCouleur($(this).text())){   
    $(this).parents(".post-body").find(".post-content").css('color',color_texte_admin);
    }  });});
 
  });



Replace
Code:
xxxx
with usernames

Replace
Code:
yyyy
with the text color you want


Put the text color you want below the usernames
as in the picture
Staff colors without changing them in the editor Ocia_011
كونان2000
كونان2000
Forumember

Male Posts : 217
Reputation : 100
Language : Arabic

https://anime.forumperso.com/

Razor12345 likes this post

Back to top Go down

Solved Re: Staff colors without changing them in the editor

Post by eupdorguk Mon Oct 31, 2022 9:54 am

Unfortunately, these codes did not work.
eupdorguk
eupdorguk
New Member

Posts : 24
Reputation : 1
Language : English

https://community.eupd.org.uk

Back to top Go down

Solved Re: Staff colors without changing them in the editor

Post by tikky Mon Oct 31, 2022 11:02 am

Hello @eupdorguk,

كونان2000 wrote:hi
code java
Placement : In the topics
Code:
(function($) {
    'use strict';
 
    $(function() {
        $('.post-wrap').each(function() {
            var $post = $(this);
          var color = $post.find('[style="color:xxxx"]').css('color');
 
            if (!color.length) return;
            $post
               
                .find('.post-content')
                .css({
                    'color': 'yyyy'
                });
        });
 
    });
})(jQuery);
version AwesomeBB
Remove all scripts and replace by
Code:
(function($) {
    'use strict';
 
    $(function() {
        $('.post-wrap').each(function() {
            var $post = $(this);
          var color = $post.find('.post-author-name [style]').css('color');
 
            if (!color.length) return;
            $post
             
                .find('.post-content')
                .css({
                    'color': color
                });
        });
 
    });
})(jQuery);
tikky
tikky
Forumember

Posts : 898
Reputation : 157
Language : 🇵🇹

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

SarkZKalie, TonnyKamper and Razor12345 like this post

Back to top Go down

Solved Re: Staff colors without changing them in the editor

Post by eupdorguk Mon Oct 31, 2022 11:18 am

You're both genius' thank you so much, this is solved now!
eupdorguk
eupdorguk
New Member

Posts : 24
Reputation : 1
Language : English

https://community.eupd.org.uk

كونان2000 likes this post

Back to top Go down

Solved Re: Staff colors without changing them in the editor

Post by كونان2000 Mon Oct 31, 2022 11:43 am

eupdorguk wrote:Unfortunately, these codes did not work.


a stranger Think

The code works in my test forum
Staff colors without changing them in the editor Ocia_a54
كونان2000
كونان2000
Forumember

Male Posts : 217
Reputation : 100
Language : Arabic

https://anime.forumperso.com/

Back to top Go down

Solved Re: Staff colors without changing them in the editor

Post by skouliki Mon Oct 31, 2022 2:01 pm

topic marked as solved

Problem solved & topic archived.
Please read our forum rules: ESF General Rules
skouliki
skouliki
Manager
Manager

Female Posts : 15256
Reputation : 1701
Language : English,Greek
Location : Greece

http://iconskouliki.forumgreek.com

Back to top Go down

Back to top

- Similar topics

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