Is it possible to synch users by role?

I would like to only synch users of a certain type role on to the subsite is it possible?

  • Vaughan
    • Support/SLS MockingJay

    Hi @Pixel Fuel,

    This isn't currently possible out of the box and would require some custom code.

    I haven't tested this at all, but you could try the following.

    Open user-sync.php

    Find around line 405

    $rows = $wpdb->get_results( "SELECT ID FROM {$wpdb->base_prefix}users" );

    Replace with

    $rows = $wpdb->get_results( "SELECT users.ID, usermeta.{$wpdb->base_prefix}capabilities FROM {$wpdb->base_prefix}users
                 INNER JOIN {$wpdb->base_prefix}usermeta ON users.ID = usermeta.user_id
                     WHERE usermeta.{$wpdb->base_prefix}capabilities LIKE '%administrator%'" );

    change administrator for any capability.

    Hopefully that should then only synch those users. But as stated, I haven't tested this.

    Hope this helps

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.