• Resolved mariusgh

    (@mariusgh)


    Hi,

    Thank you for creating this plugin, it is very useful.

    I am trying to extend it so that I can send data from Learn Dash and Gravity Forms plugins from WordPress to Salesforce.

    For Learn Dash, part of the data appears in the default list of objects and fields as options on the WordPress part, ex: lessons, and the sync is working.

    What doesn’t appear is learn dash activity.
    1. My goal is to sync ‘wp_learndash_user_activity’ table in Salesforce, each field from this table to a field in SF object.

    To do this I have added in functions the following code:

    add_filter( 'object_sync_for_salesforce_add_more_wordpress_types', 'add_more_types', 10, 1 );
    function add_more_types( $wordpress_object_types ) {
        $wordpress_object_types[] = 'learndash-activity'; //this is the object in discussion now. 
        $wordpress_object_types[] = 'counties';
        $wordpress_object_types[] = 'cities';
        $wordpress_object_types[] = 'schools';
        $wordpress_object_types[] = 'teacher-types';
        $wordpress_object_types[] = 'gravity-forms';
        return $wordpress_object_types; 
    }

    Then this for fields:

    add_filter( 'object_sync_for_salesforce_wordpress_object_fields', 'add_field', 10, 2 );
    function add_field( $object_fields, $wordpress_object ) {
        $object_fields['data'][] = array(
            'key' => 'activity_id',
            'table' => 'wp_learndash_user_activity',
            'methods' => array (
                'create' => 'learndash_update_user_activity',
                'read' => 'learndash_get_user_activity',
                'update' => 'learndash_update_user_activity',
                'delete' => 'learndash_delete_user_activity'
            ),
        );
        $object_fields['data'][] = array(
            'key' => 'user_id',
            'table' => 'wp_learndash_user_activity',
            'methods' => array (
                'create' => 'learndash_update_user_activity',
                'read' => 'learndash_get_user_activity',
                'update' => 'learndash_update_user_activity',
                'delete' => 'learndash_delete_user_activity'
            ),
        );
        $object_fields['data'][] = array(
            'key' => 'post_id',
            'table' => 'wp_learndash_user_activity',
            'methods' => array (
                'create' => 'learndash_update_user_activity',
                'read' => 'learndash_get_user_activity',
                'update' => 'learndash_update_user_activity',
                'delete' => 'learndash_delete_user_activity'
            ),
        );
        $object_fields['data'][] = array(
            'key' => 'course_id',
            'table' => 'wp_learndash_user_activity',
            'methods' => array (
                'create' => 'learndash_update_user_activity',
                'read' => 'learndash_get_user_activity',
                'update' => 'learndash_update_user_activity',
                'delete' => 'learndash_delete_user_activity'
            ),
        );
        $object_fields['data'][] = array(
            'key' => 'activity_status',
            'table' => 'wp_learndash_user_activity',
            'methods' => array (
                'create' => 'learndash_update_user_activity',
                'read' => 'learndash_get_user_activity',
                'update' => 'learndash_update_user_activity',
                'delete' => 'learndash_delete_user_activity'
            ),
        );
    
        $object_fields['data'][] = array(
            'key' => 'activity_started',
            'table' => 'wp_learndash_user_activity',
            'methods' => array (
                'create' => 'learndash_update_user_activity',
                'read' => 'learndash_get_user_activity',
                'update' => 'learndash_update_user_activity',
                'delete' => 'learndash_delete_user_activity'
            ),
        );
    
        $object_fields['data'][] = array(
            'key' => 'activity_completed',
            'table' => 'wp_learndash_user_activity',
            'methods' => array (
                'create' => 'learndash_update_user_activity',
                'read' => 'learndash_get_user_activity',
                'update' => 'learndash_update_user_activity',
                'delete' => 'learndash_delete_user_activity'
            ),
        );
    
        $object_fields['data'][] = array(
            'key' => 'activity_updated',
            'table' => 'wp_learndash_user_activity',
            'methods' => array (
                'create' => 'learndash_update_user_activity',
                'read' => 'learndash_get_user_activity',
                'update' => 'learndash_update_user_activity',
                'delete' => 'learndash_delete_user_activity'
            ),
        );
    
        return $object_fields;
    }

    Now, the object appears in admin dropdown. Fields as well.

    I created a field map with an object in SF and corresponding fields in no data is sent to salesforce.

    To test the connection, I have a sync for users as well, which works as expected.

    Initially I though that the methods are wrong, but after digging deeper into learn dash plugin I don’t think they are.

    Am I missing something in this process of adding custom objects and fields?

    Next on the list is content from Gravity Forms tables, but here I have a hard time identifying the methods, for now.

    Any hint will help.

    Thank you!

    • This topic was modified 4 years, 8 months ago by mariusgh.
Viewing 1 replies (of 1 total)
  • Plugin Author Jonathan Stegall

    (@jonathanstegall)

    We don’t really provide support for the developer hooks, but if you can identify a problem with them or ways to improve them, do add an issue or pull request on GitHub.

Viewing 1 replies (of 1 total)
  • The topic ‘Sync Learn Dash and Gravity forms tables from WP to SF’ is closed to new replies.