Vendor profile link in the account menu linking to a different vendor

I have used the following snippet to add the vendor profile link to the account menu:


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'  => 'Vizualizare Profil Furnizor',
					'url'    => hivepress()->router->get_url( 'vendor_view_page', [ 'vendor_id' => $vendor_id ] ),
					'_order' => 123,
				];
			}
		}

		return $menu;
	},
	1000
);

‘Vizualizare Profil Furnizor’ means View Vendor’s Profile

The Vendor Profile link does appear in the menu, but it links to the following dummy vendor profile (not to the vendor that is logged in): /vendor/michelle/.
How can I fix this?

I am writing with an update on this matter. It looks like this problem appears only in the admin’s account, all the other vendor accounts seem to display the correct profile when accessing that page through the account’s menu.

It was tested locally, and it seems to be ok. Please send more details that may help to detect or reproduce this issue (e.g., a link to your site, a screenshot of a dummy vendor profile, as you said, or other helpful screenshots). Also, please make sure that admin has an active vendor account.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.