Join our new community forum for support & discussion

Join Now

Home Support Extensions Requests Only Vendors can make an offer

Only Vendors can make an offer

  • Author
    Posts
  • FantasticBoy

    Hi there!
    I would like to ask how can I allow all signed in users to make offers on my requests. I don’t want the listing feature so I’m not using it. Since no one has any listing so there’s no vendor. Can you please help me in allowing all users to make an offer. If this is not possible, is there any way that I can register all users as vendors bt default

    ihor developer

    Hi,
    There’s no such option at the moment, but thanks – this may be a good feature for the next Requests update. You can register all new users as vendors using this code snippet:

    add_action(
    	'hivepress/v1/models/user/register',
    	function( $user_id ) {
    		$user = HivePress\Models\User::query()->get_by_id( $user_id );
    
    		( new HivePress\Models\Vendor() )->fill(
    			[
    				'name'   => $user->get_display_name(),
    				'slug'   => $user->get_username(),
    				'status' => 'publish',
    			]
    		)->save( [ 'name', 'slug', 'status' ] );
    	}
    );
    fantastic

    Hi ihor!
    Thank you for your help. This code adds any newly registered user as a Vendor, but still there’s something missing. These Vendors can’t still make offers. I checked going to Vendors list and found one difference that was the Author of Vendors created by code is empty while the Author of Vendors who added a listing is their own username. Can you help me with this because I need auto-registered Vendors to be able to make offers. Thanks

    aliraza

    In the newer updates we have direct vendor registration option by going to yourwebsite.com/vendor-registration
    Can someone help me to redirect users to this link when someone registers and after someone is registered as vendor, we come back to request page

    ihor developer

    @fantastic This is strange, I checked the Requests code again and the “Only vendors can make offers” error appears only when there’s no associated vendor profile. Please make sure that this code snippet creates vendors on registration and assigns them properly.


    @aliraza
    You can try setting a redirect with this code, but redirecting users back may require extra customizations:

    add_filter(
    	'hivepress/v1/forms/user_register',
    	function( $form ) {
    		$form['redirect'] = 'custom URL here';
    
    		return $form;
    	},
    	1000
    );
Viewing 5 posts - 1 through 5 (of 5 total)

New Reply

This forum has been archived and is no longer accepting new posts or replies. Please join our new community forum for support & discussion.