Join our new community forum for support & discussion

Join Now

Home Support Search Search Results for 'menus/user_account'

Viewing 20 results - 1 through 20 (of 27 total)
  • Author
    Search Results
  • flantascience

    I made some progress. I got three new menu items to show up. However, the “Submit a Listing” is the only one that is working. I believe the issue is with the ‘Route’. For the Submit a Listing page, there’s an existing ‘Route’. But for the other two, I added the URL to the page, and its not working. Any guidance? (Code is below)

    add_filter(
        'hivepress/v1/menus/user_account',
        function( $menu ) {
            $menu['items']['listing_submit']=[
                'label' => 'Submit a Listing',
                'route' => 'listing_submit_page',
                '_order' => 123,
            ];
    
            $menu['items']['calendar']=[
                'label' => 'Calendar',
                'route' => 'https://luneh.com/calendar-testing/',
                '_order' => 122,
            ];
    
            $menu['items']['files']=[
                'label' => 'Your Files',
                'route' => 'https://luneh.com/file-sharing-testing/',
                '_order' => 121,
            ];
    
            return $menu;
        },
        1000
    );
    yevhen developer

    Please try this PHP snippet

    add_filter(
    	'hivepress/v1/menus/user_account',
    	function( $menu ) {
    			$menu['items']['custom_item_add_listing'] = [
    			'label'  => 'Add Listing',
    		    'url'    => hivepress()->router->get_url('listing_submit_page'),
    		    '_order' => 100,
    		];
            return $menu;
    	},
    	1000
    );
    yevhen developer

    Please try this PHP snippet. It will add this button only for vendors in account menu

    add_filter(
    	'hivepress/v1/menus/user_account',
    	function( $menu ) {
    		if(current_user_can('edit_posts')){
    			$menu['items']['custom_item_add_listing'] = [
    			'label'  => 'Add Listing',
    		    'url'    => hivepress()->router->get_url('listing_submit_page'),
    		    '_order' => 100,
    		];
    			
    		}
            return $menu;
    	},
    	1000
    );
    yevhen developer
    in ExpertHive > User Account

    If you mean account page menu then you can try changing menu items via the hivepress/v1/menus/user_account filter like in this topic https://hivepress.io/support/search/menus%2Fuser_account/

    But if you want to make changes only for vendors then code needs additional condition if(current_user_can('edit_posts')) {
    For example, I add this condition to code from topic which is provided above

    add_filter(
    	'hivepress/v1/menus/user_account',
    	function( $menu ) {
    	// Here is this condition to make changes only for vendors.
    	if(current_user_can('edit_posts')) {
       		// To add some menu items.
    		$menu['items']['custom_item_name'] = [
    			'label'  => 'Custom Item',
    			'url'    => 'some url',
    			'_order' => 123,
    		];
    
    		// To remove some menu items.  For example, 'Listings' item
    		unset($menu['items']['listings_edit']);
    	}
    		
    	return $menu;
    	}
    );
    Bemay1

    After thinking about the last sentence you wrotte i though about an alternative way and got it:

    add_filter(
    	'hivepress/v1/menus/user_account',
    	function( $menu ) {
    		$menu['items']['custom_item_name'] = [
    			'label'  => 'Minha Conta',
    			'url'    => 'https://google.com',
    			'_order' => 0,
    		];
    
    		return $menu;
    	}
    );

    If somebody else needs, you just need to change the fields “label” and “url”

    ihor developer

    Please try changing menu items via the hivepress/v1/menus/user_account filter https://hivepress.io/support/search/menus%2Fuser_account/

    yevhen developer

    There is no easy way to link a modal, but if you create a custom page for tutorials please try this PHP snippet. You can change fields with word ‘custom‘ and adjust '_order' by your requirements:

    add_filter(
    	'hivepress/v1/menus/user_account',
    	function( $menu ) {
    	    if(current_user_can('edit_posts')){
                    $menu['items']['custom_item_name'] = [
                        'label'  => 'Custom Item',
    		    'url'    => 'some custom url',
    		    '_order' => 123,
    		];
    	    }
                return $menu;
    	}
    );
    yevhen developer

    Please try this sample code snippet to add/remove (but adding a new account section requires advanced customizations) any menu item from My Account menu:

    add_filter(
    	'hivepress/v1/menus/user_account',
    	function( $menu ) {
    
                    // To add some menu items.
    		$menu['items']['custom_item_name'] = [
    			'label'  => 'Custom Item',
    			'url'    => 'some url',
    			'_order' => 123,
    		];
    
                    // To remove some menu items.  For example, 'Listings' item
                    unset($menu['items']['listings_edit']);
    
    		return $menu;
    	}
    );
    natsu

    Hi everyone.
    I came up with a different solution.
    Instead of showing a link on Navbar, I managed to put a link within a my account menu.

    I hope this will help 🙂

    //Add a link to My listing page within my account menu
    add_filter(
    	'hivepress/v1/menus/user_account',
    	function( $menu ) {
    		$menu['items']['custom_item_name'] = [
    			'label'  => 'My Listings',
    			'url'    => esc_url( home_url()."/vendor/".get_display_name()),
    			'_order' => 123,
    		];
    		return $menu;
    	}
    );
    function get_display_name () {
    	$user_data = get_userdata(get_current_user_id());
    	return  $user_data->display_name;
    }

    I don’t know much about PHP I just combined these POSTS.

    https://hivepress.io/support/topic/my-account-section/#post-7202
    https://hivepress.io/support/topic/change-username-of-vendors/#post-17598

    Thanks @ihor @Sergio @RooninStark

    fekedew

    try this. put this code in child theme function.php file

    
    add_filter( 'hivepress/v1/menus/user_account',   'alter_user_account_menu_register1'  );
    
    function alter_user_account_menu_register1( $menu ) {    
        
        global $wpdb;
        $p_sql = "SELECT <code>post_name</code> FROM wp_posts WHERE <code>post_author</code>=".get_current_user_id()." AND <code>post_type</code>='hp_vendor'";
        $row = $wpdb->get_results($p_sql);
        
        if(count($row) > 0){
            $menu['items']['vender'] = [        
                'label' => "Listing page ",
                'url'   => esc_url( home_url()."/vendor/".$row[0]->post_name ),
                '_order' => 14,
            ];
        }
    return $menu;
    }
    
    
    tandej

    Where do I find this path hivepress/v1/menus/user_account? I don’t have a v1 folder in my version of hivepress.

    lgoldmann

    Hi,

    is there a way to hide the dashboard page & menu item in the user account?
    I already tried to unset the item in the “hivepress/v1/menus/user_account” filter
    using unset( $menu['items']['vendor_dashboard_page'] );, but to no avail.

    When hiding the dashboard, I’d also need to edit the “My Account” link in the header, since it redirects to the dashboard.

    Many thanks!

    alphagoldafrica
    in ListingHive > My account section

    Hi Ihor,
    I am using the expert theme.
    Will this section of the code ‘hivepress/v1/menus/user_account’ be the same in the expert theme? If not, what would the equivalent be for the expert theme.
    Thank you,
    Caroline

    ihor developer
    in Paid Listings > Hide/remove Packages menu item

    Please try using this PHP snippet:

    add_filter(
    	'hivepress/v1/menus/user_account',
    	function( $menu ) {
    		unset($menu['items']['user_listing_packages_view']);
    
    		return $menu;
    	},
            1000
    );
    ihor developer
    in ListingHive > Package

    If you’re familiar with PHP snippets please try using the “hivepress/v1/menus/user_account” filter, you can unset any links or add a custom link this way, HivePress will automatically render these links.

    P.S. You don’t have to post another reply asking for urgent help, I check all topics at least once per 24 hours, even on weekends, so I (or another developer) will reply anyway. Please be patient, remember that it’s open-source software.

    Hi,

    1. It’s possible, but requires CSS customizations https://www.w3schools.com/cssref/css3_pr_text-overflow.asp

    2. You can try this CSS snippet:

    .hp-menu__item--user-account {display:none}

    3. If you mean adding custom content or menu items this requires PHP customizations (if you’re familiar with PHP you can use the “hivepress/v1/menus/user_account” filter). Also you can add custom widgets to the account sidebar in Appearance/Widgets section.

    ihor developer
    in ListingHive > My account section

    You can add a custom menu item with this snippet, but adding a new account section requires advanced customizations:

    add_filter(
    	'hivepress/v1/menus/user_account',
    	function( $menu ) {
    		$menu['items']['custom_item_name'] = [
    			'label'  => 'Custom Item',
    			'url'    => 'https://example.com',
    			'_order' => 123,
    		];
    
    		return $menu;
    	}
    );
    gsmobina
    in ListingHive > My account section

    I am not a developer, i just manipulate codes.

    can you give me snippet for the 1st option using hivepress/v1/menus/user_account filter?
    at least a sample?

    ihor developer
    in ListingHive > My account section

    1. This requires code customizations, please try using HivePress API if you’re familiar with PHP, you can use the “hivepress/v1/menus/user_account” filter.

    2. Unfortunately it’s not possible because the check for empty pages is set in HivePress code, e.g. if there are no favorite listings then the menu item is not added.

    ihor developer

    This code snippet should move the “Listings” menu item to the end:

    add_filter(
    	'hivepress/v1/menus/user_account/items',
    	function( $menu ) {
    		if ( isset( $menu['listings_edit'] ) ) {
    			$menu['listings_edit']['_order'] = 9999;
    		}
    
    		return $menu;
    	},
    	10000
    );

    You can start with it and copy the “if…” part with different menu item keys. If can’t check the $menu contents, please try removing the “_page” part from menu keys and it should be ok.

Viewing 20 results - 1 through 20 (of 27 total)