By tilmann on
Hi,
I need just one user-id for many people logging into the system. How do I disable the "my account" section, so users can not change e-Mail, password etc. In addition, having a "my account" link is already confusing for many users.
Thanks for the help
tilmann
Comments
Menu customization
Enable the menu module, and turn off that menu item.
Menu customization
That's not possible. When you go to menu module and want to disable "my account" it says "locked". Any other ideas?
Disable the whole menu
Disable the block with the Nav menu and create a new menu with only the links you want and put it in a custom block.
gpdinoz
"If we can see further it is because we stand on the shoulders of giants"
Regards
Geoff
Easier way?
Thanks for the reply. But isn't there an easier way without having to rebuild the whole navigation block? Is there no way to simply disable the link "my account"?
Disable 'my account'
That's exactly the option that I am looking for!
In building a corporate website, we have restyled the menu as dropdown menus, but 'my account' shouldn't be part of this. Creating a new menu has the disadvantage that it does not dynamically handle installation of and changes in modules (e.g., adding a new module currently adds it under admin/settings dropdown menu). By using a new, static, menu, this does not happen. This dynamic functionality is particularly important to users that have access to the admin menu.
Besides, I don't like items being locked from admin control..
My workaround
goes like this (for 4.6.3). All changes are in the file:
modules/user.module
NOTE: to change a line probably means to comment it out and add new one. Have a copy of original user.module around (maybe you have patched version) if something goes wrong.
1. Search for function user_perm and change line
return array('administer users', 'access user profiles');
with
return array('administer users', 'access user profiles', 'access own profile');
2. Search for function user_menu and change line
$view_access = (user_access('access user profiles') || ($user->uid == arg(1)));
with
$view_access = (user_access('access user profiles')||user_access('access own profile'));
3. Search for comment //your personal page (around line 700) and change
if ($user->uid ) {
with
if ($view_access ) {
Then I believe a cache should be cleared (either from mysql cmd line or other tool like phpmyadmin, emtpy table 'cache').
So how it works after change.
On a 'access contro' page new permission 'access own profile' appears for user module. Roles with 'access own profile' will see the 'my account' menu item, others won't. 'Access user profiles' permission, as plural implies, still allows access to all user profiles, regardless of the 'access own profile'.
I hope this helps. Please let me know if there are any problems I missed.
Almost there
Thanks! This is exactly what I needed for one of my sites.
You missed one thing: A user can still get to their Edit page if they enter the URL explicitly. To fix that, make one more change, around lines 714-716, from:
to:
It looks like a similar
It looks like a similar access change is required another 15 or so lines down to:
if (arg(2) == 'edit') {.......
'My workaround' for 4.7.2
Some very minor additions/changes for v4.7.2:
in modules/user.module
1. line 435
return array('administer access control', 'administer users', 'access user profiles', 'change own username');
with
return array('administer access control', 'administer users', 'access user profiles', 'change own username', 'access own profile');
2. line 700, replace
$view_access = user_access('access user profiles');
with
$view_access = (user_access('access user profiles')||user_access('access own profile'));
3. line 770
if ($user->uid ) {
with
if ($view_access ) {
4. line 798 (to stop users messing with email&password, even if they get access)
$items[] = array('path' => 'user/'. arg(1) .'/edit', 'title' => t('edit'),
'callback' => 'user_edit', 'access' => $admin_access || $user->uid == arg(1),
'type' => MENU_LOCAL_TASK);
$items[] = array('path' => 'user/'. arg(1) .'/edit', 'title' => t('edit'),
'callback' => 'user_edit', 'access' => $admin_access || $view_access,
'type' => MENU_LOCAL_TASK);
with
$items[] = array('path' => 'user/'. arg(1) .'/edit', 'title' => t('edit'),
'callback' => 'user_edit', 'access' => $admin_access,
'type' => MENU_LOCAL_TASK);
$items[] = array('path' => 'user/'. arg(1) .'/delete', 'title' => t('delete'),
'callback' => 'user_edit', 'access' => $admin_access,
'type' => MENU_CALLBACK);
version 4.7.3?
Halo,
I think that the posts in this section will be very useful for many users. I know that they were for me... I was wondering how to do this and I came up with these posts and I tried them at once.
The thing is that I am currently using version 4.7.3 and I have a small problem. I can not make the access own profile work. Even when I assign this permission to some user he does not have right to do so. Is there some difference that you know of in version 4.7.3? It might be my mistake that it does not work because I didn't find exactly the lines in step 4 that I should replace. Can you possibly give me some help on that?
Thanks a lot,
esord
Work around for 5 Beta 1
Hi Alex,
I'm working on a Drupal 5 Beta 1 and would apply your workaround. I found that the 1. 2. 3. Steps of code changing are the same. But the lastpoint is not. Will be nice if you can take a look at the code a supplyed as from User.module of Drupal 5B1 here. Thanks.
Drupal User with some test Drupal show cases:
http://www.adaccs.at/test/ Link to a DRUPAL 5 Beta 1 Showcase Site
Contact me for drupal projects in English, German, Italian, Drupal Hosting Support.
Work around for 5 Beta 1
Hi Wolfflow,
I think it's as simple as removing the || in the first expression, to ensure on admins can edit account details.
Cheers, Alex
P.S. Thanks to juref for getting all this started.
Redirect to a page besides 'My Account' upon login
If you prefer not to alter core modules, you might consider instead redirecting to a page other than 'My Account' when users log in. The 'My Account' link would still appear on the navigation menu, but users would not be sent to 'My Account' by default after logging in.
Here is sample code to add to your own module to set the destination after login:
MODULENAME should be replaced with the name of your module.
'/node/123' should be replaced with the path you would to redirect to after login; leave an empty string ('') to go to the front page.
This change might do enough to reduce confusion that you don't need to alter core. Sample code is for Drupal 5.
Brandon Bowersox
brandon@ojctech.com
OJC Technologies, Inc.
www.ojctech.com, 217-278-3933 ext. 14
Brandon Bowersox-Johnson
I wanna try to change/edit My Account page????
I wanna try to change My Account Page ??
Can Anyone tell me how can i do that??
I m very curious about it.
I know its dynamically generated form, but I could not find any Location where these forms are generating.
Please give me suggestion.!
You want hook_user
A module can display info on the User page with the function hook_user.
http://api.drupal.org/api/function/hook_user/5
gpdinoz
"Everything should be made as simple as possible, but not simpler." - Albert Einstein
Regards
Geoff