Skip to content

Instantly share code, notes, and snippets.

@hivepress
Last active Aug 10, 2022
Embed
What would you like to do?
Add vendor profile link to the user account menu #hivepress #vendors
<?php
add_filter(
'hivepress/v1/menus/user_account',
function ( $menu ) {
if ( is_user_logged_in() ) {
$vendor_id = HivePress\Models\Vendor::query()->filter(
[
'user' => get_current_user_id(),
]
)->get_first_id();
if ( $vendor_id ) {
$menu['items']['vendor_view'] = [
'label' => 'Vendor Profile',
'url' => hivepress()->router->get_url( 'vendor_view_page', [ 'vendor_id' => $vendor_id ] ),
'_order' => 123,
];
}
}
return $menu;
},
1000
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment