function qa_delete_user($userid)
{
    if (qa_to_override(__FUNCTION__)) {
        $args = func_get_args();
        return qa_call_override(__FUNCTION__, $args);
    }
    require_once QA_INCLUDE_DIR . 'qa-db-votes.php';
    require_once QA_INCLUDE_DIR . 'qa-db-users.php';
    require_once QA_INCLUDE_DIR . 'qa-db-post-update.php';
    require_once QA_INCLUDE_DIR . 'qa-db-points.php';
    $postids = qa_db_uservoteflag_user_get($userid);
    // posts this user has flagged or voted on, whose counts need updating
    qa_db_user_delete($userid);
    foreach ($postids as $postid) {
        // hoping there aren't many of these - saves a lot of new SQL code...
        qa_db_post_recount_votes($postid);
        qa_db_post_recount_flags($postid);
    }
    $postuserids = qa_db_posts_get_userids($postids);
    foreach ($postuserids as $postuserid) {
        qa_db_points_update_ifuser($postuserid, array('avoteds', 'qvoteds', 'upvoteds', 'downvoteds'));
    }
}
Exemple #2
0
function deleteUser($userid)
{
    require_once QA_INCLUDE_DIR . "db/users.php";
    qa_db_user_delete($userid);
}