Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hey @kirtiraj, you need to register a custom connection that will add the ‘authors’ field to the Post object in GraphQL. In the resolve callback you would just pass the result of the get_coauthors function to the resolver query, which is essentially a WP_User_Query.

    
    add_action( 'graphql_register_types', 'register_authors_connection' );
    
    function register_authors_connection() {
        if ( function_exists( 'get_coauthors' ) ) {
            register_graphql_connection(
                [
    		'fromType'           => 'Post',
    		'toType'             => 'User',
    		'fromFieldName'      => 'authors',
    		'connectionTypeName' => 'AuthorsToPostConnection',
    		'resolve'            => function ( Post $source, $args, $context, $info ) {
    			$resolver = new UserConnectionResolver( $source, $args, $context, $info );
    			$coauthor_ids = array_map(
                                function( $coauthor ) {
                                    return $coauthor->ID;
                                },
                                get_coauthors( $source->postId )
                            );
    
    			$resolver->set_query_arg( 'include', $coauthor_ids );
    			return $resolver->get_connection();
                    },
                ]
            );
        }
    }
    

    Hi @howiehwbd,

    when you create the form handler on Pardot, make sure that the “Enable data forwarding to the success location” setting is enabled, that worked for me 🙂

    Make sure you also delete the fake user 🙂

    Are you using the WP GDPR Compliance plugin?
    Apparently the security issue is related to that plugin. However they released a fix in version 1.4.3.
    Make sure you update the plugin to the latest version.

Viewing 4 replies - 1 through 4 (of 4 total)