Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function wpf_ontraport_field( $args ) {
- if( ! function_exists( 'wp_fusion' ) ) {
- return;
- }
- $contact_id = wp_fusion()->user->get_contact_id();
- if( empty( $contact_id ) ) {
- return false;
- }
- $params = wp_fusion()->crm->get_params();
- $url = "https://api.ontraport.com/1/object?objectID=0&id=" . $contact_id;
- $response = wp_remote_get( $url, $params );
- $body_json = json_decode( $response['body'], true );
- if( isset( $body_json['data'][ $args['field'] ] ) ) {
- return $body_json['data'][ $args['field'] ];
- }
- }
- add_shortcode( 'wpf_ontraport_field', 'wpf_ontraport_field' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement