Been banging my head against the desk for a few weeks now
There's an annoying bug in my extension where if you select an attribute from the dropdown list on posting an then preview the topic/post, the selector changes to "keep the current attribute", which would normally be fine except that on new posts, it sets it to 0 which is undesirable.
I think I've narrowed it down to this event in my listener, but no matter what combination of
Hope I expained it well enough. ![Confused :?]()
There's an annoying bug in my extension where if you select an attribute from the dropdown list on posting an then preview the topic/post, the selector changes to "keep the current attribute", which would normally be fine except that on new posts, it sets it to 0 which is undesirable.
I think I've narrowed it down to this event in my listener, but no matter what combination of
if ($event['preview']) logic I try, I can't figure out how to display the original attribute instead of it switching.Code:
public function posting_modify_template_vars($event){$topic_attribute = $this->request->variable('attr_id', !empty($event['post_data']['topic_attr_id']) ? \kaileymsnay\qte\qte::KEEP : 0, false, \phpbb\request\request_interface::POST);$this->qte->attr_select($event['forum_id'], !empty($event['post_data']['topic_poster']) ? $event['post_data']['topic_poster'] : 0, (int) $topic_attribute, '', $event['mode']);if ($event['mode'] != 'post'){$post_data = $event['post_data'];if ($topic_attribute != \kaileymsnay\qte\qte::KEEP){$post_data['topic_attr_id']= (int) $topic_attribute;$post_data['topic_attr_user']= (int) $this->user->data['user_id'];$post_data['topic_attr_time']= time();$this->qte->get_users_by_user_id($this->user->data['user_id']);}if ($topic_attribute != \kaileymsnay\qte\qte::DELETE){$this->qte->get_users_by_topic_id([$post_data['topic_id']]);$this->template->assign_var('TOPIC_ATTRIBUTE', $this->qte->attr_display($post_data['topic_attr_id'], $post_data['topic_attr_user'], $post_data['topic_attr_time']));}}}Statistics: Posted by Kailey — Sat Mar 29, 2025 6:53 pm