Message notification for user

You need to use wp_ajax action to callback your function. add_action( ‘wp_ajax_update_last_seen_value’, ‘update_last_seen_value’ ); function update_last_seen_value() { global $wpdb; $table=”ej_users”; $id = $_POST[‘id’]; $meta_value = date(‘Y-m-d H:i:s’); update_user_meta( $id , ‘last_seen’, $meta_value ); $data = array( “status” => ‘success’ ); echo json_encode($data); die(); } I have used your code and made correction to render scenario … Read more

Error sending array data from php to javascript

Your PHP code shows: $organizations = get_user_meta($current_user_id, ‘organizations’); The signature for this function is: get_user_meta( int $user_id, string $key = ”, bool $single = false ) Note the last argument. When you used this function, you omitted the last argument; therefore, the default was used. The default is false meaning that the value will be … Read more