Skip to content

How to disable “Submit Vehicle” functionality for “Private” user role”?

By default anyone can add a listing, whichever seller type they registered as. With this child-theme snippet, users who signed up as a “Private” seller lose the Submit Vehicle option and their panel is left with Favorites, Account and Sign Out only.

1 minute read

How to disable adding listings by the “Private” user role?

The front-end Register form — Username, Email, Phone and Password fields, a privacy policy checkbox and an orange Register button — with an arrow pointing at the selected "Private seller" option next to "Business seller".
The role is chosen at registration.

to make it look like this?

The user panel tab bar with only Favorites, Account and Sign Out — no Submit Vehicle or Vehicles tab — and the open Dashboard dropdown in the header listing Favorites, Settings and Sign Out.

Please add this code to your Child Theme functions.php file (read more about child themes here).

functions.php
add_filter('vehica/user/canCreateCars', function ($canCreateCars, $user) {
/* @var \Vehica\Model\User\User $user */
if ($user->isPrivateRole()) {
return false;
}

return $canCreateCars;
}, 10, 2);

Ask the people who build Vehica

We answer by email from support@tangiblewp.com. With Premium Support, we also fix your site when something breaks.

Was this guide helpful?