Notifications

Discussion forum for Extension Writers regarding Extension Development.
User avatar
3Di
Former Team Member
Posts: 13791
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milan (IT) Frankfurt (DE)
Name: Marco
Contact:

Re: Notifications

Post by 3Di » Wed Jul 20, 2016 10:51 pm

Aurelienazerty wrote:I forgot that, so it's not good thing to make an extension for the moment...
If you are coding an extension that will work only for 3.1.x then go ahead.
Instead if you are coding an extension that aims to be 3.1/3.2 compatible you should code some things more, it is something I recall has been already discussed here.
Please PM me only to request paid works. Thx.
Want to compensate me for my interest? Donate
My development's activity º PhpStorm's proud user
Extensions, Scripts, MOD porting, Update/Upgrades
👨‍🏫 | Take a tour to | The Studio | 👨‍🏫

User avatar
kinerity
Community Team Member
Community Team Member
Posts: 2259
Joined: Mon Sep 01, 2014 1:00 am
Location: sudo rm -rf /
Name: Kailey Truscott
Contact:

Re: Notifications

Post by kinerity » Sat Dec 17, 2016 4:50 am

Question - how do I show notifications to users who only have a certain permission? Here is my current find users function:

Code: Select all

public function find_users_for_notification($data, $options = array())
{
    // Grab all registered users (excluding bots and guests)
    $sql = 'SELECT user_id
        FROM ' . USERS_TABLE . '
        WHERE user_type <> ' . USER_IGNORE;
    $result = $this->db->sql_query($sql);

    $users = array();
    while ($row = $this->db->sql_fetchrow($result))
    {
        $users[$row['user_id']] = array('');
    }
    $this->db->sql_freeresult($result);

    return $users;
} 

Edit: Fixed. For those wondering, I had to add the following to my notification file:

Code: Select all

protected $permission = 'm_approve';

public function is_available()
{
    $has_permission = $this->auth->acl_getf($this->permission, true);

    return (!empty($has_permission));
} 
I then had to modify my functions so it looked like this:

Code: Select all

public function find_users_for_notification($data, $options = array())
{
    $options = array_merge(array(
        'ignore_users'  => array(),
    ), $options);

    // Grab users that have permission to approval articles
    $user_ary = $this->auth->acl_get_list(false, $this->permission, false);
    $users = (!empty($user_ary[0][$this->permission])) ? $user_ary[0][$this->permission] : array();

    if (empty($users))
    {
        return array();
    }

    return $this->check_user_notification_options($users, $options);
} 
Kailey Truscott - Community Team

User avatar
Steve
Registered User
Posts: 992
Joined: Tue Apr 07, 2009 7:48 pm
Location: UK ,up north!!
Name: Steven Clark
Contact:

Re: Notifications

Post by Steve » Thu Feb 09, 2017 4:55 pm

rxu wrote:
Sat Aug 30, 2014 1:20 pm
Here's a brief guide to give an initial direction about creating notifications in extensions.
Thank You, very usefull :D

User avatar
Aurelienazerty
Registered User
Posts: 154
Joined: Sat Jan 08, 2005 8:21 pm
Contact:

Re: Notifications

Post by Aurelienazerty » Sun Jun 09, 2019 3:12 pm

rxu wrote:
Sat Aug 30, 2014 1:20 pm
Here's a brief guide to give an initial direction about creating notifications in extensions. I don't claim to its absolute correctness as I'm just describing steps I followed myself to make it work somehow.
Thank's for this tutorial. As phpbb extension change between 3.1 and 3.2 is this tutorial is deprecated ?

rxu
Extensions Development Team
Posts: 2932
Joined: Wed Oct 25, 2006 12:46 pm
Location: Siberia, Russian Federation
Name: Ruslan
Contact:

Re: Notifications

Post by rxu » Sun Jun 09, 2019 4:47 pm

Some things were changed I guess. Well, now you can get phpBB Skeleton Extension and generate notification boilerplate files you need.

Post Reply

Return to “Extension Writers Discussion”