Description


Use this filter to add menu items with author dashboard or remove any menu item from author dashboard

Parameters


One parameter is passed to this hook.

Usage


To add a new menu with author dashboard.

<?php add_filter('wpdm_frontend','wpdm_author_dashboard_menus',10,1);  ?>

Examples


<?php
add_filter('wpdm_frontend','wpdm_author_dashboard_menus',10,1);
// $menu_items is an array containing current menu items
function wpdm_author_dashboard_menus($menu_items){ 
// Removing edit profile menu
unset($menu_items['edit-profile']);
//Adding new menu item using callback function
$menu_items['new-menu-id'] = array('name'=> __('Menu Title','text-domain'), 'callback' => 'CallbackFunction');
//Adding new menu item using short-code
$menu_items['new-menu-id'] = array('name'=> __('Menu Title','text-domain'), 'shortcode' => '[short_code_here]');
return $menu_items;
}
?>
Last Updated: Mar 1, 2018


Discussion

  • Adanza

    Hello,
    I’m trying to customize the front-end upload tool display. Specifically, I’d like use a different term than “package” to describe the packets of files. This filter “wpdm_frontend” does not actually filter anything. I tracked down the code (in class.ShortCodes.php) where the filter is applied and see the following

    $tabs = array( //’sales’ => array(‘label’=>’Sales’,’callback’=>’wpdm_sales_report’)
    );
    $tabs = apply_filters(‘wpdm_frontend’, $tabs);

    That explains why this filter currently does not do anything.

    Do you plan on building this filter out to be functional? Otherwise, do you have recommendations for customizing this frontend upload tool page?

    Thanks

    • Shaon

      that is not an issue here, sales tab actually will be generated by “WPDM Premium Package” add-on using this filter. So you also can use the filter to add your own tab. Example:

      function mywpdm_frontend_tab($tabs){
      $tabs['mytab'] = array('label' => 'My Tab', 'callback' => 'wpdm_my_func');
      return $tabs;
      }
      add_filter('wpdm_frontend', 'mywpdm_frontend_tab');
      
  • Adanza

    Thanks Shaon!

    Is there a way to change the name “Package” to something else throughout the Download Manager experience?

    Much appreciated

  • khalil

    I am using [wpdm_frontend] on my site. It does not seem to work, the “Register” button is not clickable, and the css does not load, ie. I dont see colours on the buttons.

    • khalil

      this is on a site which has restricted access (plugin), and version number is v.4.3, so might be because of that. However, I have tested this on a local site using 4.4 and using wpdm_frontend, I am able to see css, but when clicking “register”, nothing happens – I am only seing username/password.

  • Dave Iannone

    $menu_items doesn’t include ‘edit-profile’, ‘settings’, or ‘logout’, so your example of removing the Profile nav item is incorrect. This filter is really only useful for adding items.

    • Shahjada

      The following menus are hard coded in /tpls/author-dashboard.php:
      # Edit Profile
      # Settings
      # Logout
      If you want to change those, copy the file to your active-theme/download-manager/ dir, then edit the file.
      ( Doc For Template File Editing: https://www.wpdownloadmanager.com/doc/template-files/ )

      • Dave Iannone

        Any chance you could add a filter to 1. function wpdm_tpl_path() in wpdm-functions.php and 2. function location() in libs/class.Template.php to hook in template overrides from a plugin? Have multiple sites with different child themes where I’d like to use the same overrides.

  • Dave Iannone

    Hi there just following up if it would be possible to do the above?
    We’re rolling this out across a bunch of fire department websites and it would be super useful

  • Daniel

    What are the steps involved in re-ordering the User Dashboard left sidebar menu?

    Currently we only need ‘My Profile’, ‘My Downloads’ and ‘Edit Profile’.

    We would like to have ‘My Downloads’ first, then ‘My Profile’ and ‘Edit Profile’

    Can you please assist? Thank you!

    • Shafayet

      You need to use the following code:

      <?php
      add_filter('wpdm_user_dashboard_menu','wpdm_user_dashboard_menus',10,1);
      // $menu_items is an array containing current menu items
      function wpdm_user_dashboard_menus($menu_items){ 
         $new_items['my-downloads'] = $menu_items['my-downloads'];
         $new_items[''] = $menu_items[''];
         $new_items['edit-profile'] = $menu_items['edit-profile'];
         unset($menu_items['my-downloads']);
         unset($menu_items['edit-profile']);
         unset($new_items['']);
         $menu_items = $new_items + $menu_items;
         return $menu_items;
      }
      ?>
      
  • Daniel

    Hi Shafayet,

    That code actually broke the Dashboard, it will no longer display. Can you please see if there is another way to re-order the left User Dashboard sidebar menu?

Leave a Reply