clarkwinkelmann
Can you somehow display in a place that I have marked user information in the code such as email, user id, or other data from the users table?
<?php
namespace Mezir\TsNotification\Listeners;
use Flarum\User\User;
use Flarum\Event\ConfigureNotificationTypes;
use Flarum\Settings\SettingsRepositoryInterface;
use Illuminate\Contracts\Events\Dispatcher;
class EnableTsNotifications
{
protected $settings;
public function __construct(SettingsRepositoryInterface $settings)
{
$this->settings = $settings;
}
public function subscribe(Dispatcher $events)
{
$events->listen(ConfigureNotificationTypes::class, [$this, 'configure']);
}
public function configure(ConfigureNotificationTypes $event)
{
//For example, I would like to insert a user's e-mail here and create conditional instructions.
/*if (!$this->settings->get('flagrow-telegram.enableNotifications')) {
return;
}*/
$telegramCompatibleTypes = [
'postMentioned',
'userMentioned',
'newPost',
'newDiscussionInTag',
'newPostInTag',
'discussionCreated',
'userCreated',
];
foreach ($telegramCompatibleTypes as $type) {
User::addPreference(
User::getNotificationPreferenceKey($type, 'teamspeak'),
'boolval',
false
);
}
}
}