function JB_delete_employer($id) { $sql = "SELECT * from `profiles_table` WHERE `user_id`='" . jb_escape_sql($id) . "'"; $result = JB_mysql_query($sql) or die(mysql_error()); $row = mysql_fetch_array($result, MYSQL_ASSOC); // delete profile, if exists if ($row['profile_id'] != '') { JB_delete_profile($row['profile_id']); } // get all the posts and delete them $sql = "SELECT * from `posts_table` WHERE `user_id`='" . jb_escape_sql($id) . "'"; $result = JB_mysql_query($sql) or die(mysql_error()); while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { JB_delete_post($row['post_id']); $sql = "DELETE FROM `saved_jobs` WHERE `post_id`='" . jb_escape_sql($row['post_id']) . "'"; JB_mysql_query($sql) or die(mysql_error()); } JB_finalize_post_updates(); JB_delete_employer_files($id); // delete requests.. $sql = "DELETE FROM `requests` WHERE `employer_id`='" . jb_escape_sql($id) . "'"; JB_mysql_query($sql) or die(mysql_error()); // delete invoices $sql = "DELETE FROM `package_invoices` WHERE `employer_id`='" . jb_escape_sql($id) . "'"; JB_mysql_query($sql) or die(mysql_error()); $sql = "DELETE FROM `subscription_invoices` WHERE `employer_id`='" . jb_escape_sql($id) . "'"; JB_mysql_query($sql) or die(mysql_error()); $sql = "DELETE FROM `membership_invoices` WHERE `user_id`='" . jb_escape_sql($id) . "'"; JB_mysql_query($sql) or die(mysql_error()); $sql = "DELETE FROM `applications` WHERE `employer_id`='" . jb_escape_sql($id) . "'"; JB_mysql_query($sql) or die(mysql_error()); // finally, delete the employer account. $sql = "DELETE FROM `employers` WHERE `ID`='" . jb_escape_sql($id) . "'"; JB_mysql_query($sql) or die(mysql_error()); $affected = jb_mysql_affected_rows(); JBPLUG_do_callback('delete_employer_account', $id); return $affected; }
$ProfileForm->set_mode('edit'); if ($_REQUEST['save'] != "") { // saving $errors = $ProfileForm->validate(); if ($errors) { // we have an error $mode = "edit"; $ProfileForm->display_form('edit', true); } else { $mode = "edit"; $profile_id = $ProfileForm->save(true); $JBMarkup->ok_msg('Profile Saved'); JB_list_profiles($admin, $_REQUEST['order_by'], $_REQUEST['offset']); } } elseif ($_REQUEST['action'] == 'edit') { echo "<a style='text-align:center;'><b><a href='" . htmlentities(JB_get_go_back_link()) . "'>" . $label["resume_display_go_back"] . "</a></b><p>"; $mode = 'edit'; $ProfileForm->load($_REQUEST['profile_id']); $ProfileForm->display_form('edit', true); } elseif ($_REQUEST['action'] == 'delete') { JB_delete_profile($_REQUEST['profile_id']); $JBMarkup->ok_msg('Profile Deleted'); JB_list_profiles($admin, $_REQUEST['order_by'], $_REQUEST['offset']); } elseif ($_REQUEST['profile_id'] != '') { $ProfileForm->load($_REQUEST['profile_id']); $ProfileForm->display_form('view', true); //JB_display_profile_form (3, $mode, $data, true); } else { JB_list_profiles($admin, $_REQUEST['order_by'], $_REQUEST['offset']); } JB_admin_footer();