update( AFF_WC_TABLE , array( 'referral_amount' => $_POST['referral_amount'] ), array( 'id' => $_POST['referrer_id'] ), array( '%d' ), array( '%d' ) ); if($update_table){ add_action( 'admin_notices', self::data_insert__success() ); }else{ add_action( 'admin_notices', self::data_insert__fails() ); } } } if ( isset( $_POST['delete'] ) ) { if ( wp_verify_nonce( $_POST[NONCE], SET_ADMIN_OPTIONS ) ) { $delete_data = $wpdb->delete( AFF_WC_TABLE , array( 'ID' => $_POST['referrer_id'] ) ); if($delete_data){ add_action( 'admin_notices', self::data_delete__success() ); }else{ add_action( 'admin_notices', self::data_delete__fails() ); } } } $query = 'SELECT * FROM '.AFF_WC_TABLE.' ;'; $referral_lists = $wpdb->get_results($query , ARRAY_A); $output = ''; $output .= '

'.__( 'Modify / Delete Affiliates Referrals', AFF_REF_WC_INTEGRATION_PLUGIN_DOMAIN ).'

'; if ( !current_user_can( 'edit_theme_options' ) ) { wp_die( __( 'Access denied.', AFF_REF_WC_INTEGRATION_PLUGIN_DOMAIN ) ); } if( !empty($referral_lists) ): $counter = 1; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; foreach( $referral_lists as $referral_list ){ $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= wp_nonce_field( SET_ADMIN_OPTIONS, NONCE, true, false ); $output .= ''; $output .= ''; $output .= ''; $counter++; } $output .= '
S NOAffiliate IDAffiliate NameReferral Amount
'.$counter.''.$referral_list['affiliate_id'].''.$referral_list['affiliate_name'].'
'; else: $output .= '
No Data to Display
'; endif; echo $output; } public static function data_insert__success() { echo '

'. __( 'Data Updated Successfully !', AFF_REF_WC_INTEGRATION_PLUGIN_DOMAIN ).'

'; } public static function data_insert__fails() { echo '

'. __( 'Failed to Update Data!!!!', AFF_REF_WC_INTEGRATION_PLUGIN_DOMAIN ).'

'; } public static function data_delete__success() { echo '

'. __( 'Data Deleted Successfully !!!!', AFF_REF_WC_INTEGRATION_PLUGIN_DOMAIN ).'

'; } public static function data_delete__fails() { echo '

'. __( 'Failed to delete Data!!!!', AFF_REF_WC_INTEGRATION_PLUGIN_DOMAIN ).'

'; } public static function init(){ add_action('admin_menu', array(__CLASS__, 'affiliate_woocommerce_referral_edit_menu')); } public static function affiliate_woocommerce_referral_edit_menu(){ add_submenu_page('aff-admin-referrals-wc-integration','Affiliates WooCommerce Refferal Edits' , 'Referral Edits', 'edit_theme_options' , 'aff-wc-referral-edits' , array( __CLASS__, 'edit_affiliates_referrals_options' ) ); } } Admin_Affiliates_Referral_Edits::init(); endif; ?>