In this case it’s easier to use the hivepress/v1/strings filter, it accepts an array of strings - you can check some condition and change the $array['add_listing']=... string.
Hi buddy, usually when the code snippet plugin faces an error you can simply go back to the code and it will show you the revision before the crash (or nothing if you added a new code). So after a few seconds your site should be fine.
Hey thanks for writing. Normally I can just click back but this time is first time it wont let me. Worse is that the code snippet plugin in the dashboard completely disappeared. The only way my site actually can be viewed was by deactivate it.
But I found the solution. I actually used my jetpack dashboard recovery and was able to go back to my yesterdays saved version. so all is good now!
If you want to change string text depending on is user a vendor or not then please try this PHP snippet to start. But please note that it can require further customization. If you are not familiar with code customization then please consider hiring someone for custom work https://fvrr.co/32e7LvY
add_filter(
'hivepress/v1/strings',
function ( $strings ) {
if(is_user_logged_in()){
// User logged in and user can be vendor.
// Get vendor.
$vendor = \HivePress\Models\Vendor::query()->filter(
[
'status' => [ 'auto-draft', 'draft', 'publish' ],
'user' => get_current_user_id(),
]
)->get_first();
if(!$vendor){
//User is not vendor.
}else{
//User is vendor.
}
}else{
//User is not vendor as user is not logged in.
}
return $strings;
}
);