By mdibrahim on
I have fetched some problem with user modules. When I go to this path "admin/user/user" to manage user I see there's a button "Add user". For some reason I don't want to have this button. I want to delete this button. I have tried and modified the user module. I know where the button code is. It's on user.module file at line 975 the code is as bellow:
$items['admin/user/user/create'] = array(
'title' => 'Add user',
'page arguments' => array('create'),
'access arguments' => array('administer users'),
'type' => MENU_LOCAL_TASK,
'file' => 'user.admin.inc',
);
I have delete this code but the button still remain. Any one can help me to delete this button?
Thanks
Comments
Show us your code.
Show us your code.
Contact me to contract me for D7 -> D10/11 migrations.
Code is already here
I have already shown here. Actually I just delete this code from the module file but it's not working.
That's a REALLY bad way to do
That's a REALLY bad way to do it. Anytime you update Drupal, it will overwrite your changes. You should use the hook_ _alter functions to unset the element you don't want to display.
Contact me to contract me for D7 -> D10/11 migrations.
I tried
Yes I have been tried but not succeed.
Begin ...
Begin by looking at this slide from a Drupal conference:
http://heyrocker.com/hack_core.jpg
Then read this:
http://api.drupal.org/api/function/hook_menu_alter/6
Again it's not working
I have tried with this code:
function user_menu_alter(&$items) {
// Example - disable the page at node/add
$items['admin/user/user/create']['access callback'] = FALSE;
}
but the "Add user" button still appears. I can't remove it.
it will be in user.module in
it will be in user.module in hook_menu(); around line number 961.
once u remove that code u need to rebiuld menus, u can just resave themes configurations.
BTW, its not a good practise to edit core file, u can override the theming function or u can use hook_form_alter to remove add user link.
Thanks for your advice
Yes I tried accordingly to said still the same result. So I finally understood. Changing the core modules it's not really easy or effective.
Thanks for spending your time for me.
A little late
By the time I finished my comment, others had already posted. What I wrote below works - hope it helps.
Where are you putting this?
The 'Add User' button is actually a tab, so check out this page: http://drupal.org/node/68792
This will do the trick if you put the following code in your theme's template.php file:
Note: Please replace each use of THEME below with your current theme's name (lowercase).
Thanks a lot
Thank you very much. Now it's working. So finally I found out the problem. Actually it's on template files.
Thank you very much.
You're welcome
You're welcome. Glad to be helpful.