Okay
  Public Ticket #3618176
Auto assign a vendeur group to users on registration
Closed

Comments

  •  1
    John started the conversation

    Hey

    I'm building a community platform and I want to add marketplace to it, your plugin is very good according to the screenshots and on the sales page on codecanyon. When I checked your documentation, I found that users or vendor need to be added to a specific group with specific capabilities before being able to sell, but I want users to be able to sell directly when they pass by my buddypress registration form. I want them to be added to the roles and capabilities without necessary creating a new account or me assigning a group to them manually. If that is possible, please let me know and I will consider getting the plugin.

  •  2,214
    WebWizards replied

    Hi John,

    Thank you for getting in touch,


    Just to clarify this, MarketKing normally has its own registration / or can extend the standard WooCommerce registration. When this is used, the vendor group is assigned automatically.


    However, if you're looking to use the BuddyPress form, then indeed MarketKing does not normally extend that. However, we can programmatically set a user as part of a group, and I believe we can also do it for your form, by hooking into any hook that runs when a user registers via BuddyPress.

    I tried now to look up what the correct hook might be. I found some info that makes me believe this code may work:

    add_action('bp_core_signup_user', 'doMyFunction', 10, 5);
    function doMyFunction($user_id, $user_login, $user_password, $user_email, $usermeta){
        $group_id = 1234;
        update_user_meta( $user_id, 'marketking_group', sanitize_text_field($group_id));
        update_user_meta( $user_id, 'marketking_user_choice', 'vendor');    
    }
    

    1234 would have to be replaced with the ID of the vendor group.


    If that doesn't work, we can work on setting this up directly on your site as part of support. We would need a backend login to the site or a staging site, so we can test,


    Kind regards,

    Stefan

  •  1
    John replied

    Okay, thanks