I am quite new to wordpress and I am on my path to create my first plugin. I want to add a feature to my plugin, that I can read queried data from the wordpress db. I have already written a function to process the user data from wordpress, and echo them as json.
function process_data($type, $sdate, $edate) { $data = array(); global $wpdb; if($type == 'overview' || $type == 'users') { $data[date('Y-m-d', strtotime($sdate))]['users'] = 0; $daily_users = $wpdb->get_results("SELECT COUNT(*) as cnt, DATE(user_registered) dte FROM $wpdb->users WHERE user_registered>='".date('Y-m-d', strtotime($sdate))."' AND user_registered<='".date('Y-m-d', strtotime($edate))."' GROUP BY dte"); foreach($daily_users as $value) { $date = str_replace('-', '', $value->dte); $data[$date]['users'] = $value->cnt; } } echo json_encode($data); } However, how to read them with an external application. Any ideas how to call this function?
I would appreciate your answer!