Jump to content

MushMX

New Members
  • Posts

    9
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

MushMX's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Ill figure out with a javascript function (set on the properly site on the code in order to avoid a infinite loop) This is the solution: Hyper link class with ID name in order to we can call it with a function. The original page loads, and retrieve the ID that we need. Then wild script appears and "click" the link quickly, then load the page automatically performing the redirect and that's all, many thanks for the interest. <a class="color_black" id="btn" href="?dashboard=user&page=member&tab=viewmember&action=view&member_id=<?php echo esc_attr($retrieved_data->ID)?>"> <script> window.onload = function(){ document.getElementById('btn').click(); } </script>
  2. requires member id and can only be retrieved from a page first, there's non a static link changes depending on the member id
  3. Hi i need to perform an automatic redirect. sp when the page loads, automatically redirect to another one by using a special function: ?dashboard=user&page=member&tab=viewmember&action=view&member_id=<?php echo esc_attr($retrieved_data->ID);?> but i dont know how can figure out this any ideas? best regards
  4. i tried, but doesn’t fit with this code (is part of bigger code on wordpress) and corrupts all page. probably im doing it wrong, how do you integrate the download part on this code?
  5. Hi, I hope everyone is having a great day. Today i have an issue related with a CSV download/export This is the code error_reporting(0); global $wpdb; $obj_membership=new MJ_gmgt_membership; $membershipdata=$obj_membership->MJ_gmgt_get_all_membership(); $obj_product=new MJ_gmgt_product; $product = $obj_product->MJ_gmgt_get_single_product($retrieved_data->product_id); if(!empty($membershipdata)) { $filename="Membership Report.csv"; $fp = fopen($filename, "w"); // Get The Field Name $output=""; $header = array(); $header[] = esc_html__('Id','gym_mgt'); $header[] = esc_html__('Invoice No.','gym_mgt'); $header[] = esc_html__('Member Name','gym_mgt'); $header[] = esc_html__('Product Name','gym_mgt'); $header[] = esc_html__('Total Amount','gym_mgt'); $header[] = esc_html__('Paid Amount','gym_mgt'); $header[] = esc_html__('Due Amount','gym_mgt'); $header[] = esc_html__('Payment Status','gym_mgt'); fputcsv($fp, $header); $i=1; $membership_id = $membershipdata->membership_id; $user = get_users(array('role' => 'member')); $invoice_no=$retrieved_data->invoice_no; foreach ($storedata as $retrieved_data) { $membership = $obj_membership->MJ_gmgt_get_single_membership($user_data->membership_id); $membership_name = $membership->membership_label; $row = array(); $row[] = $i; $row[] = $retrieved_data->invoice_no; $row[] = $userdata->display_name; $row[] = $product_name; $row[] = $retrieved_data->total_amount; $row[] = $retrieved_data->paid_amount; $row[] = $due_amount; $row[] = $retrieved_data->payment_status; $i++; fputcsv($fp, $row); } // Download the file fclose($fp); ?> <?php } ?> <div class="margin_top_20 form-group col-md-4 col-xs-12 button-possition "> <a class="btn report_download_btn" href='<?php echo $filename;?>'><?php esc_html_e('Download Report In CSV','gym_mgt');?></a> </div> Basically is exporting the CSV, but is opening itself on the web browser instead of get a downloadable file Thanks in advance for your time and help best regards!
  6. share your ideas, even if you think couldnt work, probably could help. as something that happen, on the for each (user as userdata) if i change, the csv stop throw results, and if i switch userdata for another value the USERNAME result change, for example if i set user as invoice_no the user name get switched to 00005 but its still only displaying last result only. i dont know how figure out this
  7. Honestly me neither :S its not my own code im trying to adapt a function that is missing , and accomplish almost all, except enlist all rows :S but your code could be an option i will try it, but idk if i need the sql connection, since with my code the connection with tables is already open without use the login details on plain text, however if i cant move forward, i think i can use this. My only concern is WHY i cant enlist all just last result, and its particullar thats only last one, not the first for example
  8. Basically export this information: Into a csv file. this get filed names: // Get The Field Name $output=""; $header = array(); $header[] = esc_html__('Id','gym_mgt'); $header[] = esc_html__('Invoice No.','gym_mgt'); $header[] = esc_html__('Member Name','gym_mgt'); $header[] = esc_html__('Product Name=>Product Quantity','gym_mgt'); $header[] = esc_html__('Total Amount','gym_mgt'); $header[] = esc_html__('Paid Amount','gym_mgt'); $header[] = esc_html__('Due Amount','gym_mgt'); $header[] = esc_html__('Payment Status','gym_mgt'); and this one (where i personally think the problem is, but i dont know where) enlist all information and export it to a csv $i=1; $membership_id = $membershipdata->membership_id; $user = get_users(array('role' => 'member')); $forechid = $retrieved_data->invoice_no; foreach ($user as $user_data) { $membership = $obj_membership->MJ_gmgt_get_single_membership($user_data->membership_id); $membership_name = $membership->membership_label; $row = array(); $row[] = $i; $row[] = $retrieved_data->invoice_no; $row[] = $user_data->display_name; $row[] = $product_name; $row[] = $retrieved_data->total_amount; $row[] = $retrieved_data->paid_amount; $row[] = $due_amount; $row[] = $retrieved_data->payment_status; $i++; fputcsv($fp, $row); } // Download the file fclose($fp); ?> <?php } ?> the final result on the csv is: as you can see, meets only the last table result, and its skipinng the first one. i need help making the csv enlist ALL results, not only the last one
  9. Hi everyone, I have a code issue, below you will find a portion of code. the code works "fine"partially, because only deliver a CSV with the latest value of the table only. in this case i have 3 registry values, but the code only deliver last one, the others are not delivered or included. could you please help me out to make csv deliver all results on my table please? or give me ideas to do this? thanks in advance best regards, and many thanks to read and take time to check this <?php error_reporting(0); global $wpdb; $obj_membership=new MJ_gmgt_membership; $membershipdata=$obj_membership->MJ_gmgt_get_all_membership(); $obj_product=new MJ_gmgt_product; $product = $obj_product->MJ_gmgt_get_single_product($retrieved_data->product_id); if(!empty($membershipdata)) { $filename="Membership Report.csv"; $fp = fopen($filename, "w"); // Get The Field Name $output=""; $header = array(); $header[] = esc_html__('Id','gym_mgt'); $header[] = esc_html__('Invoice No.','gym_mgt'); $header[] = esc_html__('Member Name','gym_mgt'); $header[] = esc_html__('Product Name=>Product Quantity','gym_mgt'); $header[] = esc_html__('Total Amount','gym_mgt'); $header[] = esc_html__('Paid Amount','gym_mgt'); $header[] = esc_html__('Due Amount','gym_mgt'); $header[] = esc_html__('Payment Status','gym_mgt'); fputcsv($fp, $header); $i=1; $membership_id = $membershipdata->membership_id; $user = get_users(array('role' => 'member')); $forechid = $retrieved_data->invoice_no; foreach ($user as $user_data) { $membership = $obj_membership->MJ_gmgt_get_single_membership($user_data->membership_id); $membership_name = $membership->membership_label; $row = array(); $row[] = $i; $row[] = $retrieved_data->invoice_no; $row[] = $user_data->display_name; $row[] = $product_name; $row[] = $retrieved_data->total_amount; $row[] = $retrieved_data->paid_amount; $row[] = $due_amount; $row[] = $retrieved_data->payment_status; $i++; fputcsv($fp, $row); } // Download the file fclose($fp); ?> <?php } ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.