[ad_1]
I have a client who has a leisure home (caravans and lodges) website and wants to add the functionality for somebody to be able to login and upload listings to their website, like property listings. Is there a simple way to do this? i.e. via a plugin or just setting the right permissions when creating accounts or is this something I’d recommend they reach out to a web developer to create for them?
​
[ad_2]
Some themes – like Generatepress or blocks – Kadence – allow you to create elements that are visible to specific users – let’s just say logged in. You can create a subpage and wrap specific form there to show only for logged users.
You can easily code a shortcode for that as well.
I use something like this for support agents (it reads additional field to check if user is support agent).
function check_support_agent()
{
// check if user is logged in
if (is_user_logged_in()) {
// get current user
$current_user = wp_get_current_user();
// get value of support_agent field
$is_support_agent = rwmb_meta(‘support_agent’, array(‘object_type’ => ‘user’), $current_user->ID);
// if user is a support agent
if ($is_support_agent == “1”) {
// include the order form template
ob_start();
include get_stylesheet_directory() . ‘/custom/support_order.php’;
$form = ob_get_clean();
return “Hello Support Agent, your ID is: ” . $support_agent_id . $form;
} else {
return “Sorry, you are not a support agent.”;
}
} else {
// output login form
ob_start();
wp_login_form();
return ob_get_clean();
}
}
add_shortcode(‘support_check’, ‘check_support_agent’);