Alright, I think I've covered enough events for my needs, there might be more but this is a good start:
Code:
class main_listener implements EventSubscriberInterface {...static public function getSubscribedEvents() {return ['core.posting_modify_submit_post_after' => 'posting_modify_submit_post_after','core.move_topics_after' => 'move_topics_after','core.delete_topics_before_query' => 'delete_topics_before_query',];}...private function check_topic_locking($topic, $offset) {if($topic['lock_max'] > 0 || $topic['unlock_min'] > 0) {require_once('includes/acp/auth.php');$auth_admin = new \auth_admin();}if($topic['lock_max'] > 0 && $topic['forum_topics_approved'] + $offset >= $topic['lock_max']) {$auth_admin->acl_set('group', $topic['forum_id'], 65, array('f_post' => 0), 0, true);} else if($topic['unlock_min'] > 0 && $topic['forum_topics_approved'] + $offset <= $topic['unlock_min']) {$auth_admin->acl_set('group', $topic['forum_id'], 65, array('f_post' => 1), 0, true);}}public function posting_modify_submit_post_after($vars) {$this->check_topic_locking($vars['post_data'], 1); // we get the old (smaller) number}public function move_topics_after($vars) {// oddly, the returned topic data still// points to the old forum instead of the new one$topic_data = phpbb_get_topic_data($vars['topic_ids']);foreach($topic_data as $topic_id => $topic)$this->check_topic_locking($topic, -1); // we get the old (bigger) number$forum_data = phpbb_get_forum_data($vars['forum_id']);foreach($forum_data as $forum_id => $forum)$this->check_topic_locking($forum, 1); // we get the old (smaller) numberreturn $vars;}public function delete_topics_before_query($vars) {$topic_data = phpbb_get_topic_data($vars['topic_ids']);foreach($topic_data as $topic_id => $topic)$this->check_topic_locking($topic, -1); // we get the old (bigger) number}}
Statistics: Posted by vampirefrog — Mon Jan 15, 2024 9:05 pm