Changeset 2781900
- Timestamp:
- 09/08/2022 11:21:27 AM (4 years ago)
- Location:
- wp-users-disable/trunk
- Files:
-
- 3 edited
-
admin-option.php (modified) (2 diffs)
-
ajax.js (modified) (1 diff)
-
custom-ajax.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-users-disable/trunk/admin-option.php
r2775544 r2781900 47 47 48 48 $nonce = wp_create_nonce( 'disable_user_nonce' ); 49 echo '<a class=" button-primary" data-nonce="'.$nonce.'" id="' . esc_attr( $value['id'] ) . '" style="float: left; margin: 75px 0px 0px;" />Disableuser</a><br/>';49 echo wp_kses_post( '<a class=" button-primary" data-nonce="' . $nonce . '" id="' . esc_attr( $value['id'] ) . '" style="float: left; margin: 75px 0px 0px;" />Disableuser</a><br/>' ); 50 50 51 51 } … … 152 152 if ( count( $getresult ) > 0 ) { 153 153 foreach ( $getresult as $result ) { 154 155 $output .= "<tr id='userid" . $result->id . "'>"; 156 157 $output .= '<td>' . $result->id . '</td>'; 158 $output .= '<td>' . $result->useremail . '</td>'; 159 $output .= "<td><a href='javascript:void(0)' id=" . $result->id . '>Enable User</a></td>'; 154 $nonce = wp_create_nonce( 'enable_user_nonce' ); 155 $output .= "<tr id='userid" . $result->id . "'>"; 156 $output .= '<td>' . $result->id . '</td>'; 157 $output .= '<td>' . $result->useremail . '</td>'; 158 $output .= "<td><a href='javascript:void(0)' data-enb-nonce=" . $nonce . ' id=' . $result->id . '>Enable User</a></td>'; 160 159 161 160 $output .= '</tr>'; -
wp-users-disable/trunk/ajax.js
r2775544 r2781900 95 95 data: { 96 96 action: 'dwul_enable_user_email', 97 nonce_data: jQuery(this).data('enb-nonce'), 97 98 activateuserid: acivateid 98 99 }, -
wp-users-disable/trunk/custom-ajax.php
r2775544 r2781900 32 32 global $wpdb; 33 33 global $disableemail; 34 if ( !wp_verify_nonce($_REQUEST['nonce_data'], 'disable_user_nonce') ){ 35 $successresponse = '90'; 36 echo esc_html( $successresponse ); 34 $disable_nonce = isset( $_REQUEST['nonce_data'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['nonce_data'] ) ) : ''; 35 if ( ! wp_verify_nonce( $disable_nonce, 'disable_user_nonce' ) ) { 36 $successresponse = '90'; 37 echo esc_html( $successresponse ); 37 38 die(); 38 }39 } 39 40 $exitingarray = array(); 40 41 $disableemail = isset( $_REQUEST['useremail'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['useremail'] ) ) : ''; 41 $table_name = $wpdb->prefix . dwul_disable_user_email;42 $exitingusertbl = $wpdb->prefix . users;42 $table_name = $wpdb->prefix . "dwul_disable_user_email"; 43 $exitingusertbl = $wpdb->prefix . "users"; 43 44 $exitinguserquery = "SELECT user_email FROM $exitingusertbl"; 44 45 $getexiting = $wpdb->get_col( $exitinguserquery ); … … 87 88 global $wpdb; 88 89 $array = array(); 89 $usertable = $wpdb->prefix . dwul_disable_user_email;90 $usertable = $wpdb->prefix . "dwul_disable_user_email"; 90 91 91 92 if ( ! $user ) { … … 134 135 135 136 global $wpdb; 136 $tblname = $wpdb->prefix . dwul_disable_user_email; 137 $enable_nonce = isset( $_REQUEST['nonce_data'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['nonce_data'] ) ) : ''; 138 if ( ! wp_verify_nonce( $enable_nonce, 'enable_user_nonce' ) ) { 139 $successresponse = '90'; 140 echo esc_html( $successresponse ); 141 die(); 142 } 143 $tblname = $wpdb->prefix . "dwul_disable_user_email"; 137 144 $activateuserid = isset( $_REQUEST['activateuserid'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['activateuserid'] ) ) : ''; 138 145 $delquery = $wpdb->query( $wpdb->prepare( "DELETE FROM $tblname WHERE id = %d", $activateuserid ) );
Note: See TracChangeset
for help on using the changeset viewer.