[BETA] [3.2] Prime Notify

A place for Extension Authors to post and receive feedback on Extensions still in development. No Extensions within this forum should be used within a live environment!
Scam Warning
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: Extensions Development rules

IMPORTANT FOR NEEDED EVENTS!!!
If you need an event for your extension please read this for the steps to follow to request the event(s)
Komanche
Registered User
Posts: 255
Joined: Thu Aug 02, 2007 10:49 am
Location: Czech Republic

Re: [BETA] [3.2] Prime Notify

Post by Komanche »

3.2.5 on PHP 5.4.38 works like a charm...
koraldon
Registered User
Posts: 530
Joined: Sat Jun 30, 2007 12:42 pm

Re: [BETA] [3.2] Prime Notify

Post by koraldon »

3.2.5 using php 7.0.32 working great
Also I saw that phpbb 3.2.5 added list unsubscribe header - does it also added to prime notify?
fagbutlil
I've Been Banned!
Posts: 77
Joined: Wed Mar 07, 2018 10:56 pm

Re: [BETA] [3.2] Prime Notify

Post by fagbutlil »

3.2.5 and PHP version: 7.2.10 all good.
User avatar
horseguards
Registered User
Posts: 95
Joined: Sun Oct 26, 2008 12:18 pm
Location: Mar del Plata [Argentina]
Name: P C

Re: [BETA] [3.2] Prime Notify

Post by horseguards »

Great News!

I just tried Prime Notify on my phpBB 3.2.3 with PHP 7.2.14 and works fine. :D
Not so lucky with PrimeLinks, yet.

Thanks a lot!
CarolC1
Registered User
Posts: 653
Joined: Sat Dec 02, 2006 4:26 pm

Re: [BETA] [3.2] Prime Notify

Post by CarolC1 »

primehalo wrote: Wed Jan 02, 2019 10:02 pm
CarolC1 wrote: Tue Jan 01, 2019 2:02 am Thank you so much for making this. We've had this on 3.0 and 3.1, and this new 3.2 version installed on the 3.2.5 test board is working great. :D

I would really like to be able to use the new User's Choice options, which are a really nice feature, but is there a way to make our installation default to 'No' in the ucp when Always Notify is set on User's Choice in the acp? Personally, I plan to opt for 'Yes' in my settings, but I don't know if everybody would.

Thanks again! :D
That is set in the migrations/version_100.php file:

Code: Select all

	public function update_schema()
	{
		return array(
			'add_columns'	=> array(
				USERS_TABLE	=> array(
					'user_primenotify_enable_post'	=> array('BOOL', true),
					'user_primenotify_enable_pm'	=> array('BOOL', true),
					'user_primenotify_keep_bbcodes'	=> array('BOOL', true),
					'user_primenotify_always_send'	=> array('BOOL', true),
				),
			),
		
You can change user_primenotify_always_send to false before installing.
I'm getting an error trying to do this. I did it twice just to be sure. I was already running the ext so I disabled it, deleted the data, and deleted it out of the files. Then I downloaded a fresh zip file and edited migrations/version_100.php as you said (I hope),

Code: Select all

public function update_schema()
	{
		return array(
			'add_columns'	=> array(
				USERS_TABLE	=> array(
					'user_primenotify_enable_post'	=> array('BOOL', true),
					'user_primenotify_enable_pm'	=> array('BOOL', true),
					'user_primenotify_keep_bbcodes'	=> array('BOOL', true),
					'user_primenotify_always_send'	=> array('BOOL', false),
				),
			),
		);
	}
and uploaded the ext again. When I click to enable it, this is what it says. I'm thinking maybe I should just leave it alone, it is working a treat without this migrations/version_100.php edit. :)

Code: Select all

General Error
SQL ERROR [ mysql4 ]

Invalid default value for 'user_primenotify_always_send' [1067]

SQL

ALTER TABLE `****_users` ADD COLUMN `user_primenotify_always_send` tinyint(1) UNSIGNED DEFAULT '' NOT NULL

BACKTRACE

FILE: (not given by php)
LINE: (not given by php)
CALL: msg_handler()

FILE: [ROOT]/phpbb/db/driver/driver.php
LINE: 997
CALL: trigger_error()

FILE: [ROOT]/phpbb/db/driver/mysql.php
LINE: 191
CALL: phpbb\db\driver\driver->sql_error()

FILE: [ROOT]/phpbb/db/tools/tools.php
LINE: 1064
CALL: phpbb\db\driver\mysql->sql_query()

FILE: [ROOT]/phpbb/db/tools/tools.php
LINE: 1272
CALL: phpbb\db\tools\tools->_sql_run_sql()

FILE: [ROOT]/phpbb/db/tools/tools.php
LINE: 549
CALL: phpbb\db\tools\tools->sql_column_add()

FILE: (not given by php)
LINE: (not given by php)
CALL: phpbb\db\tools\tools->perform_schema_changes()

FILE: [ROOT]/phpbb/db/migrator.php
LINE: 714
CALL: call_user_func_array()

FILE: [ROOT]/phpbb/db/migrator.php
LINE: 661
CALL: phpbb\db\migrator->run_step()

FILE: [ROOT]/phpbb/db/migrator.php
LINE: 400
CALL: phpbb\db\migrator->process_data_step()

FILE: [ROOT]/phpbb/db/migrator.php
LINE: 288
CALL: phpbb\db\migrator->try_apply()

FILE: [ROOT]/phpbb/db/migrator.php
LINE: 241
CALL: phpbb\db\migrator->update_do()

FILE: [ROOT]/phpbb/extension/base.php
LINE: 78
CALL: phpbb\db\migrator->update()

FILE: [ROOT]/ext/primehalo/primenotify/ext.php
LINE: 83
CALL: phpbb\extension\base->enable_step()

FILE: [ROOT]/phpbb/extension/manager.php
LINE: 190
CALL: primehalo\primenotify\ext->enable_step()

FILE: [ROOT]/includes/acp/acp_extensions.php
LINE: 213
CALL: phpbb\extension\manager->enable_step()

FILE: [ROOT]/includes/functions_module.php
LINE: 676
CALL: acp_extensions->main()

FILE: [ROOT]/adm/index.php
LINE: 82
CALL: p_master->load_active()
User avatar
primehalo
Former Team Member
Posts: 2988
Joined: Fri May 06, 2005 5:58 pm
Location: Redding, CA
Contact:

Re: [BETA] [3.2] Prime Notify

Post by primehalo »

Your change looks correct to me. For some reason the boolean false value is being changed to the empty string (UNSIGNED DEFAULT '') instead of a zero (UNSIGNED DEFAULT 0). I have no idea why that would be happening.
Ken F. Innes IV
My Extensions | My MODs | My Topics | My Site: Absolute Anime
Experience the wonder of Japanese Animation!
CarolC1
Registered User
Posts: 653
Joined: Sat Dec 02, 2006 4:26 pm

Re: [BETA] [3.2] Prime Notify

Post by CarolC1 »

I'm sorry for the delay. It won't matter, we're happy with it the way it is. :D Many thanks!
whocarez
Registered User
Posts: 160
Joined: Sat Apr 18, 2009 9:19 pm
Contact:

Re: [BETA] [3.2] Prime Notify

Post by whocarez »

Hello,
I think, that I found a small bug in notifications with unicode symbols/smilies.

Code: Select all

SQL ERROR [ mysqli ]

Incorrect string value: '\xF0\x9F\xA4\x94\xF0\x9F...' for column `forum`.`phpbb_notifications`.`notification_data` at row 1 [1366]

SQL

INSERT INTO phpbb_notifications (item_id, notification_type_id, item_parent_id, notification_time, notification_read, notification_data, user_id) VALUES (138452, 37, 98789, 1553423894, 0, 'a:7:{s:17:\"prime_notify_text\";s:432:\"\n removed  🤔🤗😂 removed \";s:9:\"poster_id\";i:53;s:11:\"topic_title\";s:56:\" removed \";s:12:\"post_subject\";s:60:\"Re: removed \";s:13:\"post_username\";s:0:\"\";s:8:\"forum_id\";i:23;s:10:\"forum_name\";s:7:\" removed \";}', 2043)

BACKTRACE

FILE: (not given by php)
LINE: (not given by php)
CALL: msg_handler()

FILE: [ROOT]/phpbb/db/driver/driver.php
LINE: 994
CALL: trigger_error()

FILE: [ROOT]/phpbb/db/driver/mysqli.php
LINE: 193
CALL: phpbb\db\driver\driver->sql_error()

FILE: [ROOT]/phpbb/db/driver/driver.php
LINE: 656
CALL: phpbb\db\driver\mysqli->sql_query()

FILE: [ROOT]/phpbb/db/driver/factory.php
LINE: 377
CALL: phpbb\db\driver\driver->sql_multi_insert()

FILE: [ROOT]/phpbb/db/sql_insert_buffer.php
LINE: 138
CALL: phpbb\db\driver\factory->sql_multi_insert()

FILE: [ROOT]/phpbb/notification/method/board.php
LINE: 276
CALL: phpbb\db\sql_insert_buffer->flush()

FILE: [ROOT]/phpbb/notification/manager.php
LINE: 383
CALL: phpbb\notification\method\board->notify()

FILE: [ROOT]/phpbb/notification/manager.php
LINE: 295
CALL: phpbb\notification\manager->add_notifications_for_users()

FILE: [ROOT]/phpbb/notification/manager.php
LINE: 266
CALL: phpbb\notification\manager->add_notifications()

FILE: [ROOT]/includes/functions_posting.php
LINE: 2324
CALL: phpbb\notification\manager->add_notifications()

FILE: [ROOT]/posting.php
LINE: 1457
CALL: submit_post()
phpbb_notifications is utf8_bin
PHPBB 3.2.5 running with
PHP 7.2.16-1+0~20190307202206.17+jessie~1.gbpa7be82
and
MySQL(i) 10.2.22-MariaDB-10.2.22+maria~jessie-log
User avatar
primehalo
Former Team Member
Posts: 2988
Joined: Fri May 06, 2005 5:58 pm
Location: Redding, CA
Contact:

Re: [BETA] [3.2] Prime Notify

Post by primehalo »

I can replicate and confirm. This seems to happen only with 4-byte UTF-8 characters as apparently utf8_bin cannot hold 4-byte characters. To hold these characters in the post_text column of the post table, there is some kind of conversion going on beforehand which chances them to something else, like <r><EMOJI seq="1f914">&#129300;</EMOJI></r>. I'm not exactly sure what code is used to do this conversion so I'll have to look into it more, unless someone already familiar with this can clue me in, which would be awesome....
Ken F. Innes IV
My Extensions | My MODs | My Topics | My Site: Absolute Anime
Experience the wonder of Japanese Animation!
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: [BETA] [3.2] Prime Notify

Post by 3Di »

primehalo wrote: Fri Mar 29, 2019 11:46 pm unless someone already familiar with this can clue me in, which would be awesome.
Those are Emojis.
viewtopic.php?f=461&t=2422576

To strip those instead

Code: Select all

	/**
	 * Strip emojis from a string
	 * 	 
	 * @param string $string The UTF8 string to be cleared
	 * @return string
	 * @access public	 
	 */
	public function vendor_ext_strip_emojis($string)
	{
		return preg_replace('/[\x{10000}-\x{10FFFF}]/u', "", $string);
	}
🆓 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
primehalo
Former Team Member
Posts: 2988
Joined: Fri May 06, 2005 5:58 pm
Location: Redding, CA
Contact:

Re: [BETA] [3.2] Prime Notify

Post by primehalo »

That would remove them completely, or replace them with a specified replacement character, but the board converts them into a format like <r><EMOJI seq="1f914">&#129300;</EMOJI></r> before storing them into the database. Do you know what bit of code does that?
Ken F. Innes IV
My Extensions | My MODs | My Topics | My Site: Absolute Anime
Experience the wonder of Japanese Animation!
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: [BETA] [3.2] Prime Notify

Post by 3Di »

By the s9e/text-formatter.

The issue here is the DB - The notifications table like many others (ie. logs etc), do not accept 4-bytes unicode chars.
https://area51.phpbb.com/phpBB/viewtopi ... te#p257203

That's why the above proposed method it's used in many extensions.

In the core code used to show to the user the list of chars not allowed:
https://github.com/phpbb/phpbb/blob/e38 ... .php#L1164

Edit:
I happened to discover a bug recently, I created this PR that uses the same pattern to deal with it: https://github.com/phpbb/phpbb/pull/5556
🆓 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
primehalo
Former Team Member
Posts: 2988
Joined: Fri May 06, 2005 5:58 pm
Location: Redding, CA
Contact:

Re: [BETA] [3.2] Prime Notify

Post by primehalo »

I posted an updated version, 1.0.0 Beta 11, with a fix. Unfortunately the fix just replaces 4-byte characters with a 3-byte character instead of encoding it into something else that can be stored in the database and then decoding it when extracting from the database, so 4-byte emoji characters won't show up in the email.
Ken F. Innes IV
My Extensions | My MODs | My Topics | My Site: Absolute Anime
Experience the wonder of Japanese Animation!
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: [BETA] [3.2] Prime Notify

Post by 3Di »

primehalo wrote: Sat Jan 19, 2019 1:35 am Your change looks correct to me. For some reason the boolean false value is being changed to the empty string (UNSIGNED DEFAULT '') instead of a zero (UNSIGNED DEFAULT 0). I have no idea why that would be happening.
Because here they have to be all "casted to INT".

Code: Select all

'user_primenotify_enable_post'	=> array('BOOL', true),
'user_primenotify_enable_pm'	=> array('BOOL', true),
'user_primenotify_keep_bbcodes'	=> array('BOOL', true),
'user_primenotify_always_send'	=> array('BOOL', true),
Like 'user_primenotify_*' => array('BOOL', 1),

Or 0 if false.
🆓 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
daCaPo
Registered User
Posts: 3
Joined: Thu Nov 15, 2018 9:37 am

Re: [BETA] [3.2] Prime Notify

Post by daCaPo »

I just have been informed by one of our users that despite his permission/group membership for a certain forum has been revoked, he still receives update notifications. Is it intended behaviour that the extension does not check user permissions before sending out notifications, or did I miss to configure something?
Post Reply

Return to “Extensions in Development”