How to debug a notification?

Discussion forum for Extension Writers regarding Extension Development.
Post Reply
User avatar
Zukero
Registered User
Posts: 49
Joined: Fri Oct 16, 2015 9:19 am
Contact:

How to debug a notification?

Post by Zukero » Wed Jan 03, 2018 3:30 pm

Hello,

I'm writing an extension (extra BBCode) for phpBB 3.2 which should create notifications in a very similar fashion to how the "quote" tag behaves.

I have set the lines @define('DEBUG', true); and @define('DEBUG_CONTAINER', true); in config.php.
I added some print_r statements to my extension's notification class, mainly in the find_users_for_notification function, but cannot see any output.

My notification type appears in the DB and in the notification settings of the UCP.

When is the notification class code executed?
Should I be seeing some things on the page reached after submitting a post?

My php days are old (back in the php 4.X days), and I'm new to phpBB extension development, so any help in getting some arbitrary text to be printed on a phpBB page for debug purposes would also help.

User avatar
posey
Registered User
Posts: 706
Joined: Tue Oct 06, 2009 7:34 pm
Location: The Netherlands
Name: Gijs

Re: How to debug a notification?

Post by posey » Thu Jan 04, 2018 1:20 pm

The code is executed when the notification gets 'triggered', so when the notification has to be send out.
The point is, a notification doesn't really output a page. So there is no place for the code to 'print_r' to, as far as I recall.
''I'm pretty sure there's a lot more to life than being really, really, ridiculously good looking. And I plan on finding out what that is.''

User avatar
david63
Jr. Extension Validator
Posts: 14575
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Name: David Wood
Contact:

Re: How to debug a notification?

Post by david63 » Thu Jan 04, 2018 1:32 pm

Never tried it myself but you could try writing your debug data to the log file.
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
Zukero
Registered User
Posts: 49
Joined: Fri Oct 16, 2015 9:19 am
Contact:

Re: How to debug a notification?

Post by Zukero » Thu Jan 04, 2018 2:44 pm

OK. Maybe that's why my notifications don't work. How do you define what should trigger it?

User avatar
posey
Registered User
Posts: 706
Joined: Tue Oct 06, 2009 7:34 pm
Location: The Netherlands
Name: Gijs

Re: How to debug a notification?

Post by posey » Thu Jan 04, 2018 3:07 pm

That's completely up to you, when you want the notification to be send..
When someone watches a post, replies, sends a PM, etc... That's what you determine.

For example, the Board Rules extension by phpBB:
https://github.com/phpbb-extensions/boa ... r.php#L631

Or have a look at the Knowledge Base extension by Kinerity:
https://github.com/kinerity/knowledgeba ... r.php#L353
When an article gets approved etc, there is a notification send.

phpBB3.2.x Documentation on Notifications:
https://area51.phpbb.com/docs/dev/3.2.x ... ifications
''I'm pretty sure there's a lot more to life than being really, really, ridiculously good looking. And I plan on finding out what that is.''

User avatar
pierredu
Registered User
Posts: 853
Joined: Thu Nov 01, 2012 8:04 am
Location: Paris (France)

Re: How to debug a notification?

Post by pierredu » Thu Jan 04, 2018 3:20 pm

For this kind of situation, I write a string or even an array with a timestamp in a debug table.

User avatar
Zukero
Registered User
Posts: 49
Joined: Fri Oct 16, 2015 9:19 am
Contact:

Re: How to debug a notification?

Post by Zukero » Sat Jan 06, 2018 12:06 pm

Thanks posey, I managed to get it to work.

Post Reply

Return to “Extension Writers Discussion”

Who is online

Users browsing this forum: alex75 and 10 guests