Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

custom dashboard and user roles outside wordpress admin

Is it possible to create menu based on login and let user login, but no access to admin e.g

  1. When a person login, menu have more options e.g 'My Account' etc.
  2. When that person is logged in, he don't see the dashboard but rather see my custom page admin page and be able to do searches based on a form, i created and display result as i want. Overall, is it possible to use wordpress as you would make a CURD system for CMS in pure php? Any plugin or how?

Zac Gordon please have your say.

2 Answers

Andreas Anastasiades
Andreas Anastasiades
2,916 Points

I understood your question wrong.

It is possible to show a different menu on front end when a user is logged in.

First, create 2 menus (like 'main' and 'login'), of course you will need a login form on the front end so users can actually log in.

In your theme header at the menu position add this:

<?php
    if( is_user_logged_in() ) {
         $menu = 'login';
    } else {
        $menu = 'main';
    }

    wp_nav_menu( array( 'main' => $menu, 'container_class' => 'menu-header', 'theme_location' => 'primary' ) );
?>

That should do the trick

Andreas Anastasiades
Andreas Anastasiades
2,916 Points

With this plugin you can create your own user roles https://wordpress.org/plugins/user-role-editor/

With this you can grant or deny access to specific options so for one user they appear and for another they don't.

That's one part of my question. Though not sure, i am looking for this.