Home Forums WC Vendors Free Support Adding aditional vendors roles

NOTICE: We've Moved to a Ticket System for Support

As of August 31, 2017 (12am EST) our support forums will be retired (read-only), and we will be moving to a support ticket system.  This will allow us to better organize and answer support requests, and provide a more personalized experience as we assist our customers.

For the time being, we will leave our forums open for reading and learning while we work on creating a more robust Knowledge Base for everyone to use.

If you are a WC Vendors Pro customer please open a support ticket here. 

If you are a WC Vendors user please open a support ticket on the Wordpress.org forums.

The information on this forum is outdated and in most instances no longer relevant. Please be sure to check our documentation for the most up to date information.

https://docs.wcvendors.com/

Thank you to all of our customers!

 

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #56091
    David
    Participant

    Hi!

    I’m trying to add aditional vendors roles to my site using wcvendors_vendor_roles.
    I feel stupid doing that, because after read all topics and tutorial about that i’m not having success.

    What I want it’s that a new vendor role called ‘school’ it’s listed together with other ‘schools’ like vendors using [wcv_pro_vendorlist].
    What I mean it’s that i’m using vendor role for one type of vendors and schools for other type (All two with the same capabilities). And I want to list all two, in different pages, one where are only listed schools vendors and the other with normal vendors.

    First thing I think I have to do it’s to add on the code ‘school’ as vendor_role using filters.
    Then I think I have to change on frontend template how vendors are listed.

    Could you please help me?

    Thanks in advance, David.

    #56146
    WC Vendors Support
    Participant

    You’d first have to have the role WITH THE CORRECT CAPABILITIES TOO! Use User Role Editor to duplicate the vendor role.

    For the filter, have you seen: http://docs.wcvendors.com/knowledge-base/wcvendors-vendor-roles/ ?

    #56201
    David
    Participant

    Hi Ben, thanks for your answer.
    Yes, i have duplicate yet the role vendor and rename it to school. That step it’s all ok.

    I have seen that knwoledge post, the problem is that i’m not that good with wordpress filters and php.
    So could you please explain to me more detailed or make an example with that?
    I’m not understandng how do i have to add this filter to have an additional role.

    #56269
    Anna
    Member

    David,
    This code will do it; youc an see how I used the filter wcvendors_vendor_roles to create a new filter with an additional role added.
    Since you already have created a role with duplicate capabilities as the vendor role.. put your role name int he code below where it says ‘newvendor’ . This goes in your theme / child theme functions.php:
    https://gist.github.com/fervous/6b6d82fe2e3f8bdf98a44e27b4463919

    #56297
    David
    Participant

    Hi Anna, thanks so much for your help.

    Now that I’ve included your code to my functions.php file, when I go to my vendors list [wcv_pro_vendorslist] and I click on a vendor to go to his shop-page it doesn’t works. It’s like a redirect to the vendor list page. Vendors pages has desapeared.

    If I delete the code everything works fine again. I can see on my vendors list all the ‘vendor’ users and go to his shop page.

    What could be the problem? Did you try this code in your demo site?

    #56350
    Anna
    Member

    @Davidperezgon
    I did try this code on my site— however, I did not use any of those shortcodes.
    Everything worked fine on my site.. but Like I said- I did not use the vendor list shortcode.
    I will have to check the shortcodes. You might have to modify those so that it picks up the other role also.

    #56412
    David
    Participant

    Hi Anna, I didn’t understand why is not working for me. I did not do any other modification to the code, so that should work.
    The problem isn’t related with the vendor list shortcode, when I put this code into my functions.php ‘vendor’ don’t work properly. (Not talking about ‘newvendor’, but originally ‘vendor’ role).

    It’s like old ‘vendors’ user are not anymore vendors, so it also change ‘sold by Vendor-Username’ to ‘Sold by Admin-username’. The vendors shop pages disapear.
    Could someone please help me with that? i can provide credentials access.

    I tried too:
    add_filter(‘wcvendors_vendor_roles’, ‘new_wcvendors_vendor_roles’);
    function new_wcvendors_vendor_roles($vendor_roles){
    $vendor_roles = array(‘vendor’);
    return $vendor_roles;
    }

    Witch should work as it does before, but it doesn’t work eother.

    #56479
    Anna
    Member

    @Davidperezgon
    I’ll have to do some testing again. From what I could tell when I tested it after making this snippet, it worked as intended.
    Please for now remove the code from your theme/child theme functions.php

    Then go to: wp admin > woocommerce > system status > tools : Reset WC Vendors Roles
    Click that to reset your WC Vendors Roles and the ‘vendor’ role should work properly again.

    #57495
    David
    Participant

    Any update about that?

    #59045
    David
    Participant

    @FERVOUS
    Did you do some tests and have you any idea on how to do it?

    Thanks, still waiting any solution to that problem. Please, help me.

    #59199
    Anna
    Member

    David,
    Did you add the actual name of your new role between the single quotes 'newvendor'?
    Each time I test it works for me.. so I am not sure what is going wrong when you use this code.
    In our next update there is also going to be an additional check for vendor capability which will allow the shortcodes to be used..

Viewing 11 posts - 1 through 11 (of 11 total)
  • The forum ‘WC Vendors Free Support’ is closed to new topics and replies.