| 1 |
<?php |
| 2 |
/** |
| 3 |
* WPSchoolPress Uninstall |
| 4 |
* |
| 5 |
* Uninstalling WPSchoolPress deletes user, roles, pages, tables. |
| 6 |
* |
| 7 |
*/ |
| 8 |
if ( !defined( 'ABSPATH' ) ) { exit; } |
| 9 |
else { |
| 10 |
require_once(ABSPATH.'wp-admin/includes/user.php' ); |
| 11 |
$remove_data_status = get_option( 'wpsp_remove_data'); |
| 12 |
if( $remove_data_status== 1 ) { |
| 13 |
global $wpdb; |
| 14 |
$teacher_table = $wpdb->prefix.'wpsp_teacher'; |
| 15 |
$student_table = $wpdb->prefix.'wpsp_student'; |
| 16 |
$class_table = $wpdb->prefix.'wpsp_class' ; |
| 17 |
$parents_table = $wpdb->prefix.'wpsp_parent'; |
| 18 |
$exams_table = $wpdb->prefix.'wpsp_exam'; |
| 19 |
$mark_table = $wpdb->prefix.'wpsp_mark'; |
| 20 |
$mark_extract_table = $wpdb->prefix.'wpsp_mark_extract'; |
| 21 |
$mark_fields_table = $wpdb->prefix.'wpsp_mark_fields'; |
| 22 |
$messages_table = $wpdb->prefix.'wpsp_messages'; |
| 23 |
$time_table = $wpdb->prefix.'wpsp_timetable'; |
| 24 |
$notification_table = $wpdb->prefix.'wpsp_notification'; |
| 25 |
// $hostel_table = $wpdb->prefix.'wpsp_hostel'; |
| 26 |
$subject_table = $wpdb->prefix.'wpsp_subject'; |
| 27 |
$workinghours_table = $wpdb->prefix.'wpsp_workinghours'; |
| 28 |
$transport_table = $wpdb->prefix.'wpsp_transport'; |
| 29 |
$settings_table = $wpdb->prefix.'wpsp_settings'; |
| 30 |
$attendance_table = $wpdb->prefix.'wpsp_attendance'; |
| 31 |
$events_table = $wpdb->prefix.'wpsp_events'; |
| 32 |
$teacher_attendance_table = $wpdb->prefix.'wpsp_teacher_attendance'; |
| 33 |
$grade_settings_table = $wpdb->prefix.'wpsp_grade'; |
| 34 |
$import_history_table = $wpdb->prefix.'wpsp_import_history'; |
| 35 |
$wpsp_fees = $wpdb->prefix.'wpsp_fees'; |
| 36 |
$wpsp_fees_payment = $wpdb->prefix.'wpsp_fees_payment'; |
| 37 |
$wpsp_fee_payment_history = $wpdb->prefix.'wpsp_fee_payment_history'; |
| 38 |
$wpsp_leavedays = $wpdb->prefix.'wpsp_leavedays'; |
| 39 |
$page_titles=array( 'Teacher','Student','Class','Dashboard','Messages','Exams','Attendance','Timetable','Events','Subject','Transport','Settings','Marks','Notify','SMS','ImportHistory','LeaveCalendar','TeacherAttendance', 'Parent', 'Change Password', 'Payment' ); |
| 40 |
foreach($page_titles as $page_title) { |
| 41 |
$page = get_page_by_title($page_title); |
| 42 |
wp_delete_post($page->ID,true); //Trash or delete a post or page. |
| 43 |
} |
| 44 |
$student_ids = $wpdb->get_col( "select wp_usr_id from $student_table" ); |
| 45 |
$parent_ids = $wpdb->get_col( "select parent_wp_usr_id from $student_table" ); |
| 46 |
$teacher_ids = $wpdb->get_col( "select wp_usr_id from $teacher_table" ); |
| 47 |
$user_ids[] = array(); |
| 48 |
$user_ids = array_merge( $student_ids,$parent_ids,$teacher_ids ); |
| 49 |
foreach($user_ids as $user_id) { |
| 50 |
wp_delete_user($user_id); //Delete user |
| 51 |
} |
| 52 |
$tables = array($teacher_table,$student_table,$class_table,$parents_table,$exams_table,$mark_table,$messages_table,$time_table,$notification_table,$hostel_table,$subject_table,$workinghours_table,$transport_table,$settings_table,$attendance_table,$events_table,$teacher_attendance_table,$grade_settings_table,$settings_table,$mark_extract_table,$mark_fields_table,$import_history_table,$leave_table,$wpsp_fees, $wpsp_fees_payment, $wpsp_fee_payment_history, $wpsp_leavedays); |
| 53 |
foreach($tables as $table) { |
| 54 |
$sql = "DROP TABLE IF EXISTS $table"; |
| 55 |
$wpdb->query($sql); //Delete tables |
| 56 |
} |
| 57 |
} |
| 58 |
} ?><?php |
| 59 |
/** |
| 60 |
* WPSchoolPress Uninstall |
| 61 |
* |
| 62 |
* Uninstalling WPSchoolPress deletes user, roles, pages, tables. |
| 63 |
* |
| 64 |
*/ |
| 65 |
if ( !defined( 'ABSPATH' ) ) { exit; } |
| 66 |
else { |
| 67 |
require_once(ABSPATH.'wp-admin/includes/user.php' ); |
| 68 |
$remove_data_status = get_option( 'wpsp_remove_data'); |
| 69 |
if( $remove_data_status== 1 ) { |
| 70 |
global $wpdb; |
| 71 |
$teacher_table = $wpdb->prefix.'wpsp_teacher'; |
| 72 |
$student_table = $wpdb->prefix.'wpsp_student'; |
| 73 |
$class_table = $wpdb->prefix.'wpsp_class' ; |
| 74 |
$parents_table = $wpdb->prefix.'wpsp_parent'; |
| 75 |
$exams_table = $wpdb->prefix.'wpsp_exam'; |
| 76 |
$mark_table = $wpdb->prefix.'wpsp_mark'; |
| 77 |
$mark_extract_table = $wpdb->prefix.'wpsp_mark_extract'; |
| 78 |
$mark_fields_table = $wpdb->prefix.'wpsp_mark_fields'; |
| 79 |
$messages_table = $wpdb->prefix.'wpsp_messages'; |
| 80 |
$time_table = $wpdb->prefix.'wpsp_timetable'; |
| 81 |
$notification_table = $wpdb->prefix.'wpsp_notification'; |
| 82 |
$hostel_table = $wpdb->prefix.'wpsp_hostel'; |
| 83 |
$subject_table = $wpdb->prefix.'wpsp_subject'; |
| 84 |
$workinghours_table = $wpdb->prefix.'wpsp_workinghours'; |
| 85 |
$transport_table = $wpdb->prefix.'wpsp_transport'; |
| 86 |
$settings_table = $wpdb->prefix.'wpsp_settings'; |
| 87 |
$attendance_table = $wpdb->prefix.'wpsp_attendance'; |
| 88 |
$events_table = $wpdb->prefix.'wpsp_events'; |
| 89 |
$teacher_attendance_table = $wpdb->prefix.'wpsp_teacher_attendance'; |
| 90 |
$grade_settings_table = $wpdb->prefix.'wpsp_grade'; |
| 91 |
$import_history_table = $wpdb->prefix.'wpsp_import_history'; |
| 92 |
$wpsp_fees = $wpdb->prefix.'wpsp_fees'; |
| 93 |
$wpsp_fees_payment = $wpdb->prefix.'wpsp_fees_payment'; |
| 94 |
$wpsp_fee_payment_history = $wpdb->prefix.'wpsp_fee_payment_history'; |
| 95 |
|
| 96 |
$social_posts_table = $wpdb->prefix . 'wpsp_social_posts'; |
| 97 |
$share_table = $wpdb->prefix . 'wpsp_social_share'; |
| 98 |
$likes_table = $wpdb->prefix . 'wpsp_social_likes'; |
| 99 |
$follow_table = $wpdb->prefix . 'wpsp_social_follow'; |
| 100 |
$report_table = $wpdb->prefix . 'wpsp_social_report'; |
| 101 |
$notes_table = $wpdb->prefix . 'wpsp_social_notes'; |
| 102 |
$fcmToken_table = $wpdb->prefix . 'wpsp_user_fcm_token'; |
| 103 |
$post_notification_table = $wpdb->prefix . 'wpsp_post_notification'; |
| 104 |
$documents_category_table = $wpdb->prefix . 'wpsp_documents_category'; |
| 105 |
$documents_table = $wpdb->prefix . 'wpsp_documents'; |
| 106 |
$messages_table = $wpdb->prefix . 'wpspsm_messages'; |
| 107 |
$messages_table_delete = $wpdb->prefix . 'wpspsm_messages_delete'; |
| 108 |
|
| 109 |
$page_titles=array( 'Teacher','Student','Class','Dashboard','Messages','Exams','Attendance','Timetable','Events','Subject','Transport','Settings','Marks','Notify','SMS','ImportHistory','LeaveCalendar','TeacherAttendance', 'Parent' ); |
| 110 |
foreach($page_titles as $page_title) { |
| 111 |
$page = get_page_by_title($page_title); |
| 112 |
wp_delete_post($page->ID,true); //Trash or delete a post or page. |
| 113 |
} |
| 114 |
$student_ids = $wpdb->get_col( "select wp_usr_id from $student_table" ); |
| 115 |
$parent_ids = $wpdb->get_col( "select parent_wp_usr_id from $parents_table" ); |
| 116 |
$teacher_ids = $wpdb->get_col( "select wp_usr_id from $teacher_table" ); |
| 117 |
$user_ids[] = array(); |
| 118 |
$user_ids = array_merge( $student_ids,$parent_ids,$teacher_ids ); |
| 119 |
foreach($user_ids as $user_id) { |
| 120 |
wp_delete_user($user_id); //Delete user |
| 121 |
} |
| 122 |
$tables = array($teacher_table,$student_table,$class_table,$parents_table,$exams_table,$mark_table,$messages_table,$time_table,$notification_table,$hostel_table,$subject_table,$workinghours_table,$transport_table,$settings_table,$attendance_table,$events_table,$teacher_attendance_table,$grade_settings_table,$settings_table,$mark_extract_table,$mark_fields_table,$import_history_table,$leave_table,$wpsp_fees, $wpsp_fees_payment, $wpsp_fee_payment_history,$social_posts_table,$share_table,$likes_table,$follow_table,$report_table,$notes_table,$fcmToken_table,$post_notification_table,$documents_category_table,$documents_table,$messages_table,$messages_table_delete); |
| 123 |
foreach($tables as $table) { |
| 124 |
$sql = "DROP TABLE IF EXISTS $table"; |
| 125 |
$wpdb->query($sql); //Delete tables |
| 126 |
} |
| 127 |
} |
| 128 |
} ?> |