Quantcast
Channel: phpBB.com
Viewing all articles
Browse latest Browse all 1838

Extension Writers Discussion • notification system in extension

$
0
0
hi there!
i'm creating my first extension.
my extension make the admin editing the phpbb_user table in the column user_donatore.
It works correctly but i want to send a notification to the user related of this editing.
Like:
- admin edits the column user_donatore for the user "sebo"
- user sebo has to get the notification of this editing

so:
(i'm quite new to PHP and this is my first extension, so it's quite difficult for me, but i'm trying to learn... :oops: )

i read this tutorial
https://area51.phpbb.com/docs/dev/3.3.x ... tions.html

i edited the file service.yml - '@notification_manager' to get notification into the acp_control
and

Code:

   sebo.donatore.notification.type.attiva:        class: sebo\donatore\notification\type\attiva        shared: false # service MUST not be shared for this to work!        parent: notification.type.base        calls:            - [set_controller_helper, ['@controller.helper']]        tags:            - { name: notification.type }
i still don't unerstand what are "call" and "tag" for... :?: (i don't understand from the wiki)

after i've included in the acp_control.php

Code:

/** @var \phpbb\notification\manager */protected $notification_manager;
and the constructor

Code:

public function __construct(\phpbb\notification\manager $notication_manager){$this->notification_manager= $notification_manager;}
and tried to make a function.

like i said before, this function is:
- after the acp edit the db (changing the column "user_donatore" in table "phpbb_users"), it has to set a notification for the user that the column has been changed...so i've tried to start what to write...maybe something like

Code:

$this->notification_manager->add_notifications('sebo.donatore.notification.type.attiva', [            'user_id'         => 'user_id',            'sender_id'       => 'user_admin_id',            'message_subject' => 'notifica_subject',        ]);
BUT before i can code this part, i've refreshed the page and appears
[phpBB Debug] PHP Warning: in file [ROOT]/ext/sebo/donatore/controller/acp_controller.php on line 67: Undefined variable $notification_manager
what do i miss?!?! :cry:

Statistics: Posted by sebo — Sun Feb 18, 2024 10:19 am



Viewing all articles
Browse latest Browse all 1838

Trending Articles