| // | Plugin description : | // | Ce plugin permet l'enregistrement d'un utilisateur directement dans | // | PunBB (http://www.punbb.org) - This plugin allows to automatically | // | register a PWG user in a PunBB forum (http://www.punbb.org) | // +-----------------------------------------------------------------------+ // | This program is free software; you can redistribute it and/or modify | // | it under the terms of the GNU General Public License as published by | // | the Free Software Foundation | // | | // | This program is distributed in the hope that it will be useful, but | // | WITHOUT ANY WARRANTY; without even the implied warranty of | // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | // | General Public License for more details. | // | | // | You should have received a copy of the GNU General Public License | // | along with this program; if not, write to the Free Software | // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | // | USA. | // +-----------------------------------------------------------------------+ // ******************************************** // ** Delete user from the PunBB users table ** // ******************************************** // Load Plugin settings from database load_conf_from_db('param like \'punbb\\_%\''); global $conf; // ID selection in the pwg/punbb correspondence table $query = " SELECT id_user_punbb, id_user_pwg FROM ".PLUGIN_REGISTER_PUNBB_ID." WHERE id_user_pwg = ".$user_id."; "; $result = pwg_query($query); while($data = mysql_fetch_array($result)) { // If equal to 0 then all posts and topics from deleted user will be deleted too if ($conf['punbb_del_pt'] == 0) { // Deletion of user's posts $query_1 = " DELETE FROM ".$conf['punbb_prefix']."posts WHERE poster_id = ".$data['id_user_punbb']."; "; $result_1 = pwg_query($query_1); // Username selection $query_2 = " SELECT username FROM ".USERS_TABLE." WHERE id = ".$data['id_user_pwg']."; "; $result_2 = pwg_query($query_2); while ($data_1 = mysql_fetch_array($result_2)) { // Deletion of user's topics $query_3 = " DELETE FROM ".$conf['punbb_prefix']."topics WHERE poster = '".$data_1['username']."'; "; $result_3 = pwg_query($query_3); } } // Deletion of user's subscriptions $query_4 = " DELETE FROM ".$conf['punbb_prefix']."subscriptions WHERE user_id = ".$data['id_user_punbb']."; "; $result_4 = pwg_query($query_4); // Deletion of user's account $query_5 = " DELETE FROM ".$conf['punbb_prefix']."users WHERE id = ".$data['id_user_punbb']."; "; $result_5 = pwg_query($query_5); // Deletion of user's correspondence in pwg/punbb correspondence table $query_6 = " DELETE FROM ".PLUGIN_REGISTER_PUNBB_ID." WHERE id_user_pwg = ".$user_id."; "; $result_6 = pwg_query($query_6); } ?>