โค้ด: เลือกทั้งหมด
class button_like extends \phpbb\notification\type\base
{
//
}
เราต้องใช้ เเบบนี้หรอค่ะ
โค้ด: เลือกทั้งหมด
parent::create_insert_array($data, $pre_create_data)
โค้ด: เลือกทั้งหมด
public function create_insert_array($data, $pre_create_data = array())
{
$this->set_data('requester_id', $data['requester_id']);
$this->set_data('post_id', $data['post_id']);
$this->set_data('topic_id', $data['topic_id']);
$this->set_data('post_subject', $data['post_subject']);
return parent::create_insert_array($data, $pre_create_data);
}
------------------------------
เเล้วถ้าเรา
โค้ด: เลือกทั้งหมด
public function __construct(\phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\request\request $request, \phpbb\template\template $template, \phpbb\user $user, Container $phpbb_container, $root_path, $php_ext)
{
$this->config = $config;
$this->db = $db;
$this->request = $request;
$this->template = $template;
$this->user = $user;
$this->phpbb_container = $phpbb_container;
$this->root_path = $root_path;
$this->php_ext = $php_ext;
}
โค้ด: เลือกทั้งหมด
public function get_avatar()
{
$users = array($this->get_data('requester_id'));
$this->user_loader->load_users($users);
return $this->user_loader->get_avatar($this->get_data('requester_id'));
}
--------------------------------
ตอนที่เราประกาศ
public function __construct
กับ
โค้ด: เลือกทั้งหมด
$feed = new \xxxx\m_button_like\acp\feed();
$feed->main($xml, $xml_ads);