Geting user_id in event viewtopic_cache_user_data

Discussion forum for Extension Writers regarding Extension Development.
Post Reply
User avatar
Acuru
Registered User
Posts: 7
Joined: Mon Oct 01, 2018 3:52 pm
Contact:

Geting user_id in event viewtopic_cache_user_data

Post by Acuru » Sun Oct 06, 2019 6:03 pm

So i have, event subscribed to viewtopic_cache_user_data:

Code: Select all

	static public function getSubscribedEvents()
	{
		return array(
			'core.viewtopic_cache_user_data'		=> 'gkp_aura_post',
		);
}
And function that is fired with that event:

Code: Select all

	public function gkp_aura_post($poster_id, $row, $user_cache_data) 
	{
		echo '<script>console.log("GKP: go?");</script>';
	}
And so far it's going well. I got one instance for each user that posted in topic, which is perfect for me.

But! Im trying to use arguments of that function, and for whatever i tried it ends with 500 error. I need to get id of user that are posted in topic, so i can do some stuff with them. How i can get users id in my function?

I got arguments list from: https://wiki.phpbb.com/Event_List#core. ... _user_data

User avatar
david63
Registered User
Posts: 16540
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Name: David Wood
Contact:

Re: Geting user_id in event viewtopic_cache_user_data

Post by david63 » Sun Oct 06, 2019 8:18 pm

Code: Select all

public function gkp_aura_post($event) 
	{
		$poster_id = $event['poster_id'];
		
		some code...
	}
Should do it
David
Remember: You only know what you know and - you don't know what you don't know!
My CDB Contributions | How to install an extension
I will not be accepting translations for any of my extensions in Github - please post any translations in the appropriate topic.
No support requests via PM or email as they will be ignored

User avatar
Acuru
Registered User
Posts: 7
Joined: Mon Oct 01, 2018 3:52 pm
Contact:

Re: Geting user_id in event viewtopic_cache_user_data

Post by Acuru » Mon Oct 07, 2019 5:12 pm

Working like a charm. Thank You <3

Post Reply

Return to “Extension Writers Discussion”