Forum Replies Created
-
In reply to: Hook for deleting topic
someone?
In reply to: Cleaning up db after deleting groupOK. I seem to have found a solution, so I’m gonna share it here:
First, I replaced the groups_screen_group_admin_delete_group with a slightly changed version where I call a custom function after this line:
`do_action( ‘groups_before_group_deleted’, $bp->groups->current_group->id );`Remember to register this correctly! In my case:
`
remove_action( ‘bp_screens’, ‘groups_screen_group_admin_delete_group’ );
add_action( ‘bp_screens’, ‘myplugin_groups_screen_group_admin_delete_group’ );
`where ‘myplugin_groups_screen_group_admin_delete_group’ is the name of the function.
The function I call makes use of groups_delete_group_forum_topic( $topic_id ) and bb_delete_forum( $forum_id ). This way, you delete the group and keep the db tidy!
`
$forum_id_array = $wpdb->get_results($wpdb->prepare(“
SELECT forum_id FROM wp_bb_forums
WHERE forum_id = (
SELECT meta_value
FROM wp_bp_groups_groupmeta
WHERE meta_key = ‘forum_id’
AND group_id = %s
) ;”
, $group_id));
$forum_id = $forum_id_array[0]->forum_id;
$topic_id_array = $wpdb->get_results($wpdb->prepare(“
SELECT topic_id FROM wp_bb_posts
WHERE forum_id = %s;”
, $forum_id));foreach ($topic_id_array as $value) {
groups_delete_group_forum_topic( $value->topic_id );
}
bb_delete_forum( $forum_id );
`In reply to: Cleaning up db after deleting groupB.U.M.P.
In reply to: Cleaning up db after deleting groupOK. Let me rephrase this… Has anyone had the same problem before and knows exactly which entries to remove from which tables?
In reply to: Cleaning up db after deleting groupbump…