Hello guys,
Please help me.
- Current situation:
Previously I’ve implemented this snippet for my Add listing button that opens a registration modal window for non-logged in visitors:
add_filter(
'hivepress/v1/templates/user_login_page',
function($template){
$redirect_url = hivepress()->router->get_redirect_url();
if(!$redirect_url || strpos($redirect_url, 'submit-listing') === false){
return $template;
}
hivepress()->template->fetch_block($template, 'user_login_form');
return hivepress()->template->merge_blocks(
$template,
[
'page_content' => [
'blocks' => [
'page_title' => [
'type' => 'content',
'content' => '<h1 class="hp-page__title">Registration</h1>',
],
'user_login_form' => [
'type' => 'user_register_form',
'_order' => 10,
],
],
],
]
);
},
1000
);
Currently when vistor is not signed-in when he pushes the add listing button in the header the url is the following: (https://geo-task.com/account/login/?redirect=https%3A%2F%2Fgeo-task.com%2Fsubmit-listing%2F)
and registration modal opens up. Works fine.
And now I would like to change it in a way that when not signed-in or not registered visitor is pushing the Add listing button he should be redirected to register-vendor page (for direct vendor registration upon this button).
I found this snippet on GitHub:
add_filter('hivepress/v1/routes', function($routes) {
$routes['listing_submit_page']['path']='/custom-slug-here'; // I add here "register-vendor"
return $routes;
}, 1000);
I think this will work for both cases for signed-in and for signed-out users. I need only for signed-out.
My knowledges are not enough for customizing it.
Please help me to do that.
I want to keep the original process for logged-in users when they push add listing button being signed-in.
- Also I’ve noticed, that after I’ve activated the direct vendor registration - when the user signs-in for the first time - he is not redirected to complete vendor profile. How I can implement it?
The thing is that when you register via simple registration form or through an add listing button now (not via register-vendor direct link) - when you follow the e-mail confirmation link you are being automatically signed-in + complete vendor profile shows up + add listing page shows up next.
But when you register via direct vendor registration link and follow confirmation link from the e-mail - you are not automatically signed-in + when you log-in manually the complete vendor registration form is not open up.
Let me try to explain - I want to implement direct vendor registration in such a way, so that the initial process should be the same if you register when it’s not activated.
The reason of this is that I want vendors (who registered via direct vendor registration link) to show their profiles even if they don’t add a listing but at the same time the system should offer them to add listing after they complete their vendor’s profile but it should not be obligatory. If they miss the add listing step their profile will be published in any case. This is my idea.
I would like to leave the original process that allows you (as a direct vendor) to automatically sing-in via confirmation link from the e-mail, automatically open a complete vendor profile page upon first sign-in and then automatically offer to complete listing profile (but in this case the last point will be not obligatory and this will allow to show the vendor profile even if he didn’t added a listing).
Sorry, maybe it’s a bit complicated but I don’t know how to explain easier.