[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)
User avatar
primehalo
Former Team Member
Posts: 2816
Joined: Fri May 06, 2005 5:58 pm
Location: Redding, CA
Contact:

Re: [BETA] [3.2] Prime Notify

Post by primehalo » Sat Oct 06, 2018 12:02 am

In the extension's folder, edit the ext.php file and go to the very bottom where it says:

Code: Select all

		// Change user's original notifications to ours
		$data = array('item_type' => $enable);
		$sql = 'UPDATE ' . USER_NOTIFICATIONS_TABLE . ' SET ' . $this->db->sql_build_array('UPDATE', $data) .
				 " WHERE item_type = '{$disable}' AND method = 'notification.method.email'";
		$this->db->sql_query($sql);
Comment out those lines, like so:

Code: Select all

		// Change user's original notifications to ours
		//$data = array('item_type' => $enable);
		//$sql = 'UPDATE ' . USER_NOTIFICATIONS_TABLE . ' SET ' . $this->db->sql_build_array('UPDATE', $data) .
		//		 " WHERE item_type = '{$disable}' AND method = 'notification.method.email'";
		//$this->db->sql_query($sql);
That should allow the script to complete.

But then you will have extra unused rows in the phpbb3_user_notifications table, basically any row with an item_type that starts with primehalo.primenotify so after that you'll want to manually run an SQL query to delete those, like so:

Code: Select all

DELETE FROM `phpbb_user_notifications` WHERE `item_type` LIKE 'primehalo.primenotify.%'
I would strongly advise that you backup your SQL database before making these changes, first before making the PHP code changes and then again before running the manual SQL delete command. At the very least you should make backups of the phpbb_user_notifications table.
Ken F. Innes IV
My Extensions | My MODs | My Topics | My Site: Absolute Anime
Experience the wonder of Japanese Animation!

koraldon
Registered User
Posts: 498
Joined: Sat Jun 30, 2007 12:42 pm

Re: [BETA] [3.2] Prime Notify

Post by koraldon » Sat Dec 29, 2018 7:16 am

Hi,
After update to beta9 notification for quote/PM/new topic stopped working. I do get the emails.
I see in the notification_types table three types that are "0", with the following name:
primehalo.primenotify.notification.type.topic

Is that the issue? should I enable them?

User avatar
primehalo
Former Team Member
Posts: 2816
Joined: Fri May 06, 2005 5:58 pm
Location: Redding, CA
Contact:

Re: [BETA] [3.2] Prime Notify

Post by primehalo » Sat Dec 29, 2018 7:45 am

koraldon wrote:
Sat Dec 29, 2018 7:16 am
Hi,
After update to beta9 notification for quote/PM/new topic stopped working. I do get the emails.
I see in the notification_types table three types that are "0", with the following name:
primehalo.primenotify.notification.type.topic

Is that the issue? should I enable them?
Yes, those should be set to 1 for them to be enabled.
Ken F. Innes IV
My Extensions | My MODs | My Topics | My Site: Absolute Anime
Experience the wonder of Japanese Animation!

CarolC1
Registered User
Posts: 565
Joined: Sat Dec 02, 2006 4:26 pm

Re: [BETA] [3.2] Prime Notify

Post by CarolC1 » 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

User avatar
primehalo
Former Team Member
Posts: 2816
Joined: Fri May 06, 2005 5:58 pm
Location: Redding, CA
Contact:

Re: [BETA] [3.2] Prime Notify

Post by primehalo » 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.
Ken F. Innes IV
My Extensions | My MODs | My Topics | My Site: Absolute Anime
Experience the wonder of Japanese Animation!

CarolC1
Registered User
Posts: 565
Joined: Sat Dec 02, 2006 4:26 pm

Re: [BETA] [3.2] Prime Notify

Post by CarolC1 » Thu Jan 03, 2019 3:04 am

Will do, thanks! :D

MichaT
Registered User
Posts: 15
Joined: Sat Jan 05, 2019 5:44 am
Location: Thailand
Name: Michael

Re: [BETA] [3.2] Prime Notify

Post by MichaT » Wed Jan 09, 2019 5:32 am

Is it possible to make the feature of this extension only available for the board admin?

User avatar
primehalo
Former Team Member
Posts: 2816
Joined: Fri May 06, 2005 5:58 pm
Location: Redding, CA
Contact:

Re: [BETA] [3.2] Prime Notify

Post by primehalo » Sun Jan 13, 2019 3:23 am

That's not really a feature I would like to spend time to add but I think you could do a simple modification to the extension to achieve this. In the primenotify/core/prime_notify.php file there is a function called is_enabled:

Code: Select all

public function is_enabled($option, $user = array())
{
	switch ($option)
	{
		case 'enable_post':
			return $this->myconfig['enable_post'] == self::ENABLED
					|| ($this->myconfig['enable_post'] == self::USER_CHOICE && !empty($user['user_primenotify_enable_post']));

		case 'enable_pm':
			return $this->myconfig['enable_pm'] == self::ENABLED
					|| ($this->myconfig['enable_pm'] == self::USER_CHOICE && !empty($user['user_primenotify_enable_pm']));

		case 'keep_bbcodes':
			return $this->myconfig['keep_bbcodes'] == self::ENABLED
					|| ($this->myconfig['keep_bbcodes'] == self::USER_CHOICE && !empty($user['user_primenotify_keep_bbcodes']));

		case 'always_send':
			return $this->myconfig['always_send'] == self::ENABLED
					|| ($this->myconfig['always_send'] == self::USER_CHOICE && !empty($user['user_primenotify_always_send']));
	}
	return false;
}
If you modify the condition checks in this function to also check if the user is an admin then it would probably work. Please be aware that I have not tested this.

Code: Select all

public function is_enabled($option, $user = array())
{
	global $auth;
	
	switch ($option)
	{
		case 'enable_post':
			return ($this->myconfig['enable_post'] == self::ENABLED && $auth->acl_gets('a_'))
					|| ($this->myconfig['enable_post'] == self::USER_CHOICE && !empty($user['user_primenotify_enable_post']));
					
}
Ken F. Innes IV
My Extensions | My MODs | My Topics | My Site: Absolute Anime
Experience the wonder of Japanese Animation!

nou nou
Registered User
Posts: 287
Joined: Sat Oct 29, 2016 8:08 pm

Re: [BETA] [3.2] Prime Notify

Post by nou nou » Mon Jan 14, 2019 8:05 am

Interesting! Thanks for sharing that. Could you also in the same way adjust it so it only works for a specific group?

Might as well add a permission at that point perhaps... But I don't know how easy/difficult that is...

User avatar
primehalo
Former Team Member
Posts: 2816
Joined: Fri May 06, 2005 5:58 pm
Location: Redding, CA
Contact:

Re: [BETA] [3.2] Prime Notify

Post by primehalo » Mon Jan 14, 2019 9:16 pm

Yeah, probably, I don't see why it wouldn't work.
Ken F. Innes IV
My Extensions | My MODs | My Topics | My Site: Absolute Anime
Experience the wonder of Japanese Animation!

nou nou
Registered User
Posts: 287
Joined: Sat Oct 29, 2016 8:08 pm

Re: [BETA] [3.2] Prime Notify

Post by nou nou » Mon Jan 14, 2019 11:21 pm

primehalo wrote:
Mon Jan 14, 2019 9:16 pm
Yeah, probably, I don't see why it wouldn't work.

Ok I should have also asked how that would look code-wise pretty please? :)

Or would you perhaps consider adding this as an ACP permission?

User avatar
primehalo
Former Team Member
Posts: 2816
Joined: Fri May 06, 2005 5:58 pm
Location: Redding, CA
Contact:

Re: [BETA] [3.2] Prime Notify

Post by primehalo » Mon Jan 14, 2019 11:43 pm

Sorry, I don't know what the code for that would be off-hand. You'd have to know the ID of the group and then check if the user is a member of that group ID, but I don't remember what the code is to check if a user is a member of a group. Maybe this could be added in a future release but it's not something I'm going to add anytime soon. I don't want to add any new features at the moment as I want to make sure this extension is stable the way it is so I can submit it to the Extension Database for an official release.
Ken F. Innes IV
My Extensions | My MODs | My Topics | My Site: Absolute Anime
Experience the wonder of Japanese Animation!

nou nou
Registered User
Posts: 287
Joined: Sat Oct 29, 2016 8:08 pm

Re: [BETA] [3.2] Prime Notify

Post by nou nou » Tue Jan 15, 2019 4:00 am

Fair enough - thanks though!

User avatar
horseguards
Registered User
Posts: 74
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 » Wed Jan 16, 2019 4:02 pm

hello,

I am VERY interested in PrimeNotify. I have installed a phpBB 3.2.3 running on PHP 7.2

Will it work for me?

Thanks!

User avatar
primehalo
Former Team Member
Posts: 2816
Joined: Fri May 06, 2005 5:58 pm
Location: Redding, CA
Contact:

Re: [BETA] [3.2] Prime Notify

Post by primehalo » Wed Jan 16, 2019 5:12 pm

I hope so. I was trying to get more people to try it out first before submitting it for official release.
Ken F. Innes IV
My Extensions | My MODs | My Topics | My Site: Absolute Anime
Experience the wonder of Japanese Animation!

Post Reply

Return to “Extensions in Development”

Who is online

Users browsing this forum: Mathieu M., skybound, supanet and 18 guests