Filtering the Tools menu by profile types

A while back I managed to figure out a way to filter the widgets availible to users according to the profile choice they made, (using "Profile Manager and Dragable_widgets). Now I would like to do something similar with the Tool Menu on the Topbar.

I have tried adding code to check the users profile choices prior to the add_menu statement in the start.php of certain plugins, but maybe the add_menu is being loaded before elgg loads the profile type (not sure about this just a theory).

Has anyone else played with this idea? if so, any ideas to make this work?


  • I don't use profile_manager, I'm using the old usertype plugin. But the code I use to get exactly what you're asking for is this:

    if ( $_SESSION['user']->usertype == "User1") {

    add_menu(elgg_echo('pages'), $CONFIG->wwwroot . "pg/pages/owned/" . $_SESSION['user']->username,'pages');

    This go in relevant plugin start.php
    good luck!

  • Thanks,,,

    the code I have tried is:

    $p = page_owner_entity();
    $pt = $p->custom_profile_type;

          if (isloggedin() && $pt == 3) {
                  add_menu(elgg_echo('mood'), $CONFIG->wwwroot . "mod/mood/everyone.php");

    Not sure if the ($_SESSION['user']->custom_profile_type == 3) statement would work but I'll read up on it.

    Thanks for the idea

  • That worked Great!

    Thanks Man