Creating a dashboard page

This topic contains 13 reply and 2 voices, and was last updated by towhid 8 years, 11 months ago
Viewing 13 Posts - 1 through 13 (of 13 total)
Author Posts
April 13, 2015 at 4:59 am 41186
towhid I have hooked into the dokan dashboard menu and have added a menu item. function my_function( $urls ) { $page_id = '1'; $urls['zip'] = array( 'title' => __( 'My Tab', 'dokan'), 'icon' => '', 'url' => get_permalink( $page_id ) ); return $urls; } add_filter( 'dokan_get_dashboard_nav', 'my_function' ); I then created some shortcode to to add into a page. The page loads when I click on the new tab that I created, however it is not styled like the other dashboard pages. What do I need to do to make the linked page look like other dashboard pages?
April 13, 2015 at 10:45 am 41202
towhid towhid

Hello Bryan,

Please allow me some time to workout with your code as a test purpose. After then I will give you a reply.

Thank you 🙂

April 15, 2015 at 2:34 am 41347
Bryan Bryan

The following code is what I have currently come up with. This code will create a new dashboard menu item and connects that link to a page that has been created with shortcode. Additionally this code check to see if the user is logged in and allowed to sell items.

The only thing that I cannot seem to get working are the styles and scripts associated with the dashboard page. What are the styles and scripts that I would need to load to get this new page looking like the others?

__( ‘New Tab’, ‘dokan’),
‘icon’ => ‘‘,
‘url’ => get_permalink( $page_id )
);

return $urls;
}

add_filter( ‘dokan_get_dashboard_nav’, ‘x_dokan_new_nav’ );

/*
*
*Redirect the user if they are not logged in
*
*/
function x_dash_redirect(){
if ( ! is_user_logged_in() && is_page( ‘new-dashboard-page’ )) {
wp_safe_redirect( home_url().’/my-account’ );
exit;
}
}

add_action( ‘template_redirect’, ‘x_dash_redirect’ );

/*
*
*Shortcode for page
*
*/
function x_new_dashboard_content(){

$user_id = get_current_user_id();

?>

‘test’ ) ); ?>



Test!

April 15, 2015 at 2:24 pm 41406
towhid towhid

Hello Bryan,

Can you please let me know in which file you have paste this code?

Thank you 🙂

April 15, 2015 at 6:37 pm 41428
Bryan Bryan

I have placed this file in a new plugin file. There is another file within that same plugin file which activates the plugin and includes this file. I have not changed any of the core dokan files.
website\wp-content\plugins\new-plugin\this-file.php

Everything is working it is just the css and perhaps some js that is not loading. There are a lot of css and js files loaded on the dashboard pages and I am having a hard time figuring out which ones need to be included in the new dashboard page.

April 17, 2015 at 6:45 pm 41606
Bryan Bryan

Any luck on this?

April 18, 2015 at 6:36 pm 41702
towhid towhid

Hello Bryan,

Sorry for my late reply. Please allow me some time. I will be back to you as early as possible problely tomorrow I will try to reply something as my best.

Thank you 🙂

April 18, 2015 at 8:17 pm 41706
Bryan Bryan

No worries.

April 21, 2015 at 5:14 pm 41921
towhid towhid

Hello Bryan,

Can you please followup my instruction and see how it sees:

Step 1: Please create a page named “mytab.php” under plugins/wedevs-dokan-plugin/templates/

Step 2: Please open plugins wedevs-dokan-plugin/includes/template-tags.php and put this code

function prefix_dokan_add_seller_nav( $urls ) {
    
    $urls['help'] = array(
        'title' => __( 'My Tab', 'dokan'),
        'icon'  => '<i class="fa fa-users"></i>',
        'url'   => dokan_get_navigation_url( 'mytab' )
    );

    return $urls;
}

add_filter( 'dokan_get_dashboard_nav', 'prefix_dokan_add_seller_nav' ); 

function load_mytab_template( $query_var ) {
    if( isset( $query_var['mytab'] ) ) {
        dokan_get_template_part( 'mytab' );
        return;
    }
}

add_action( 'dokan_load_custom_template', 'load_mytab_template'); 

Step 3: Please open yourtheme/functions.php and paste this code

function load_mytab_rewrite( $query_var ) {

    $query_var['mytab'] = 'mytab';
    return $query_var;
}

add_filter( 'dokan_query_var_filter', 'load_mytab_rewrite',20 ); 

After then you will see a menu named “My Tab” with same design of other dashboard page.

Try this instruction and let me know the result.

Thank you 🙂

April 24, 2015 at 8:46 am 42176
Bryan Bryan

The tab appears, however when I click on it it states “That page cannot be found”. Is there a specific location within these files that I need to add this code to. Also I am using the most recent version of the Dokan theme with the plugin if this helps any.

April 25, 2015 at 11:20 am 42211
towhid towhid

Hello,

Make sure you have set your permalinks as post name and product. Please navigate to Settings->Permalinks and Set your permalinks as Post name and Product. Please check and let me know.

Thank you 🙂

April 25, 2015 at 8:22 pm 42259
Bryan Bryan

This works!!! The only issue now is that the active tab is not highlighted. I have used the following code within the mytab.php file:

‘mytab’ ) ); ?>

If I change ‘mytab’ to another menu name such as ‘settings’, the ‘settings’ tab will display as active, it only seems to not work for the new tab. What could be causing the the “My Tab” to not display as the active tab?

Thanks for getting this working as well as it is by the way.

April 27, 2015 at 12:50 am 42385
Bryan Bryan

I got it working. the code you provided worked fine, I made a syntax error. Thank you for your help on this issue.

April 27, 2015 at 10:11 am 42394
towhid towhid This reply has been marked as private.
Viewing 13 Posts - 1 through 13 (of 13 total)