• Resolved givo150

    (@givo150)


    Hi,

    I would like to use your plugin when some digital products are for free.

    I’m using WC Vendors version 1.9.8 and Pro version 1.3.9

    I tried to change several settings, but at the end your plugin works correctly only if I disable the 2 others :
    – allow orders for guests
    – downloads don’t require to be loged
    – Include paid items that are currently on sale for free

    Issue :
    The download button is correctly displayed.
    If you click on it, you are redirected to the account page.

    FYI also, for WC Vendors I added their hook to redirect the vendor to his dashboard when he logs in.

    Thanks in advance for you help

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Richard Webster

    (@rwebster85)

    Hi mate so is it only users who aren’t logged in that can’t download? Can logged in users get the download? What about the main roles like admin or vendor?

    Plugin Author Richard Webster

    (@rwebster85)

    I’ve just installed WC Vendors on my site and downloads work for admin and guests. What settings have you changed in that plugin?

    Thread Starter givo150

    (@givo150)

    I tried with :
    – customer logged in
    – vendor logged in
    – guest
    => in all cases, I can’t dowload the product and get redirected

    If I try as the admin, logged in, the button works correctly.

    Here a function added to the child theme :

    /* Redirect Vendors to Vendor Dashboard on Login */
    add_filter('woocommerce_login_redirect', 'login_redirect', 10, 2);
    function login_redirect( $redirect_to, $user ) {
        
        // WCV dashboard -- Uncomment the 3 lines below if using WC Vendors Free instead of WC Vendors Pro
        // if (class_exists('WCV_Vendors') && WCV_Vendors::is_vendor( $user->id ) ) {
        //  $redirect_to = get_permalink(WC_Vendors::$pv_options->get_option( 'vendor_dashboard_page' ));
        // }
    
        // WCV Pro Dashboard
        if (class_exists('WCV_Vendors') && class_exists('WCVendors_Pro') && WCV_Vendors::is_vendor( $user->id ) ) {
            $redirect_to = get_permalink(WCVendors_Pro::get_option( 'dashboard_page_id' ));
        }
        return $redirect_to;
    }
    Thread Starter givo150

    (@givo150)

    Thanks for your reactivity.

    I continue to test changes.
    Yes, I removed this function but it didn’t help.
    And yes, I tried with the guest checkout also.

    The issue is with the Pro version of WC Vendors, because if I let the free version only it works.

    Unfortunately I can’t give you an access, I’m still on local.

    Thread Starter givo150

    (@givo150)

    Well, I found the conflict.

    It’s on the Pro version, with the setting :
    only admin can access to the dashboard /wp-admin/

    If I untick this setting, there is no redirection anymore and your plugin works perfectly.

    But, I don’t want to let this access available.
    It would be great if you could share a solution.

    Thread Starter givo150

    (@givo150)

    btw if it can help, it seems to be this function :

     * Lock a vendor out of the wp-admin
    	 *
    	 * @since    1.0.0
    	*/
    	public function admin_lockout( ) { 
    
    		if ( WCVendors_Pro::get_option( 'disable_wp_admin_vendors' ) ) { 
    
    			$capability = apply_filters( 'wcv_admin_lockout_capability', 'administrator' ); 
    
    			if ( ! current_user_can( $capability ) && ! defined( 'DOING_AJAX' ) ) {
    				add_action( 'admin_init',     array( $this, 'admin_redirect' ) );
    			} else {
    				return; 
    			}
    		} 
    
    	} // admin_lockout() 
    
    	/**
    	 * Redirect to pro dashboard if attempting to access wordpress dashboard
    	 *
    	 * @since    1.0.0
    	*/
    	public function admin_redirect( ) { 
    
    		$redirect_page = apply_filters( 'wcv_admin_lockout_redirect_url', get_permalink( WCVendors_Pro::get_option( 'dashboard_page_id' ) ) ); 
    		wp_redirect( $redirect_page ); 
    
    	} //admin_redirect() 
    
    Plugin Author Richard Webster

    (@rwebster85)

    Well if you replace the if line after the $capability variable declaration with the following, it should work. If it does, reach out to the developer to include it in their build.

    if ( ! current_user_can( $capability ) && ! defined( 'DOING_AJAX' ) && ! strpos( $_SERVER['REQUEST_URI'], 'admin-post.php' ) ) {

    That’s the method I use to block access to the dashboard in the new site I’m building for my business. It allows front-end access to the admin area for the admin-post.php functions, that allow posting from the frontend.

    Thread Starter givo150

    (@givo150)

    Awesome !

    Thank you very much for your support, especially because it was not on your side.

    I will share the info with the authors of WC Vendors.

    Plugin Author Richard Webster

    (@rwebster85)

    Glad it’s working now mate, happy to help where I can.

    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    @rwebster85 I’ve deleted your offer to login to your user’s site. I’m am 100% sure you mean well but please never ask for credentials on these forums.

    https://codex.www.ads-software.com/Forum_Welcome#The_Bad_Stuff

    Now for the why: The internet is a wonderful place full of very nice people and a few very bad ones. I’m sure everyone here is very nice however, by giving some ones keys to your house you are trusting they wont steal anything. Likewise the person who takes the keys is now responsible for the house FOREVER.

    If something was to go wrong, then you the author may well legally become liable for damages, which they would not normally have been as their software is provided without warranty.

    Please be aware that repeatedly asking for credentials will result in us asking you to repeatedly stop before escalating up to the plugins team.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Conflict with WC Vendors free / Pro’ is closed to new replies.