โดย Ittichai_chupol » 29/10/2019 10:10 am
ผมต้องการที่จะปรับเปลี่ยนแก้ไข ค่าชื่อของผู้ที่ Quote โพสต์ที่ปรากฏในส่วนของการแจ้งเตือนของการ Quote ใน phpbb จะต้องทำอย่างไรบางครับ
- คือผมได้ทดสอบเข้ามาเพิ่มการทำงานโดยการปรับเพิ่มการทำงานใน function update_notifications ของไฟล์ Quote.php ดังนี้
โค้ด: เลือกทั้งหมด
public function update_notifications($post) {
global $request, $db, $config,$user;
$old_notifications = $this->notification_manager->get_notified_users($this->get_type(), array(
'item_id' => static::get_item_id($post),
));
if ($request->variable('mod_anonymous', 0, true) != 0) {
$kai = unserialize($old_notifications['2']['notification_data']);
$kai['poster_id'] = '49';
$kai['post_username'] = $anonymous_code = 'A' . str_pad($user->data['user_id'], $config['m_anonymous_post_name'] - 1, "0", STR_PAD_BOTH);
$sql_arr = array(
'notification_type_id' => 3,
'item_id' => 619,
'item_parent_id' => 63,
'user_id' => 2,
'notification_read' => 0,
'notification_time' => 1572258208,
'notification_data' => serialize($kai),
);
$sql = 'UPDATE ' . NOTIFICATIONS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_arr) . 'WHERE notification_id = ' . $old_notifications['2']['notification_id'];
echo $sql;
$db->sql_query($sql);
}
ซึ่งจะเป็นการที่จะ UPDATE ข้อมูลลงในฐานข้อมูลเพื่อปรับแก้ไขการแจ้งเตือนในการ Qoute ในส่วนนี้แล้วเข้าไปดูในฐานข้อมูลก็ได้มีการเปลี่ยนแปลงตาม แต่หลังจากส่ววนี้ ก็ยังติดปัญหาที่ว่า ข้อมูลนั้นได้กลับมาเป็นข้อมูลเดิมก่อนที่จะมีการ UPDATE ลงไป
- จึงอยากทราบว่าควรจะต้องเข้าไปปรับแก้ไขที่ส่วนใด หรือ ปรับอย่างไรต่อครับ
เมื่อปรัญแก้ไข้ไปแล้ว ข้อมูลกลับเปลี่ยนแปลงมาเป็นข้อมูลเดิน
ผมต้องการที่จะปรับเปลี่ยนแก้ไข ค่าชื่อของผู้ที่ Quote โพสต์ที่ปรากฏในส่วนของการแจ้งเตือนของการ Quote ใน phpbb จะต้องทำอย่างไรบางครับ
- คือผมได้ทดสอบเข้ามาเพิ่มการทำงานโดยการปรับเพิ่มการทำงานใน function update_notifications ของไฟล์ Quote.php ดังนี้
[code=php]
public function update_notifications($post) {
global $request, $db, $config,$user;
$old_notifications = $this->notification_manager->get_notified_users($this->get_type(), array(
'item_id' => static::get_item_id($post),
));
if ($request->variable('mod_anonymous', 0, true) != 0) {
$kai = unserialize($old_notifications['2']['notification_data']);
$kai['poster_id'] = '49';
$kai['post_username'] = $anonymous_code = 'A' . str_pad($user->data['user_id'], $config['m_anonymous_post_name'] - 1, "0", STR_PAD_BOTH);
$sql_arr = array(
'notification_type_id' => 3,
'item_id' => 619,
'item_parent_id' => 63,
'user_id' => 2,
'notification_read' => 0,
'notification_time' => 1572258208,
'notification_data' => serialize($kai),
);
$sql = 'UPDATE ' . NOTIFICATIONS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_arr) . 'WHERE notification_id = ' . $old_notifications['2']['notification_id'];
echo $sql;
$db->sql_query($sql);
}
[/code]
ซึ่งจะเป็นการที่จะ UPDATE ข้อมูลลงในฐานข้อมูลเพื่อปรับแก้ไขการแจ้งเตือนในการ Qoute ในส่วนนี้แล้วเข้าไปดูในฐานข้อมูลก็ได้มีการเปลี่ยนแปลงตาม แต่หลังจากส่ววนี้ ก็ยังติดปัญหาที่ว่า ข้อมูลนั้นได้กลับมาเป็นข้อมูลเดิมก่อนที่จะมีการ UPDATE ลงไป
- จึงอยากทราบว่าควรจะต้องเข้าไปปรับแก้ไขที่ส่วนใด หรือ ปรับอย่างไรต่อครับ
เมื่อปรัญแก้ไข้ไปแล้ว ข้อมูลกลับเปลี่ยนแปลงมาเป็นข้อมูลเดิน