Add function especially for moderators

Need some custom code changes to the phpBB core simple enough that you feel doesn't require an extension? Then post your request here so that community members can provide some assistance.

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
totallybeautiful
Registered User
Posts: 48
Joined: Tue Mar 13, 2018 4:24 pm

Add function especially for moderators

Post by totallybeautiful » Tue Jul 10, 2018 1:32 pm

Hello, I need a little help.

Since I do not have sufficient knowledge of PHP, it is quite difficult for me to implement what I want.



I want moderators to be able to post their posts in two background colors.

In phpbb there is always a postbackground defined. With my style, it's white by default.

But I want the moderators to be able to post with a red background. The red background should only appear if the moderators select it before posting.
Last edited by kinerity on Tue Jul 10, 2018 10:46 pm, edited 1 time in total.

User avatar
Brf
Support Team Member
Support Team Member
Posts: 51168
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: Add function especially for moderators

Post by Brf » Tue Jul 10, 2018 1:39 pm

If you are asking for an extension, you should be posting in the Extensions Request forum.

User avatar
Ger
Recognised Extension Developer
Posts: 1544
Joined: Wed Jan 02, 2008 7:35 pm
Location: 192.168.1.100
Contact:

Re: Add function especially for moderators

Post by Ger » Tue Jul 10, 2018 1:42 pm

Aren't you essentially looking for something like a ModBreak?
E.g. a way to let moderators post a message that stands out from the others?
My extensions: Simple CMS, Feed post bot, Avatar Resize, Modbreak, Magic OGP, Live topic update and Modern Quote
Newest: Quoted Where + anonymize

Like my work? Buy me a coffee to keep it coming. :ugeek:
-Available for custom work-

totallybeautiful
Registered User
Posts: 48
Joined: Tue Mar 13, 2018 4:24 pm

Re: Add function especially for moderators

Post by totallybeautiful » Tue Jul 10, 2018 6:58 pm

No, this should not be an extension request, because I would like to make this change to the code to be able to reintroduce it at any time and not run the risk of an extension being set.



I don't know the modbreak from the look.

I would like to be able to change exactly the background after selection, if a moderator must give an instruction.

It's not just about the purpose, it's also about that exact look.

User avatar
Brf
Support Team Member
Support Team Member
Posts: 51168
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: Add function especially for moderators

Post by Brf » Tue Jul 10, 2018 7:35 pm

In that case, you should be posting in Custom Coding.

totallybeautiful
Registered User
Posts: 48
Joined: Tue Mar 13, 2018 4:24 pm

Re: Add function especially for moderators

Post by totallybeautiful » Tue Jul 10, 2018 8:00 pm

Could you postpone it there?

User avatar
AmigoJack
Registered User
Posts: 5236
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: Add function especially for moderators

Post by AmigoJack » Wed Jul 11, 2018 7:38 am

totallybeautiful wrote:
Tue Jul 10, 2018 1:32 pm
I want moderators to be able to post their posts in two background colors.
Sounds more like you want 2 modes, not colors. You want them being able to choose between "moderator background" and "default background", not colors which they can freely choose. Or not?

totallybeautiful wrote:
Tue Jul 10, 2018 1:32 pm
In phpbb there is always a postbackground defined. With my style, it's white by default.
If you look more closely you might notice that every odd post has a different background, so effectively a default style already comes with 2 background colors.

totallybeautiful wrote:
Tue Jul 10, 2018 1:32 pm
The red background should only appear if the moderators select it before posting.
Are you sure you want it this restrictive? The choice is permanent and should not be available when editing a post?
The worst thing about censorship is ███████████

User avatar
Ger
Recognised Extension Developer
Posts: 1544
Joined: Wed Jan 02, 2008 7:35 pm
Location: 192.168.1.100
Contact:

Re: Add function especially for moderators

Post by Ger » Wed Jul 11, 2018 8:14 am

totallybeautiful wrote:
Tue Jul 10, 2018 6:58 pm
No, this should not be an extension request, because I would like to make this change to the code to be able to reintroduce it at any time and not run the risk of an extension being set.
You could do this as a MOD, but you will be overcomplicating stuff and need to check with each and every minor update. A simple extension (such as ModBreak) would probably work without any further work until the end of life of phpBB 3.2 (and probably 3.3 and above as well).

It's up to you, but extensions were invented for the sole purpose to reduce maintenance for administrators.
totallybeautiful wrote:
Tue Jul 10, 2018 6:58 pm
I don't know the modbreak from the look.

I would like to be able to change exactly the background after selection, if a moderator must give an instruction.

It's not just about the purpose, it's also about that exact look.
You could still use it. Just add this litte JS snippet in your footer, just before </body>:

Code: Select all

<script>
$('.post').has('.bbc_mod_text').css('background', '#E2C8D3');
</script>
(change color at will)

And if you want to hide the actual modbreak block, just add this snippet to your stylesheet:

Code: Select all

.bbc_mod_head, .bbc_mod_text {
    display: none;
}
This way your moderators can use the modbreak BBcode at will in a post while others can't. If used, the background color gets overwritten by the given color in the JS snippet.
My extensions: Simple CMS, Feed post bot, Avatar Resize, Modbreak, Magic OGP, Live topic update and Modern Quote
Newest: Quoted Where + anonymize

Like my work? Buy me a coffee to keep it coming. :ugeek:
-Available for custom work-

User avatar
kinerity
Community Team Member
Community Team Member
Posts: 1671
Joined: Mon Sep 01, 2014 1:00 am
Location: sudo rm -rf /
Name: Kailey Truscott
Contact:

Re: Add function especially for moderators

Post by kinerity » Wed Jul 11, 2018 11:30 am

Like this?

post.png
post.png (8.03 KiB) Viewed 234 times
Kailey Truscott - Community Team

totallybeautiful
Registered User
Posts: 48
Joined: Tue Mar 13, 2018 4:24 pm

Re: Add function especially for moderators

Post by totallybeautiful » Wed Jul 11, 2018 12:53 pm

Ger wrote:
Wed Jul 11, 2018 8:14 am
You could do this as a MOD, but you will be overcomplicating stuff and need to check with each and every minor update. A simple extension (such as ModBreak) would probably work without any further work until the end of life of phpBB 3.2 (and probably 3.3 and above as well).
If someone wants to do an extension now, it wouldn't be wrong, but a few months ago my question only remained a question, which is why I don't want to give up realizing it anyway.

I already had the ModBreak as an alternative, but it was still my wish to do it the way I actually wanted.
Ger wrote:
Wed Jul 11, 2018 8:14 am
This way your moderators can use the modbreak BBcode at will in a post while others can't. If used, the background color gets overwritten by the given color in the JS snippet.
I already have a BBCode in use, it also creates a red box, but that's not what I want. I want to change the background color of the entire post. Example will follow soon.
kinerity wrote:
Wed Jul 11, 2018 11:30 am
Like this?
No, not like this.
I'll show my example now, even if the forum software is different, but that doesn't matter.

Example:
Attachments
IMG_20180711_145033.png
This is a mobile View. The Moderator Carietta gives an Instruction. The complette Post is red. The function for this post is selectable.

User avatar
Ger
Recognised Extension Developer
Posts: 1544
Joined: Wed Jan 02, 2008 7:35 pm
Location: 192.168.1.100
Contact:

Re: Add function especially for moderators

Post by Ger » Wed Jul 11, 2018 1:01 pm

Well than, by all means use the JS and CSS snippet from my example.

Or a tad changed CSS to fit your needs:

Code: Select all

p.bbc_mod_head {
    display: none;
}
.bbc_mod_text {
    border: 0;
    width: inherit;
    margin: 0;
    padding: 0;
}
Result:
Screenshot_2018-07-11 anotherone - Page 2 - yourdomain com.png
Of course you can change colours and styling at will.
My extensions: Simple CMS, Feed post bot, Avatar Resize, Modbreak, Magic OGP, Live topic update and Modern Quote
Newest: Quoted Where + anonymize

Like my work? Buy me a coffee to keep it coming. :ugeek:
-Available for custom work-

totallybeautiful
Registered User
Posts: 48
Joined: Tue Mar 13, 2018 4:24 pm

Re: Add function especially for moderators

Post by totallybeautiful » Wed Jul 11, 2018 1:10 pm

@Ger

You are amazing.

So I need to install the modbreak and then customize the script? Okay.

Which files exactly need to be edited now?

User avatar
Ger
Recognised Extension Developer
Posts: 1544
Joined: Wed Jan 02, 2008 7:35 pm
Location: 192.168.1.100
Contact:

Re: Add function especially for moderators

Post by Ger » Wed Jul 11, 2018 1:20 pm

Install ModBreak as usual.

Open up ./ext/ger/modbreak/styles/all/theme/modbreak.css
Add CSS at the bottom:

Code: Select all

p.bbc_mod_head {
    display: none;
}
.bbc_mod_text {
    border: 0;
    width: inherit;
    margin: 0;
    padding: 0;
}
Open up ./styles/yourstyle/template/overall_footer.html
Look for

Code: Select all

</body>
Place JS right above that line:

Code: Select all

<script>
$('.post').has('.bbc_mod_text').css('background', '#E2C8D3');
</script>
You can change the color code at will to better match your style


Upload files and clear cache.
My extensions: Simple CMS, Feed post bot, Avatar Resize, Modbreak, Magic OGP, Live topic update and Modern Quote
Newest: Quoted Where + anonymize

Like my work? Buy me a coffee to keep it coming. :ugeek:
-Available for custom work-

totallybeautiful
Registered User
Posts: 48
Joined: Tue Mar 13, 2018 4:24 pm

Re: Add function especially for moderators

Post by totallybeautiful » Wed Jul 11, 2018 1:53 pm

Thank you so much, Ger.

That's really great.

:mrgreen:

User avatar
Ger
Recognised Extension Developer
Posts: 1544
Joined: Wed Jan 02, 2008 7:35 pm
Location: 192.168.1.100
Contact:

Re: Add function especially for moderators

Post by Ger » Wed Jul 11, 2018 2:17 pm

You're welcome :)
My extensions: Simple CMS, Feed post bot, Avatar Resize, Modbreak, Magic OGP, Live topic update and Modern Quote
Newest: Quoted Where + anonymize

Like my work? Buy me a coffee to keep it coming. :ugeek:
-Available for custom work-

Post Reply

Return to “phpBB Custom Coding”

Who is online

Users browsing this forum: No registered users and 8 guests