Requirements:
Change the Navigation block link "Add Listing" based on role. This is the built in Navigation block and I've renamed Add Content to Add Listing
I've tried all the solutions here. Though I admit I am probably doing it wrong.
Change menu link title dynamically? How do I modify a menu link title dynamically? How do I dynamically change the title of a menu link?
I've created a module with the following code:
function mymodule_menu_alter(&$items) {
$item['options']['alter'] = TRUE;
$items['node/add']['access callback'] = '_accesscheck';
$items['node/add']['title callback'] = 'mymodule_title_callback';
var_dump($items);
}
function mymodule_title_callback($arg1) {
$title = 'New Title';
return $title;
}
function _accesscheck(){
global $user;
return $user->uid;
}
This is a var_dump snippet of what I'm after:
["node/add"]=>
array(5) {
["title"]=>
string(11) "Add content"
["page callback"]=>
string(13) "node_add_page"
["access callback"]=>
string(16) "_node_add_access"
["file"]=>
string(14) "node.pages.inc"
["module"]=>
string(4) "node"
}
Before I attempt to include roles I'm just trying to get the link to change.
TRUE
or aFALSE
, not a uid.