phpbb\notification\type\post::add_responders PHP Method

add_responders() public method

Add responders to the notification
public add_responders ( mixed $post )
$post mixed
    public function add_responders($post)
    {
        // Do not add them as a responder if they were the original poster that created the notification
        if ($this->get_data('poster_id') == $post['poster_id']) {
            return array();
        }
        $responders = $this->get_data('responders');
        $responders = $responders === null ? array() : $responders;
        // Do not add more than 25 responders,
        // we trim the username list to "a, b, c and x others" anyway
        // so there is no use to add all of them anyway.
        if (sizeof($responders) > 25) {
            return array();
        }
        foreach ($responders as $responder) {
            // Do not add them as a responder multiple times
            if ($responder['poster_id'] == $post['poster_id']) {
                return array();
            }
        }
        $responders[] = array('poster_id' => $post['poster_id'], 'username' => $post['poster_id'] == ANONYMOUS ? $post['post_username'] : '');
        $this->set_data('responders', $responders);
        $serialized_data = serialize($this->get_data(false));
        // If the data is longer then 4000 characters, it would cause a SQL error.
        // We don't add the username to the list if this is the case.
        if (utf8_strlen($serialized_data) >= 4000) {
            return array();
        }
        return array('notification_data' => $serialized_data);
    }