The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

Change the background based on the group of the poster

View previous topic View next topic Go down

Solved Change the background based on the group of the poster

Post by O'Malley Cat on June 21st 2017, 6:35 pm

I was reading this article, and I was curious if this could be based on rank/group instead of gender?

For example, if I have a group called "Purple," I was wondering if it was possible if the post background of the user in that group to be purple? And so on with other groups. Just an example.


Last edited by O'Malley Cat on June 27th 2017, 6:55 am; edited 1 time in total
avatar
O'Malley Cat
New Member

Posts : 19
Reputation : 1
Language : Spanish, English

Back to top Go down

Solved Re: Change the background based on the group of the poster

Post by Kami-sama on June 21st 2017, 7:04 pm

I am interested in this as well Smile
I have a button to apply the background to the post.
Would be nice to have it applied automatically by users group.
avatar
Kami-sama
Forumember

Female Posts : 317
Reputation : 7
Language : English, Russian, German, Lithuanian
Location : Lithuania

http://hogas.huhohi.com/

Back to top Go down

Solved Re: Change the background based on the group of the poster

Post by Justice™ on June 21st 2017, 7:25 pm

Hello,

It is possible Smile. I need your forum's version and link.
avatar
Justice™
Forumember

Posts : 520
Reputation : 120
Language : Romanian and English

http://board.realmsn.com

Back to top Go down

Solved Re: Change the background based on the group of the poster

Post by O'Malley Cat on June 21st 2017, 9:58 pm

@Kami-sama - I've always wanted to know how to add buttons to the editor!

@Wolfuryo - Here is the link: http://begin-your-roots.forumotion.com/
I think its Phpbb3 (or however it's wrote Very Happy )

avatar
O'Malley Cat
New Member

Posts : 19
Reputation : 1
Language : Spanish, English

Back to top Go down

Solved Re: Change the background based on the group of the poster

Post by Kami-sama on June 21st 2017, 10:43 pm

Here is how I added buttons:http://help.forumotion.com/t146075-message-background
avatar
Kami-sama
Forumember

Female Posts : 317
Reputation : 7
Language : English, Russian, German, Lithuanian
Location : Lithuania

http://hogas.huhohi.com/

Back to top Go down

Solved Re: Change the background based on the group of the poster

Post by O'Malley Cat on June 22nd 2017, 5:04 am

Thank you Kami-sama!

Wolf, there is the information. If you need a test account, I'll send you credentials. Just let me know
avatar
O'Malley Cat
New Member

Posts : 19
Reputation : 1
Language : Spanish, English

Back to top Go down

Solved Re: Change the background based on the group of the poster

Post by Justice™ on June 22nd 2017, 7:24 am

Hello,

Add this code as a js with placement on topics:
Code:
window.bkg={};
bkg.copyright="Code by Wolfuryo. Use at your own risk. You can modify it, but this notice must remain here. Use my code without this notice and you'll be destroyed :D";
bkg.init=function(){
if(!/t\d+\-/.test(location.pathname)) return;
bkg.len=$(".postprofile>dl>dt>strong>a>span[style]").length;
bkg.db();
};
bkg.db=function(){
var i=0;
for(i;i<bkg.len;i++){
$(".postprofile>dl>dt>strong>a>span[style]").eq(i).parent().parent().parent().parent().parent().parent().parent().css("background", $(".postprofile>dl>dt>strong>a>span[style]").eq(i).css("color"))
};
};
$(function(){
bkg.init();
})

This will only work for members being in a group. Might not work on other forums(the selector are different).
avatar
Justice™
Forumember

Posts : 520
Reputation : 120
Language : Romanian and English

http://board.realmsn.com

Back to top Go down

Solved Re: Change the background based on the group of the poster

Post by O'Malley Cat on June 22nd 2017, 9:53 am

Hi, @Wolfuryo !

The code works like a dream! However, is there a way to change the opacity?
Otherwise, this is 100% perfect! I can't thank you enough Very Happy
avatar
O'Malley Cat
New Member

Posts : 19
Reputation : 1
Language : Spanish, English

Back to top Go down

Solved Re: Change the background based on the group of the poster

Post by Justice™ on June 22nd 2017, 10:41 am

Hi,

You mean the opacity of the posts, right? If so, replace that code with this one:
Code:
window.bkg={};
bkg.copyright="Code by Wolfuryo. Use at your own risk. You can modify it, but this notice must remain here. Use my code without this notice and you'll be destroyed :D";
bkg.opacity="1.0";
bkg.init=function(){
if(!/t\d+\-/.test(location.pathname)) return;
bkg.len=$(".postprofile>dl>dt>strong>a>span[style]").length;
bkg.db();
};
bkg.db=function(){
var i=0;
for(i;i<bkg.len;i++){  $(".postprofile>dl>dt>strong>a>span[style]").eq(i).parent().parent().parent().parent().parent().parent().parent().css({
"background":$(".postprofile>dl>dt>strong>a>span[style]").eq(i).css("color"),
"opacity":bkg.opacity
});
};
};
$(function(){
bkg.init();
})

In the 4-th line of the code, modify 1.0 to whatever value you want the opacity to have. Note that the value can be from 0 to 1(0.1, 0.2, 0.54543543).
avatar
Justice™
Forumember

Posts : 520
Reputation : 120
Language : Romanian and English

http://board.realmsn.com

Back to top Go down

Solved Re: Change the background based on the group of the poster

Post by Kami-sama on June 22nd 2017, 12:54 pm

How will this respond if a user belongs to multiple groups? Like Admins and mods.
avatar
Kami-sama
Forumember

Female Posts : 317
Reputation : 7
Language : English, Russian, German, Lithuanian
Location : Lithuania

http://hogas.huhohi.com/

Back to top Go down

Solved Re: Change the background based on the group of the poster

Post by Justice™ on June 22nd 2017, 2:20 pm

The code gets the color for the background of the posts from the color of the username. It should work even if the users belong to multiple groups.
avatar
Justice™
Forumember

Posts : 520
Reputation : 120
Language : Romanian and English

http://board.realmsn.com

Back to top Go down

Solved Re: Change the background based on the group of the poster

Post by Kami-sama on June 22nd 2017, 6:37 pm

How this code should be changed for Phpbb2?
Now it does not seam to respond. But maybe because I have some other styles on my posts....
avatar
Kami-sama
Forumember

Female Posts : 317
Reputation : 7
Language : English, Russian, German, Lithuanian
Location : Lithuania

http://hogas.huhohi.com/

Back to top Go down

Solved Re: Change the background based on the group of the poster

Post by O'Malley Cat on June 22nd 2017, 10:58 pm

@Wolfuryo ,

Is there a way for the script to be able to overlap my current code:
Code:
.post { background-image: url('http://q.likesuccess.com/89/4405295-beautiful-green-forest.jpg'); background-repeat: repeat;}

So have the colored BG, but have it "mask" the image? That way the opacity can be decreased and reveal the image beneath it?
avatar
O'Malley Cat
New Member

Posts : 19
Reputation : 1
Language : Spanish, English

Back to top Go down

Solved Re: Change the background based on the group of the poster

Post by Justice™ on June 23rd 2017, 8:08 am

Yes, that is possible. I'm a Little bussy now, but I'll see what I can do later.
avatar
Justice™
Forumember

Posts : 520
Reputation : 120
Language : Romanian and English

http://board.realmsn.com

Back to top Go down

Solved Re: Change the background based on the group of the poster

Post by O'Malley Cat on June 24th 2017, 7:33 am

Any word on this?
avatar
O'Malley Cat
New Member

Posts : 19
Reputation : 1
Language : Spanish, English

Back to top Go down

Solved Re: Change the background based on the group of the poster

Post by Ace 1 on June 24th 2017, 7:38 am

@O'Malley Cat

Line 12 of Wolf's script: "background" >> "background-color"

what it will look like:
Code:
window.bkg={};
bkg.copyright="Code by Wolfuryo. Use at your own risk. You can modify it, but this notice must remain here. Use my code without this notice and you'll be destroyed :D";
bkg.opacity="1.0";
bkg.init=function(){
if(!/t\d+\-/.test(location.pathname)) return;
bkg.len=$(".postprofile>dl>dt>strong>a>span[style]").length;
bkg.db();
};
bkg.db=function(){
var i=0;
for(i;i<bkg.len;i++){  $(".postprofile>dl>dt>strong>a>span[style]").eq(i).parent().parent().parent().parent().parent().parent().parent().css({
"background-color":$(".postprofile>dl>dt>strong>a>span[style]").eq(i).css("color"),
"opacity":bkg.opacity
});
};
};
$(function(){
bkg.init();
})
avatar
Ace 1
Helper
Helper

Male Posts : 826
Reputation : 62
Language : English - French?
Location : Druid Hill Park

http://help.forumotion.com

Back to top Go down

Solved Re: Change the background based on the group of the poster

Post by O'Malley Cat on June 24th 2017, 8:28 am

@Ace 1

That didn't work :/
The background and colors are all the same now.
Image Example:
avatar
O'Malley Cat
New Member

Posts : 19
Reputation : 1
Language : Spanish, English

Back to top Go down

Solved Re: Change the background based on the group of the poster

Post by O'Malley Cat on June 25th 2017, 10:40 pm

I'm gonna give this a friendly bump! Smile
avatar
O'Malley Cat
New Member

Posts : 19
Reputation : 1
Language : Spanish, English

Back to top Go down

Solved Re: Change the background based on the group of the poster

Post by Justice™ on June 26th 2017, 7:15 pm

Hi,

Sorry for the delay, I've been quite busy lately. The script should do the job:
Code:
window.bkg={};
bkg.copyright="Code by Wolfuryo. Use at your own risk. You can modify it, but this notice must remain here. Use my code without this notice and you'll be destroyed :D";
bkg.opacity="0.7";
bkg.init=function(){
if(!/t\d+\-/.test(location.pathname)) return;
bkg.len=$(".postprofile>dl>dt>strong>a>span[style]").length;
bkg.db();
};
bkg.db=function(){
var i=0;
for(i;i<bkg.len;i++){  $(".postprofile>dl>dt>strong>a>span[style]").eq(i).parent().parent().parent().parent().parent().parent().css({
"background":$(".postprofile>dl>dt>strong>a>span[style]").eq(i).css("color"),
"opacity":bkg.opacity
});
};
};
$(function(){
bkg.init();
})
The opacity has to be less than 1.0(for example you can set it to 0.Cool for the background under to be shown.
avatar
Justice™
Forumember

Posts : 520
Reputation : 120
Language : Romanian and English

http://board.realmsn.com

Back to top Go down

Solved Re: Change the background based on the group of the poster

Post by O'Malley Cat on June 27th 2017, 6:54 am

Thank is perfect. Thank you, Wolf!

This is solved, thanks again!
avatar
O'Malley Cat
New Member

Posts : 19
Reputation : 1
Language : Spanish, English

Back to top Go down

Solved Re: Change the background based on the group of the poster

Post by Draxion on June 27th 2017, 8:18 am

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


NEVER provide your founder's account or email
Please provide forum's URL when dealing with design and appearance issues
Don't forget to mark the topic as when the issue is resolved. This helps the staff greatly.
PM Support is prohibited!
TOS | General Rules | FAQ | Tricks & Tips | Latest Updates | Introduce Yourself

avatar
Draxion
Support Moderator
Support Moderator

Male Posts : 1834
Reputation : 230
Language : English
Location : USA

http://www.draxionsgameden.com/

Back to top Go down

View previous topic View next topic Back to top


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