• Resolved edward01s2

    (@edward01s2)


    Is there a hook or a way to set the user_pass in WordPress from a mapped field from Salesforce when a new user is created from a Contact in Salesforce?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Jonathan Stegall

    (@jonathanstegall)

    Currently this does not exist in the plugin. I don’t think I’d add a way to store a plain-text password in another system and then pass it into WordPress.

    Thread Starter edward01s2

    (@edward01s2)

    Yeah that’s probably best. How would I, after the new user is saved in WP run a function based on the new user id and save that result to the user. I tried using ‘object_sync_for_salesforce_pull_success’ but that doesn’t run after a new user is created.

    Plugin Author Jonathan Stegall

    (@jonathanstegall)

    Hm well there is a object_sync_for_salesforce_set_more_user_data hook. You might be able to use that? There’s a bit of documentation on it.

    Thread Starter edward01s2

    (@edward01s2)

    Not sure if I’m using that function right…

    
    add_action( 'object_sync_for_salesforce_set_more_user_data', 'save_more_my_user', 10, 3 );
    function save_more_my_user( $user_id, $params, $action ) {
      $rp_key = get_reset_key( $user_id );
      $result = array(
        'data'   => array(
            'rp_key' => $rp_key,
        ),
      );
      return $result;
    }
    

    rp_key is a field on the usermeta table.
    Also what is the best way to see variable values from these functions?

    Plugin Author Jonathan Stegall

    (@jonathanstegall)

    Well, in this case it the hook you’re using isn’t a filter, it’s an action. There’s a helpful answer about the differences, but mainly you should know that an action doesn’t take a return value. That is, the plugin isn’t going to do anything with the action result. Probably the documentation should be more clear about this (but in any case, we don’t really provide support for the developer hooks). I’d be happy to add the example of whatever you’re doing with it if you get it working to the docs though, if you’d want to add a pull request.

    But in other words, you have to use your function to perform any other actions you want to perform with those variables, rather than relying on the plugin to do something with it for you.

    As for seeing the values, the best way is to do something like error_log( print_r( $params, true ) ); or error_log( 'user id is ' . $user_id ); depending on which you want to see.

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

The topic ‘Set user_pass on Contact Sync’ is closed to new replies.