• Resolved Mwiinga

    (@rodgerrmi)


    I have a situation.
    I have Site A, “siteA.com” which is up & running, with already existing users.
    I have setup site B, with the address “siteA.com/siteB” and it’s up and running just fine. Site B is picking up & using the USERS from Site A.

    Now, the situation is, when a user’s role’s updated to ‘Vendor,’ on Site B, there Vendor Shop is in error. It will not update, open or do anything.

    But when I manually create a new user on this Site B, everything works just fine.

    QUESTION,
    Why is this plugin failing to recognition an existing user as a Vendor?
    Thank you..

Viewing 14 replies - 1 through 14 (of 14 total)
  • Hi @rodgerrmi, sorry to hear that.

    Can you please provide us a few more information :
    – what is the role of Vendor in site A?
    – also can you share a screenshot of the error, so we can help you out further?

    We will wait for your reply.

    Thread Starter Mwiinga

    (@rodgerrmi)

    Thank you for time and write back.

    In site A, Vendor’s role is a normal customer.

    &, I am unable to provide a screenshot, because now the screen is just white.
    the “Shop Title Update Error” is no longer appearing..

    Thread Starter Mwiinga

    (@rodgerrmi)

    Secondly,
    I have installed User Role Editor, which allows a user to have more than one role.
    So when I give the vendor role to the user in site B as a second role, WC Marketplace is still failing to recognize the user as a vendor..

    @rodgerrmi, thanks for the information.

    The vendor always needs to have a primary role as “dc_vendor”. So, can you please change the role as per that and see if this fixed the issue.

    Keep us posted.

    Thread Starter Mwiinga

    (@rodgerrmi)

    Hi
    Thank you for your time and response.

    Even after adjusting the roles as per your directive, WC Marketplace is still failing to recognize any user who registered on Site A.

    WC Marketplace is only recognizing a user as a vendor if that user registers on Site B where WC Marketplace itself has been installed, or if that user is manually added to Site B.

    In short,
    WC Marketplace is not recognizing users inherited from Site A or any other external sauce. WC Marketplace wants me to manually add the user.

    Hope this info helps in figuring out where the mini challenge is…

    Thank you.

    @rodgerrmi, It seems like this issue multisite related issue.

    We fetch the user using WordPress core function and check whether their role is our dc_vendor.

    For multisite user are common for both site, but our plugin assign vendor as a term. Now for multisite, it creates term_table as site-specific. Maybe for your site, you want to access term table site’s a vendor in site b.

    Can you please check whether you are able to access the category from a site A on another site B.

    Keep us posted.

    Thread Starter Mwiinga

    (@rodgerrmi)

    You’re now off topic.
    Allow me to re-explain the situation.

    I have a WordPress install.
    For the purposes of this conversation, let’s call it ‘Site A.’
    This ‘Site A’ is accessible at “www.siteA.com.”
    This fully functional ‘Site A’ has users already registered, and everything is running normal…

    Now,
    I have setup another new and fresh WordPress install.
    This new fresh install is inside ‘Site A,’ meaning, it’s address is “www.siteA.com/siteB”

    On the new ‘Site B’ fresh install, everything is running just fine, including all users being inherited from ‘Site A,’ because both ‘Site A’ and ‘Site B’ are using the same database…

    THE PROBLEM.
    Any USER on ‘Site B’ who have been inherited from ‘Site A’ is NOT being recognized as a Vendor

    While on ‘Site B,’ any existing user who was already registered from ‘Site A’ and just got inherited into ‘Site B’ (because both installs are using the same database,) is NOT BEING RECOGNIZED as a VENDOR on ‘Site B.’

    ‘Site B’ will only recognize a user as a Vendor if that user is manually added to ‘Site B’ itself.

    hence my QUESTION,
    Why is this plugin failing to recognition an existing user as a Vendor?

    Any additional information you may require, I;m here for you.
    Thank you..

    @rodgerrmi, We followed your suggested flow and as per multisite site settings a user of one site, if logged into another site, you will get this message – https://prnt.sc/ma2omi

    So, can you please share the screenshot of the error you are getting, so we can help you out further.

    Thread Starter Mwiinga

    (@rodgerrmi)

    Again,
    You’re off topic.
    This is NOT is a WordPress Multisite installation.

    ‘Site B’ which is found in ‘Site A,’ with the address ‘www.SiteA.com/SiteB’ is an independent Standalone WordPress installation. It has manually been installed there, just to suit it’s purposes, and address.

    Further, the ONLY common thing between ‘Site A’ and ‘Site B’ are the users. The same users on Site A are available on Site B, thanks to the define( 'CUSTOM_USER_TABLE', 'siteA_users' ); line of code in the wp-config.php file.

    So now the challenge is, when the role of a normal user who registered is on Site A, is updated to ‘Vendor’ on Site B, WC Marketplace is failing to recognize that use as a vendor.

    WC Marketplace will only recognize a user as a vendor if that user is manually added on Site B itself. Are you now understanding the challenge I am having??

    Hi @rodgerrmi,
    Thanks for sharing this line of code: define( 'CUSTOM_USER_TABLE', 'siteA_users' );. This lets us understand that you are using a multi-blogging site.
    Now, in case of a multi-blogging site, only the basic data from the user table gets shared between both the blogs.
    Now when we go through the flow, we see that a user definitely is a shared resource but it’s role is not shared and therefore it’s role is set to ‘None’- you can check the same flow from admin backend user list and also debug it by using get_user_by(): This will return a user object with empty role, that is the reason why ‘dc_vendor’ role is not working for second site and since the user roles are not set to vendors – thereby WCMp is unable to work.

    Thread Starter Mwiinga

    (@rodgerrmi)

    I’m happy that we are finally on the same page.
    &, I am definitely not a code person, so I do not know how or where to place and use the get_user_by() code you’ve provided.

    Further,
    In Site B, I have updated the user’s role to ‘vendor,’ but WC Marketplace is still unable to recognize the updated user as a vendor.

    Why is this happening??

    Thank you

    @rodgerrmi, can you please check the admin backend also, whether the user role has been changed to the vendor.

    Because, we tested with normal woocommerce role Subscriber, even though the role has been updated to Subscriber, still in the backend it is returning no role.

    In order to know how to work with get_user_by, please look into this document – https://developer.www.ads-software.com/reference/functions/get_user_by/

    Thread Starter Mwiinga

    (@rodgerrmi)

    @dualcube,
    I am able to maintain a user’s role across all multiple independent WordPress installs thanks this function code:

    function siteA_save_role( $user_id, $role ) {
    
    	// Site 1
    	// Change value if needed
    	$prefix_1 = 'SiteA_';
    	
    	// Site 2 prefix
    	// Change value if needed
    	$prefix_2 = 'SiteB_';
    	
    	$caps = get_user_meta( $user_id, $prefix_1 . 'capabilities', true );
    	$level = get_user_meta( $user_id, $prefix_1 . 'user_level', true );
    
    	if ( $caps ){
    		update_user_meta( $user_id, $prefix_2 . 'capabilities', $caps );
    	}
    
    	if ( $level ){
    		update_user_meta( $user_id, $prefix_2 . 'user_level', $level );
    	}
    }
    
    add_action( 'set_user_role', 'SiteA_save_role', 10, 2 );

    When a user is a customer in Site A, they will be a customer in Site B as well.
    When a user is a Vendor is Site A, same role will automatically update across all install. I searched and found this working code on Google.

    but now the problem is, when a user who originally registered on Site B is updated to a Vendor, WC Marketplace plugin will not work. WC Marketplace fails to recognize this user as a legit Vendor.

    But if a user is registered on Site B, and updated as a Vendor, WC Marketplace will work just fine.

    QUESTION:
    Why is WC Marketplace failing to recognize inherited users as Vendors, even when there roles have been updated accordingly?
    Why is this happening?

    Hi @rodgerrmi, can you please get in touch with us over our forum, so we can help you out further – https://wc-marketplace.com/support-forum

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Shop Title Update Error’ is closed to new replies.