abdullahihussein1995
Forum Replies Created
-
Thanks for your reply.
I did the corrections you sent me. I’m now not getting any errors, but however the variable doesn’t return anything. I need that variable to convert my currency into euros but it doesn’t work.
I don’t know what I’m doing wrong. The plugin is active already.
Thanks for your help.
Please help me.
This is the error am getting
2022-07-31T23:20:25+00:00 CRITICAL Uncaught Error: Call to a member function get_currencies() on null in /srv/users/libbloom/apps/libertybloom/lib_new/web/app/themes/parallax-pro/functions.php:1441
On my local the code works but on the live site I get errors
function event_api_post_callback( $request ) {
global $event;
$event_data = array(
‘post_type’ => ‘tc_events’,
‘post_title’ => $request[‘event_name’],
‘post_content’ => $request[‘event_terms’],
‘post_status’ => ‘publish’);
$events = new TC_Events();
$event = wp_insert_post( $event_data );
if( !is_wp_error($event_data) ) {
$response[‘status’] = 200;
$response[‘success’] = true;
update_post_meta( $event, ‘event_location’, $request[‘event_location’]);
update_post_meta( $event, ‘event_date_time’, $request[‘event_date_time’]);
update_post_meta( $event, ‘event_end_date_time’, $request[‘event_end_date_time’]);
update_post_meta( $event, ‘event_terms’, $request[‘genre’]);
update_post_meta( $event, ‘event_logo’, $request[‘event_logo’]);
wp_set_object_terms( $event, $request[‘event_category’], ‘event_category’ );
get_post_meta( $event, ‘tc_speakers’);
update_post_meta( $event, ‘tc_speakers’, $request[‘speaker_tags’]);
update_post_meta( $event, ‘tc_speakers_show_type’, ‘shortcode’);
update_post_meta( $event, ‘tc_speakers_view’, ‘tc_list’);
update_post_meta($event, ‘tc_speakers_grid_show_cats’, ‘no’);
update_post_meta($event, ‘event_datetime_utc’, $request[‘event_end_time_utc’]);
update_post_meta($event, ‘event_logo_file_url’, $request[‘timezone’]);fifu_dev_set_image($event, ‘https://youbloomconnect.com/storage/event_photo/’.$request[‘event_logo’]);
$permalink = get_permalink($event);
$p_id = get_post($event);
$status = ‘draft’;global $WOOCS;
$currencies=$WOOCS->get_currencies();
$converted_currency = $WOOCS->back_convert($request[‘price’],$currencies[$request[‘currency’]][‘rate’],0);$response[‘permalink’] = $converted_currency;
$response[‘ID’] = $p_id;
$response[‘converted_currency’] = $converted_currency;global $wpdb;
$where = array( ‘ID’ => $event );
$data = array(‘post_status’=>’draft’);
$wpdb->update( $wpdb->posts, $data, $where );} else {
$response[‘status’] = 200;
$response[‘success’] = false;
$response[‘data’] = get_post( $events );
}return new WP_REST_Response($response);
// }
}