pigneedle
Forum Replies Created
-
Yes. You are probably experiencing a conflict from other plugins if there is still an issue.
Note: make sure to disable caching while applying this fix. You may re-enable caching after the fix has been applied.
The changes I posted are still currently deployed on my site and functioning properly. @zzb I am not sure what issue you are experiencing, but this issue is resolved for me using the fix I posted above.
In “um-actions-user.php” I changed these lines:
/*** *** @sync with WP role ***/ add_action('um_after_user_role_is_updated','um_setup_synced_wp_role', 50, 2); function um_setup_synced_wp_role( $user_id, $role ) { global $ultimatemember; $meta = $ultimatemember->query->role_data( $role ); $meta = apply_filters('um_user_permissions_filter', $meta, $user_id ); $wp_user_object = new WP_User( $user_id ); if ( isset( $meta['synced_role'] ) && $meta['synced_role'] ) { $wp_user_object->add_role( $meta['synced_role'] ); }elseif( ! $wp_user_object->roles ) { // Fallback user default role if nothing set $wp_user_object->add_role( 'subscriber' ); } }
to:
/*** *** @sync with WP role ***/ add_action('um_after_user_role_is_updated','um_setup_synced_wp_role', 50, 2); function um_setup_synced_wp_role( $user_id, $role ) { global $ultimatemember; $meta = $ultimatemember->query->role_data( $role ); $meta = apply_filters('um_user_permissions_filter', $meta, $user_id ); $wp_user_object = new WP_User( $user_id ); if ( isset( $meta['synced_role'] ) && $meta['synced_role'] ) { $wp_user_object->set_role( $meta['synced_role'] ); }elseif( ! $wp_user_object->roles ) { // Fallback user default role if nothing set $wp_user_object->set_role( 'subscriber' ); } }
It looks like roles are syncing properly now.
Ok, I’ve done a bit of testing now that the site has less traffic on it.
1. I create a new user with a form to automatically register a user with the “PRO” role. This is set to auto-approve registration.
2. I am auto-logged in as the new user (desired functionality). On the WP Users list, I see the new user, but it has two roles assigned: “Subscriber” and “Wholesale”. The pricing deals associated with this user are not reflected in WooCommerce. I log out and then back into WP with the new user. Pricing deals are still not reflected.
3a. I go into the UM admin panel, select the “PRO” role, and click “Sync with WordPress Role”. I cannot see the pricing deals for that user’s role just by refreshing the page after I click this button.
3b. I log out and then back into WP with the new user. I can now see the pricing deals.
I have tried disabling all other plugins to isolate the issue, but I see this behavior by default. Is there a way to automatically perform the “Sync with WordPress Role” function after a user registers? Is the plugin supposed to do this by default, or is it necessary to manually click the “Sync” button every time a user registers?
As I mentioned in the original message, I have already setup the “Sync with WordPress Role” and set a WordPress role in the “Link to WordPress role” drop-down. The only plugin we have that interacts at all with Ultimate Member is the “Pricing Deals Rules” plugin from VarkTech, which I will test tonight when there is less traffic on the site. We are using the latest version of Ultimate Member (1.3.88).
- This reply was modified 7 years, 5 months ago by pigneedle.