Checking auth of poster

Discussion forum for Extension Writers regarding Extension Development.
User avatar
Kailey
Community Team Leader
Community Team Leader
Posts: 3738
Joined: Mon Sep 01, 2014 1:00 am
Location: sudo rm -rf /
Name: Kailey Snay
Contact:

Re: Checking auth of poster

Post by Kailey »

3Di wrote: Wed Jul 11, 2018 10:44 pm http://prntscr.com/k5dnec
This one.
Kailey Snay - Community Team Leader
Knowledge Base | Documentation | Community rules

If you have any questions about the rules/customs of this website, feel free to send me a PM.
My little corner of the world, where I sometimes post things documented from my job.
User avatar
RMcGirr83
Former Team Member
Posts: 22016
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: Checking auth of poster

Post by RMcGirr83 »

IIRC css is loaded prior to anything else. Which could be why it isn't taking effect. Then again I could be wrong.
Former Modifications/Extensions Team Member | My extensions | github | All requests for support via PM will be ignored
Appreciate the extensions/mods/support then buy me a beer Image
Paul
Infrastructure Team Leader
Infrastructure Team Leader
Posts: 28654
Joined: Sat Dec 04, 2004 3:44 pm
Location: The netherlands.
Name: Paul Sohier
Contact:

Re: Checking auth of poster

Post by Paul »

You can just start a new postrow in your event 😊
User avatar
3Di
I've Been Banned!
Posts: 17538
Joined: Mon Apr 04, 2005 11:09 pm
Location: I'm with Ukraine 🇺🇦
Name: Marco
Contact:

Re: Checking auth of poster

Post by 3Di »

kinerity wrote: Wed Jul 11, 2018 11:38 pm
3Di wrote: Wed Jul 11, 2018 10:44 pm http://prntscr.com/k5dnec
This one.
That's done just adding border-right to the existing .post CSS class of prosilver FYI.

Code: Select all

.post {
	border-right: 5px solid #bc092f; /* your group color */
}
I am working on a similar stuff onto one of our projects in these days. I will chime on this again in case.
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Buy me a coffee -> Image
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
User avatar
Kailey
Community Team Leader
Community Team Leader
Posts: 3738
Joined: Mon Sep 01, 2014 1:00 am
Location: sudo rm -rf /
Name: Kailey Snay
Contact:

Re: Checking auth of poster

Post by Kailey »

3Di wrote: Thu Jul 12, 2018 11:38 am

Code: Select all

.post {
	border-right: 5px solid #bc092f; /* your group color */
}
I forgot about editing the post class, so thank you for that. However, the group color is dynamic for each post (pulled from a DB query in my listener), hence why I'm trying other routes.
Kailey Snay - Community Team Leader
Knowledge Base | Documentation | Community rules

If you have any questions about the rules/customs of this website, feel free to send me a PM.
My little corner of the world, where I sometimes post things documented from my job.
User avatar
3Di
I've Been Banned!
Posts: 17538
Joined: Mon Apr 04, 2005 11:09 pm
Location: I'm with Ukraine 🇺🇦
Name: Marco
Contact:

Re: Checking auth of poster

Post by 3Di »

kinerity wrote: Thu Jul 12, 2018 5:23 pm the group color is dynamic for each post (pulled from a DB query in my listener),
The group color of the poster is the group colour, usually.
Paul wrote: Thu Jul 12, 2018 5:27 am You can just start a new postrow in your event 😊
Listener:

Code: Select all

	/**
	 * Modify the posts template block
	 *
	 * @event core.viewtopic_modify_post_row
	 */
	public function viewtopic_modify_post_row($event)
	{
		$group_colour = (!empty($event['user_poster_data']['user_colour'])) ? $event['user_poster_data']['user_colour'] : '');

		$event['post_row'] = array_merge($event['post_row'], ['GROUP_COLOR' => $group_colour]);
	}
Now you can use the dynamic variable which has the user group's colour and do your CSS magic somehow.

{{ postrow.GROUP_COLOR }}

You may need to also use, in combo, the event core.viewtopic_cache_user_data (have a look at those extension as of above)

That's on the fly and not throughly tested.
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Buy me a coffee -> Image
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
User avatar
Kailey
Community Team Leader
Community Team Leader
Posts: 3738
Joined: Mon Sep 01, 2014 1:00 am
Location: sudo rm -rf /
Name: Kailey Snay
Contact:

Re: Checking auth of poster

Post by Kailey »

I'll GitHub the code later. I already have the listener working fine. It"s just the CSS.
Kailey Snay - Community Team Leader
Knowledge Base | Documentation | Community rules

If you have any questions about the rules/customs of this website, feel free to send me a PM.
My little corner of the world, where I sometimes post things documented from my job.
User avatar
kasimi
Former Team Member
Posts: 4900
Joined: Sat Sep 10, 2011 7:12 pm
Location: Germany
Contact:

Re: Checking auth of poster

Post by kasimi »

As Paul suggested, you need to loop over the postrows again:

Code: Select all

<style>
{% for postrow in loops.postrow %}
    {# CSS for each post here #}
{% endfor %}
</style>
Though not for posts, I'm doing something similar here: https://github.com/kasimi/phpbb-ext-mch ... after.html
User avatar
Kailey
Community Team Leader
Community Team Leader
Posts: 3738
Joined: Mon Sep 01, 2014 1:00 am
Location: sudo rm -rf /
Name: Kailey Snay
Contact:

Re: Checking auth of poster

Post by Kailey »

That actually helps immensely! I'll give that a try, thanks.

Edit: Progress! This works, but it's grabbing the postrow GROUP COLOR for the last poster that is true and adding it for ever post (even ones where s_in_group is false).

Code: Select all

<style>
{% for postrow in loops.postrow %}
	{% if postrow.S_IN_GROUP %}
		.post {
			border-right: 5px solid {{ postrow.GROUP_COLOR }};
		}
	{% endif %}
{% endfor %}
</style>
Edit 2: Got it! I added the div's id. Thanks to everyone who helped! Hopefully this helps someone else.

Code: Select all

<style>
{% for postrow in loops.postrow %}
	{% if postrow.S_IN_GROUP %}
		div#p{{ postrow.POST_ID }}.post {
			border-right: 5px solid {{ postrow.GROUP_COLOR }};
		}
	{% endif %}
{% endfor %}
</style>
Kailey Snay - Community Team Leader
Knowledge Base | Documentation | Community rules

If you have any questions about the rules/customs of this website, feel free to send me a PM.
My little corner of the world, where I sometimes post things documented from my job.
Post Reply

Return to “Extension Writers Discussion”