Are You An Options Trader?

Learn how to

  • Reduce Risk

  • Create Monthly Income from Option Trading

  • Get Access to Free webinars and training

  • Just enter your information below and click "Get Updates!"

Get Tom's updates and a free account at Capital Discussions.

September 14, 2011

Thesis and DAP: Different Menus for Different Users

A client I’m working with needed access control for his WordPress website. I use the Thesis Theme for WordPress with Digital Access Passfor access control. The site I’m working on needed 3 menus: – Not logged into Digital Access Pass (DAP) – Logged in with limited access – Logged in with full access The site isn’t selling products, we’re just using DAP to control access to different parts of the website. We’ve setup two “products”: – Investors – Clients Clients have access to everything investors do. This access control is setup in the products area of DAP. The problem was trying to display different menus based on if the user was logged into DAP and if they were, show the correct menu for that user type. I setup three menus in WordPress for each of these states. As you edit each menu, you’ll see “post” in the URL to get the Menu ID you’ll need later:

Wordpress Menu ID

WordPress Menu ID

I use the Menu ID so I can edit the menu and not worry about having to change the custom_functions.php code. Next you’ll need the product ID’s within Digital Access pass. Navigate to the DAP > Products > Manage and you’ll see “Product ID” as the top entry for that product:

Digital Access Pass Product ID

Digital Access Pass Product ID

Now that you have the product ID and menu IDs, you’re ready to add a custom function to Thesis. Edit your custom_functions.php file:

function custom_wp_nav() { 
  $session = Dap_Session::getSession(); 
  $user = $session->getUser(); 

  if ( !Dap_Session::isLoggedIn() && !isset($user) ){ 
     wp_nav_menu( array('menu' => '6' )); //Main Menu (not logged in) 
  } elseif ($user->hasPaidAccessToProducts("3")) { 
     wp_nav_menu( array('menu' => '5' )); //Client menu 
  } elseif ($user->hasPaidAccessToProducts("1")) { 
     wp_nav_menu( array('menu' => '7' )); //Investor menu 
  } else { 
     wp_nav_menu( array('menu' => '6' )); //Main Menu (not logged in) 
add_action('thesis_hook_after_header', 'custom_wp_nav'); 

So we can see in the code above, the MenuID’s are used in the wp_nav_menu function calls and the ProductIDs in the “hasPaidAccessToProducts” DAP function call. Here’s what each menu/user state looks like: Not logged in

Not Logged in - Menu ID 6

Not Logged in – Menu ID 6

Logged in as “Investor”

Investor Menu ID 7

Investor Menu ID 7

Logged in as “Client”

<img class="size-full wp-image-318" title="Client – Menu ID 5" src="" alt="Client – Menu ID 5" width="585" height="27" srcset=" 585w, http://2dfki13vyv203m3zxk2nuxio.wpengine.netdna-cdn oxycontin×14.png 300w” sizes=”(max-width: 585px) 100vw, 585px” />

Client – Menu ID 5

This was a perfect solution for the website we were building as we weren’t selling tons of products and only using DAP for user management for two different access levels. Of course we get all of the benefits of using DAP like being able to send emails to each type of user, etc. If you don’t have Thesis and Digital Access Pass, you can find them here: – Thesis Theme for WordPressDigital Access Pass I hope this code example can help a few people. Let me know if you have any better ways to do this or suggestions for improving it.

Join our Free Option Trading Community

Tom Nunamaker

Click Here to Leave a Comment Below

Leave a Reply: