• Resolved dhartendorp

    (@dhartendorp)


    Hello,

    i have seen an inquiry before about this very same topic. However it did not go into details on how this was resolved.

    I can’t seem to sync roles. I can’t find the API name in wordpress.

    I use a plugin called User Role Editor and i believe it has something to do with this.

    I do not have wp_capabilities available.

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

    (@jonathanstegall)

    Hm, so the User Role Editor plugin does store its data in the wp_capabilities field of the wp_usermeta table. Are you saying you don’t see that field in this plugin’s dropdown of fields to map? Here’s a screenshot of what I see, when I try to run a quick test.

    Here are the steps I ran:

    1. Install User Role Editor
    2. Make some test users, and assign more than one role to at least one user.
    3. Install Object Sync for Salesforce (and make sure the plugin cache is cleared, if it was already installed!)
    4. Go to create a fieldmap. Check the WordPress dropdown, and I see wp_capabilities as a field that can be mapped.

    If you follow those steps and you don’t see wp_capabilities, that seems to me like a bigger issue than this plugin. Since wp_capabilities is a core field to WordPress, your install might be broken.

    Thread Starter dhartendorp

    (@dhartendorp)

    It seems my Wp database added some weird prefix to the entire database.

    For instance, im seeing

    wp_gge981bigroups_capability

    pulled it from phpmyadmin

    Plugin Author Jonathan Stegall

    (@jonathanstegall)

    Interesting. I’ve seen that with table names, but I don’t think I’ve seen it with field names. Are you saying it is also renaming the field to “capability” instead of “capabilities”? That definitely isn’t a standard name and I guess I wouldn’t be surprised if it caused other problems, but if it has the right data, you could try it.

    What WordPress stores in the wp_capabilities field looks like this (in this example, for a user who is a Subscriber and a Contributor): a:2:{s:10:"subscriber";b:1;s:11:"contributor";b:1;}. So WordPress stores an array that has been serialized.

    Thread Starter dhartendorp

    (@dhartendorp)

    I found Wp_capabilities

    It’s called wp_gge981bicapabilities and is selectable in the fieldmap field.

    I made a multiple select list with the names i have for all my roles in Salesforce
    and mapped that against the wp_capabilities

    sadly it does not work as there is no data exchange

    Thread Starter dhartendorp

    (@dhartendorp)

    Sorry,

    i named the roles exactly alike in salesforce and wordpress. its a multiple picklist in salesforce.

    • This reply was modified 2 years, 5 months ago by dhartendorp.
    Plugin Author Jonathan Stegall

    (@jonathanstegall)

    No, you don’t need to match with a number. If you’re trying to sync roles from the wp_capabilities field, you need to:

    1. Make sure that you have the right WordPress field (it seems like you do).
    2. Make sure at least one user has data for that field, and clear the plugin cache so you can map it it seems like maybe you’ve already done this as well).
    3. Make sure you have the type of Salesforce field that can match to this field.

    I think you’ve run into a plugin bug though, with the custom prefix on your field. The plugin looks for wp_capabilities and tries to handle it to make it easier, but without knowing why your installation has a different prefix, I think you wouldn’t be getting that.

    I’d like to see if the issue fixes itself if you use this pull request: https://github.com/MinnPost/object-sync-for-salesforce/pull/501

    If it does, I’ll release a plugin update with it soon. Are you able to test and see if it does?

    Thread Starter dhartendorp

    (@dhartendorp)

    So i got it to push wp_capabilities.
    i changed the pick list with limited values to unlimited values.

    It doesnt pick up one of the excisting names but it does add a value. and in my example a 1 as name and API-name as 1 aswell.

    Thread Starter dhartendorp

    (@dhartendorp)

    I’ve managed to link capabilities to an open multiple picklist. fieldmap wordpress to salesforce.

    it returns 1;1;1;1;1;1;1;1;1;1;1 for all selected roles.

    I did define the roles in salesforce but it doesnt match them.

    Plugin Author Jonathan Stegall

    (@jonathanstegall)

    I ran a quick test to see what happens when I use this plugin. Here’s what I’ve done:

    1. Install User Role Editor
    2. Create a User Roles Multi-picklist field on the contact in Salesforce. I’ve made some screenshots to show what it looks like: Field Information; General Options; and Values. You can see I’ve added the default WordPress roles as the only options.
    3. Create a new fieldmap that maps the user to the contact. Here are Fields and action information screenshots.
    4. I created a new WordPress user with Subscriber and Editor roles. See screenshot.
    5. This new user has Subscriber and Editor roles in Salesforce. see screenshot.
    6. I’m able to add and edit the roles for this user both on the Salesforce side and the WordPress side.

    I’m not really able to tell if you have different settings on your Salesforce field, or maybe a different way of using the User Role Editor plugin, but this all seems to work for me so maybe you can use that to get you in the right direction.

    I don’t really do additional work for specific plugins unless there’s a bug, or a specific thing that would easily provide the kind of support necessary, and as far as I can tell that doesn’t seem to be the case here.

    Thread Starter dhartendorp

    (@dhartendorp)

    View post on imgur.com

    Hi,

    thanks again for all the help. It is much appreciated.

    It seems the fieldmap doesnt decode properly.
    It seems something gets lost in translation of the roles or the API names.

    Im not sure what it is. Since i run the dutch version. However, roles grabbed from the database show the names as i linked them in my screenshots.

    I assume API names should be used but i might be mistaken.

    Im going to bring down the amount of user roles to see if i can narrow it down.

    Thread Starter dhartendorp

    (@dhartendorp)

    Update:

    I shortend the list and did a pull from salesforce.

    it created rights for the user in that role with 0,1,2,3 etc. instead of giving it the role it should.

    If i push to salesforce it keeps holding on to that “1” value.

    Plugin Author Jonathan Stegall

    (@jonathanstegall)

    I don’t think there’s much I can offer in this forum, unless you can identify what is different about your setup compared to the screenshots I posted earlier. I think I’d recommend that you run some error logs throughout the sync process to see where the data is being formatted incorrectly.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Syncing Roles’ is closed to new replies.