Checking auth of poster

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

Re: Checking auth of poster

Post by kinerity » Wed Jul 11, 2018 11:38 pm

3Di wrote:
Wed Jul 11, 2018 10:44 pm
http://prntscr.com/k5dnec
This one.
Kailey Truscott - Community Team

User avatar
RMcGirr83
Recognised Extension Developer
Posts: 20953
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr
Contact:

Re: Checking auth of poster

Post by RMcGirr83 » Thu Jul 12, 2018 12:11 am

IIRC css is loaded prior to anything else. Which could be why it isn't taking effect. Then again I could be wrong.
In times of change, learners inherit the earth, while the learned find themselves beautifully equipped to deal with a world that no longer exists - Eric Hoffer
Former Modifications/Extensions Team Member | My extensions
Appreciate the extensions/mods/support then buy me a beer
All requests for support via PM will be ignored

User avatar
Paul
Infrastructure Team Leader
Infrastructure Team Leader
Posts: 24740
Joined: Sat Dec 04, 2004 3:44 pm
Location: The netherlands.
Name: Paul Sohier
Contact:

Re: Checking auth of poster

Post by Paul » Thu Jul 12, 2018 5:27 am

You can just start a new postrow in your event 😊
Knock knock
Race condition
Who's there?

My BlogMy Photosmy phpBB Extensionscustom phpBB work & Development

User avatar
3Di
Registered User
Posts: 12983
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milan (IT) Frankfurt (DE)
Name: Marco
Contact:

Re: Checking auth of poster

Post by 3Di » Thu Jul 12, 2018 11:38 am

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.
Want to compensate me for my interest? Donate
Please PM me only to request paid works. Thx.
Extensions, Scripts, MOD porting, Update/Upgrades
My development's activity º PhpStorm's proud user

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

Re: Checking auth of poster

Post by kinerity » Thu Jul 12, 2018 5:23 pm

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 Truscott - Community Team

User avatar
3Di
Registered User
Posts: 12983
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milan (IT) Frankfurt (DE)
Name: Marco
Contact:

Re: Checking auth of poster

Post by 3Di » Thu Jul 12, 2018 6:15 pm

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.
Want to compensate me for my interest? Donate
Please PM me only to request paid works. Thx.
Extensions, Scripts, MOD porting, Update/Upgrades
My development's activity º PhpStorm's proud user

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

Re: Checking auth of poster

Post by kinerity » Thu Jul 12, 2018 8:55 pm

I'll GitHub the code later. I already have the listener working fine. It"s just the CSS.
Kailey Truscott - Community Team

User avatar
kasimi
Extension Customisations
Extension Customisations
Posts: 3292
Joined: Sat Sep 10, 2011 7:12 pm
Location: Germany
Contact:

Re: Checking auth of poster

Post by kasimi » Thu Jul 12, 2018 9:15 pm

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
kinerity
Community Team Member
Community Team Member
Posts: 1942
Joined: Mon Sep 01, 2014 1:00 am
Location: sudo rm -rf /
Name: Kailey Truscott
Contact:

Re: Checking auth of poster

Post by kinerity » Fri Jul 13, 2018 1:21 am

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 Truscott - Community Team

Post Reply

Return to “Extension Writers Discussion”

Who is online

Users browsing this forum: No registered users and 7 guests