• Resolved nachokaiser

    (@nachokaiser)


    Hi! I need help with something in the vendor dashboard page. I need to display the current user store name as a title, so if the store name is “The Store”, it would be displayed as a title in the dashboard page.

    I’m having issues pulling that data from the current user with wp_get_current_user(); function, I’ve tried different things but I’m not a developer and it’s quite hard.

    How could I get the store name from the current logged in user?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello @nachokaiser ,

    Though I am not sure where exactly you want to show the store name and I am unable to provide you an exact custom solution but here is the sample code that you can use to get the store name on the dashboard –

    // Show store name on dashboard
    
    add_action('dokan_dashboard_content_inside_before', 'show_store_name_dashboard');
    add_action('dokan_settings_content_area_header', 'show_store_name_dashboard');
    
    function show_store_name_dashboard() {
    
        $get_user = get_user_meta(dokan_get_current_user_id());
        $store_name = $get_user['dokan_store_name'][0];
    
        printf("Store name: <b>%s</b>", $store_name);
    
    }

    Thank you 🙂

    Thread Starter nachokaiser

    (@nachokaiser)

    Thank you!!! Yes, your code worked perfectly. I managed to put the store name as the main title in the dashboard page, thanks to your help.

    Hello @nachokaiser ,

    I am glad to see that it was helpful.

    Marking this as resolved.

    Thank you 🙂

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Show current user their store name’ is closed to new replies.