FM Design
Would you like to react to this message? Create an account in a few clicks or log in to continue.

IMPORTANT

FM Design is in read-only mode, please click here for more information.

Latest topics
» Forumactif Edge - Releases
by Ange Tuteur Tue 03 Sep 2019, 11:49

» GIFActif - Giphy Button for the Editor
by Ange Tuteur Wed 08 May 2019, 17:21

» Forum Closure
by Ange Tuteur Mon 01 Jan 2018, 01:28

» Chit Chat Thread
by Valoish Sun 31 Dec 2017, 19:15

» Font/Text background color.
by Valoish Sun 31 Dec 2017, 19:11

» Forumactif Messenger - Instant Message Application for Forumotion
by Wolfuryo Sun 31 Dec 2017, 18:24

» [GAME] Count to One Million!
by brandon_g Fri 29 Dec 2017, 18:58

» Post Cards
by manikbiradar Wed 20 Dec 2017, 07:50

» [GAME] Countdown from 200,000
by Valoish Wed 13 Dec 2017, 23:22

» GeekPolice Tech Support Forums - GeekPolice.net
by Dr Jay Mon 11 Dec 2017, 19:12

» Asking about some plugin for Forumotion
by Dr Jay Mon 11 Dec 2017, 19:10

» [GAME] What are you thinking right now?
by Van-Helsing Sat 09 Dec 2017, 14:51

» Widget : Similar topics
by ranbac Wed 06 Dec 2017, 18:11

» Change the Background of the Forum and put an image and how to make prefixs?
by Clement Wed 06 Dec 2017, 15:19

» Hello from Western Australia
by SarkZKalie Wed 06 Dec 2017, 05:34

Recent Tutorials
Top posting users this month

Who is online?
In total there are 39 users online :: 0 Registered, 0 Hidden and 39 Guests :: 1 Bot

None

[ View the whole list ]


Most users ever online was 515 on Tue 14 Sep 2021, 15:24

Add a classname to group member posts

View previous topic View next topic Go down

Ange Tuteur
Ange Tuteur
Administrator
Gender : Male
Posts : 4741
Points : 12253
Reputation : 2376
Location : Pennsylvania
Language : EN, JA, FR
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
https://sethclydesdale.github.io/ https://twitter.com/sethc1995

PostAnge Tuteur Tue 21 Oct 2014, 18:48

This is a simple script to add a classname to the member of a group. The classname is applied to the parent, so it allows you to style any part of that group's posts.


Adding the JavaScript

Go to Administration Panel > Modules > JavaScript codes management and Create a new script.

Title : Your choice
Placement : In the topics
Paste the code below :
Code:
$(function() {
  groupMod('#C20000', 'adminGroup');
 
  function groupMod(color, classname) {$('.post:has(span[style="color:'+color+'"] strong)').addClass(classname)}
});

Modifications :
To add a classname to a group, write the following function in the script : groupMod('color','classname');

color : Insert the hex color of your group here. You can see the color of the group from the Panel of Administration : Users and Groups > Group Administration > edit
Add a classname to group member posts Screen13

classname : Write here the classname that you want to use, to style that specific group's posts.

Altogether we have :
Code:
groupMod('#C20000', 'adminGroup');

You can copy and paste the function as much as you want to add a class to multiple groups, such as below..
Code:
$(function() {
  groupMod('#C20000', 'adminGroup');
  groupMod('#C2F200', 'modoGroup');
  groupMod('#000000', 'techGroup');
  groupMod('#0000C2', 'specGroup');

  function groupMod(color, classname) {$('.post:has(span[style="color:'+color+'"] strong)').addClass(classname)}
});

Save the script after you're finished with your changes. Smile


Utilizing the classnames

Go to Administration Panel > Display > Colors > CSS stylesheet to write styles for your groups..

Example give the group red font on the entire post :
Code:
.adminGroup .content { color:red }

or change the background of their posts :
Code:
.post.adminGroup { background:#C28888 }

The possibilities are endless .. Explore and be creative ! Wink

If you have any problems you may post below.


Notice
Tutorial written by Ange Tuteur.
Reproduction not permitted without consent from the author.


Last edited by Ange Tuteur on Tue 15 Mar 2016, 06:24; edited 1 time in total
Ch@lo Valdez
Ch@lo Valdez

Gender : Male
Age : 49
Posts : 65
Points : 3897
Reputation : 5
Location : Mexico
Language : eng spa
Browser : Browser : Google Chrome Forum Version : Forum Version : phpBB3

PostCh@lo Valdez Thu 23 Oct 2014, 23:53

thanks Smile so much nice code 
Michael_vx
Michael_vx

Gender : Male
Age : 32
Posts : 302
Points : 4305
Reputation : 76
Language : Arabic
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Other
http://miccsoft.net https://www.facebook.com/Michaelvx2008

PostMichael_vx Sat 25 Oct 2014, 18:13

may i ask for little more Info i still confused about the script`s job :/
thanks again
Ange Tuteur
Ange Tuteur
Administrator
Gender : Male
Posts : 4741
Points : 12253
Reputation : 2376
Location : Pennsylvania
Language : EN, JA, FR
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
https://sethclydesdale.github.io/ https://twitter.com/sethc1995

PostAnge Tuteur Sun 26 Oct 2014, 18:03

Michael_vx wrote:may i ask for little more Info i still confused about the script`s job :/
thanks again
It will added a classname to the posts of group members. For example, I can color the admin posts :
Add a classname to group member posts Captur35
Rhino.Freak
Rhino.Freak

Gender : Male
Age : 28
Posts : 275
Points : 4467
Reputation : 86
Location : India!
Language : English, Hindi
Browser : Browser : Google Chrome Forum Version : Forum Version : phpBB3
http://tokyoghoular.foruns.com.pt/

PostRhino.Freak Mon 27 Oct 2014, 10:44

awesome! Very Happy
Now I get how you put that little 'admin' in your posts Razz SWEET JOB MATE
Michael_vx
Michael_vx

Gender : Male
Age : 32
Posts : 302
Points : 4305
Reputation : 76
Language : Arabic
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Other
http://miccsoft.net https://www.facebook.com/Michaelvx2008

PostMichael_vx Mon 27 Oct 2014, 22:51

Ange Tuteur wrote:
It will added a classname to the posts of group members. For example, I can color the admin posts :
Add a classname to group member posts Captur35
thanks so much now i understand a little and i should read better next time because i use by mistake the javascript as css Very Happy
my 1st time to make mistake like that Very Happy and thanks again for the tip

Ange Tuteur wrote:Utilizing the classnames

Go to Administration Panel > Display > Colors > CSS stylesheet to write styles for your groups..

Example give the group red font on the entire post :
Code:
.adminGroup .content { color:red }
im not sure if this still my mistake or not but this part not working with me can it be that code is the problem
Code:
.postbody{
font-size: 28px;
text-align: center;
font-weight: bold;
line-height: 1.0em;
}
or what ? thanks again for the help
Ch@lo Valdez
Ch@lo Valdez

Gender : Male
Age : 49
Posts : 65
Points : 3897
Reputation : 5
Location : Mexico
Language : eng spa
Browser : Browser : Google Chrome Forum Version : Forum Version : phpBB3

PostCh@lo Valdez Mon 27 Oct 2014, 23:26

try:
Code:
.adminGroup .postbody{
font-size: 28px;
text-align: center;
font-weight: bold;
line-height: 1.0em;
}
Michael_vx
Michael_vx

Gender : Male
Age : 32
Posts : 302
Points : 4305
Reputation : 76
Language : Arabic
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Other
http://miccsoft.net https://www.facebook.com/Michaelvx2008

PostMichael_vx Tue 28 Oct 2014, 00:25

Ch@lo Valdez wrote:try:
Code:
.adminGroup .postbody{
font-size: 28px;
text-align: center;
font-weight: bold;
line-height: 1.0em;
}
please read better
i think we talking here about color
of the font
and i said im use this code in case if there any problems in script coding
Ch@lo Valdez
Ch@lo Valdez

Gender : Male
Age : 49
Posts : 65
Points : 3897
Reputation : 5
Location : Mexico
Language : eng spa
Browser : Browser : Google Chrome Forum Version : Forum Version : phpBB3

PostCh@lo Valdez Tue 28 Oct 2014, 00:28

lol, try using !important
Ange Tuteur
Ange Tuteur
Administrator
Gender : Male
Posts : 4741
Points : 12253
Reputation : 2376
Location : Pennsylvania
Language : EN, JA, FR
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
https://sethclydesdale.github.io/ https://twitter.com/sethc1995

PostAnge Tuteur Tue 28 Oct 2014, 20:49

Try this :
Code:
.groupClass .postbody { color:red !important }

but replace groupClass by the classname for your group.
Michael_vx
Michael_vx

Gender : Male
Age : 32
Posts : 302
Points : 4305
Reputation : 76
Language : Arabic
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Other
http://miccsoft.net https://www.facebook.com/Michaelvx2008

PostMichael_vx Wed 29 Oct 2014, 09:01

the text still wont change Shocked
and i need one more help
i made this
Code:
    .post.adminGroup { background: url(http://i56.servimg.com/u/f56/18/21/60/73/bg_pos11.png) }
its working as a background but i like to have the image to fit the whole post
Stretched image in other word is this possible
Ange Tuteur
Ange Tuteur
Administrator
Gender : Male
Posts : 4741
Points : 12253
Reputation : 2376
Location : Pennsylvania
Language : EN, JA, FR
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
https://sethclydesdale.github.io/ https://twitter.com/sethc1995

PostAnge Tuteur Fri 31 Oct 2014, 22:13

Does this change the text ?
Code:
.adminGroup { color:#F66 }

and for the background, try this :
Code:
.post.adminGroup { background: url(http://i56.servimg.com/u/f56/18/21/60/73/bg_pos11.png) 0 0 / 100% 100% }
Michael_vx
Michael_vx

Gender : Male
Age : 32
Posts : 302
Points : 4305
Reputation : 76
Language : Arabic
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Other
http://miccsoft.net https://www.facebook.com/Michaelvx2008

PostMichael_vx Mon 03 Nov 2014, 05:01

hi i think it was all my mistake i was using the code like that
Code:
/ group mod /
    .post.adminGroup { background: url(http://i56.servimg.com/u/f56/18/21/60/73/bg_pos11.png) 0 0 / 100% 100% }
/ end group mod /

when i removed the tags /*/ and /*/ the code worked

Code:
.adminGroup .postbody{
font-size: 28px;
text-align: center;
font-weight: bold;
line-height: 1.0em;
}

also worked  thanks a lot sorry again
im dumb i guess it was all my mistake
thanks again
Ch@lo Valdez
Ch@lo Valdez

Gender : Male
Age : 49
Posts : 65
Points : 3897
Reputation : 5
Location : Mexico
Language : eng spa
Browser : Browser : Google Chrome Forum Version : Forum Version : phpBB3

PostCh@lo Valdez Mon 03 Nov 2014, 19:14

Rolling Eyes
Michael_vx
Michael_vx

Gender : Male
Age : 32
Posts : 302
Points : 4305
Reputation : 76
Language : Arabic
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Other
http://miccsoft.net https://www.facebook.com/Michaelvx2008

PostMichael_vx Tue 04 Nov 2014, 06:59

the link
https://i.servimg.com/u/f56/18/21/60/73/bg_pos11.png
not working any more in all of sudden any way
im now testing to add Different colors to Different groups like level 1 level 2
when member have posts as level 1 will be in Group 1 and has the group 1 background and font when member get the needed posts to level 2 will be on group 2 and should have the group 2 background and font instead of the group 1 background and font any advice while im trying that to avoid problems and bugs Smile
Ange Tuteur
Ange Tuteur
Administrator
Gender : Male
Posts : 4741
Points : 12253
Reputation : 2376
Location : Pennsylvania
Language : EN, JA, FR
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
https://sethclydesdale.github.io/ https://twitter.com/sethc1995

PostAnge Tuteur Wed 05 Nov 2014, 01:29

Oh if you're adding comments in CSS remember to add the asterisks *
Code:
/* comment */
otherwise you will create an error.

The link is currently working for me. If you're doing it for multiple groups, just make sure that they have different colors and classnames, and you should be good. ^^
Michael_vx
Michael_vx

Gender : Male
Age : 32
Posts : 302
Points : 4305
Reputation : 76
Language : Arabic
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Other
http://miccsoft.net https://www.facebook.com/Michaelvx2008

PostMichael_vx Wed 05 Nov 2014, 09:32

okay i understand if i did not use * will make problems in CSS
thanks a lot
and the image is Weird but not to worry
ill upload a copy to my own image host Very Happy
Ace 1
Ace 1
Valued Member
Gender : Unspecified
Age : 25
Posts : 2153
Points : 5528
Reputation : 95
Location : USA
Language : English ?
Browser : Browser : Google Chrome Forum Version : Forum Version : phpBB3
https://fmdesign.forumotion.com/u190

PostAce 1 Sat 25 Jun 2016, 22:13

How do we change the border color of the post?
Ange Tuteur
Ange Tuteur
Administrator
Gender : Male
Posts : 4741
Points : 12253
Reputation : 2376
Location : Pennsylvania
Language : EN, JA, FR
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
https://sethclydesdale.github.io/ https://twitter.com/sethc1995

PostAnge Tuteur Mon 27 Jun 2016, 11:00

Depending on your classname it'd look something like this :
Code:
.post.adminGroup { border:1px solid #C28888 }
Ace 1
Ace 1
Valued Member
Gender : Unspecified
Age : 25
Posts : 2153
Points : 5528
Reputation : 95
Location : USA
Language : English ?
Browser : Browser : Google Chrome Forum Version : Forum Version : phpBB3
https://fmdesign.forumotion.com/u190

PostAce 1 Tue 28 Jun 2016, 03:46

Wait so this would be the HTML after implementing your script

Code:
<div class="post adminGroup">
Ange Tuteur
Ange Tuteur
Administrator
Gender : Male
Posts : 4741
Points : 12253
Reputation : 2376
Location : Pennsylvania
Language : EN, JA, FR
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
https://sethclydesdale.github.io/ https://twitter.com/sethc1995

PostAnge Tuteur Tue 28 Jun 2016, 09:11

By default posts have the class ".post", all the script I posted does is add a custom class for groups.
Ace 1
Ace 1
Valued Member
Gender : Unspecified
Age : 25
Posts : 2153
Points : 5528
Reputation : 95
Location : USA
Language : English ?
Browser : Browser : Google Chrome Forum Version : Forum Version : phpBB3
https://fmdesign.forumotion.com/u190

PostAce 1 Fri 01 Jul 2016, 06:16

Yeah I just wanted to know what element you were adding the class to lol
Sponsored content

PostSponsored content

View previous topic View next topic Back to top

Create an account or log in to leave a reply

You need to be a member in order to leave a reply.

Create an account

Join our community by creating a new account. It's easy!


Create a new account

Log in

Already have an account? No problem, log in here.


Log in

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