Monster Menu + User Directories

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Monster Menu + User Directories

ttronslien
Preamble: Monster Menu Help text reads When enabled, each newly-added user gets a personal home page, starting at users. Note: If you disable and then re-enable this option, any users created during the time it was disabled will not have home pages.

I've been able to add the user to the user list,  assigned a 'user_home' based on the userid and gave the user full ownership. The user can log in and add content to their "home," using the assigned content type at location users/username.

The issue: when the user logs in and when we view the user record from administrative view we are directed to Drupal's default user/uid instead of Monster Menus users/username - which would be preferred.

The Question: is the opportunity for the redirect to work gone when the user was created during a time when personal homepage option was disabled or is there something I am missing?

In advance, thanks for any input.


Tove Tronslien, MSc, Informatics
Manager, Web Development Services
Lakehead University
Thunder Bay | Orillia, Ontario, Canada
[hidden email]
(807) 343-8499

i am slowly going crazy 1 2 3 4 5 6 switch 

---

You are currently subscribed to monster_menus as: [hidden email].

To unsubscribe click here: http://lists.middlebury.edu/u?id=685503.6b071f880fe6a965a128164e6d09ea81&n=T&l=monster_menus&o=690084

(It may be necessary to cut and paste the above URL if the line is broken)

or send a blank email to [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Monster Menu + User Directories

Dan Wilga-2
Hi Tove,

MM doesn't really do anything to alter what happens when a user first logs-in. There are really so many possible things that could happen, that I don't think it's a good idea for MM to try to second-guess what the "best" outcome is. Here at Amherst, we use custom code to go to one of two places, depending on context:

  1. If the user is starting from the site's homepage, go to a "portal" page that is generated by the homebox module and an extension we wrote.
  2. Otherwise, return the user to the last page they were at before logging-in. That way, they get to the see the page with proper permissions, whereas they may not have been able to see the content prior to logging-in.

If you really do want the behavior you noted, I might suggest you write a short implementation of hook_user_login() which looks something like this (untested):

function mymodule_user_login(&$edit, $account) {
  $edit['redirect'] = 'users/' . $account->name;
}

Or, you could redirect user/uid to users/name, which would take care of the admin links, too:

function mymodule_menu_alter(&$callbacks) {
  $callbacks['user/%user']['page callback'] = 'mymodule_goto_user';
}

function mymodule_goto_user($account) {
  mm_goto('users/' . $account->name);
}

You should test this, to make sure it doesn't interfere with user/uid/edit, which would prevent you from being able to change a user's settings as an admin.

On 6/3/13 3:02 PM, Tove Tronslien wrote:
Preamble: Monster Menu Help text reads When enabled, each newly-added user gets a personal home page, starting at users. Note: If you disable and then re-enable this option, any users created during the time it was disabled will not have home pages.

I've been able to add the user to the user list,  assigned a 'user_home' based on the userid and gave the user full ownership. The user can log in and add content to their "home," using the assigned content type at location users/username.

The issue: when the user logs in and when we view the user record from administrative view we are directed to Drupal's default user/uid instead of Monster Menus users/username - which would be preferred.

The Question: is the opportunity for the redirect to work gone when the user was created during a time when personal homepage option was disabled or is there something I am missing?

In advance, thanks for any input.


Tove Tronslien, MSc, Informatics
Manager, Web Development Services
Lakehead University
Thunder Bay | Orillia, Ontario, Canada
[hidden email]
(807) 343-8499
-- 
Dan Wilga                                 [hidden email]
Web System Administrator/Programmer             http://www.amherst.edu
Amherst College                                      Tel: 413-542-2175
Amherst, MA  01002

---

You are currently subscribed to monster_menus as: [hidden email].

To unsubscribe click here: http://lists.middlebury.edu/u?id=685503.6b071f880fe6a965a128164e6d09ea81&n=T&l=monster_menus&o=690094

(It may be necessary to cut and paste the above URL if the line is broken)

or send a blank email to [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Monster Menu + User Directories

ttronslien
In reply to this post by ttronslien
Thanks Dan,

I will likely go with the hook user_login, where I will check for the users role and make the redirect based on the role.

I do however find it interesting/inconsistent that my own user takes me to the page users/username when I login.


Tove Tronslien, MSc, Informatics
Manager, Web Development Services
Lakehead University
Thunder Bay | Orillia, Ontario, Canada
[hidden email]
(807) 343-8499


On Mon, Jun 3, 2013 at 3:36 PM, Dan Wilga <[hidden email]> wrote:
Hi Tove,

MM doesn't really do anything to alter what happens when a user first logs-in. There are really so many possible things that could happen, that I don't think it's a good idea for MM to try to second-guess what the "best" outcome is. Here at Amherst, we use custom code to go to one of two places, depending on context:

  1. If the user is starting from the site's homepage, go to a "portal" page that is generated by the homebox module and an extension we wrote.
  2. Otherwise, return the user to the last page they were at before logging-in. That way, they get to the see the page with proper permissions, whereas they may not have been able to see the content prior to logging-in.

If you really do want the behavior you noted, I might suggest you write a short implementation of hook_user_login() which looks something like this (untested):

function mymodule_user_login(&$edit, $account) {
  $edit['redirect'] = 'users/' . $account->name;
}

Or, you could redirect user/uid to users/name, which would take care of the admin links, too:

function mymodule_menu_alter(&$callbacks) {
  $callbacks['user/%user']['page callback'] = 'mymodule_goto_user';
}

function mymodule_goto_user($account) {
  mm_goto('users/' . $account->name);
}

You should test this, to make sure it doesn't interfere with user/uid/edit, which would prevent you from being able to change a user's settings as an admin.


On 6/3/13 3:02 PM, Tove Tronslien wrote:
Preamble: Monster Menu Help text reads When enabled, each newly-added user gets a personal home page, starting at users. Note: If you disable and then re-enable this option, any users created during the time it was disabled will not have home pages.

I've been able to add the user to the user list,  assigned a 'user_home' based on the userid and gave the user full ownership. The user can log in and add content to their "home," using the assigned content type at location users/username.

The issue: when the user logs in and when we view the user record from administrative view we are directed to Drupal's default user/uid instead of Monster Menus users/username - which would be preferred.

The Question: is the opportunity for the redirect to work gone when the user was created during a time when personal homepage option was disabled or is there something I am missing?

In advance, thanks for any input.


Tove Tronslien, MSc, Informatics
Manager, Web Development Services
Lakehead University
Thunder Bay | Orillia, Ontario, Canada
[hidden email]
<a href="tel:%28807%29%20343-8499" value="+18073438499" target="_blank">(807) 343-8499
-- 
Dan Wilga                                 [hidden email]
Web System Administrator/Programmer             http://www.amherst.edu
Amherst College                                      Tel: <a href="tel:413-542-2175" value="+14135422175" target="_blank">413-542-2175
Amherst, MA  01002

---

You are currently subscribed to monster_menus as: [hidden email].

To unsubscribe click here: http://lists.middlebury.edu/u?id=685503.6b071f880fe6a965a128164e6d09ea81&n=T&l=monster_menus&o=690097

(It may be necessary to cut and paste the above URL if the line is broken)

or send a blank email to [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Monster Menu + User Directories

Dan Wilga-2
In reply to this post by ttronslien
I double-checked the code, and I can't see any reason why this would be working for you and not other users. Unfortunately, I don't have an easy way to test things without our own custom code interfering.

By the way, the example URL I gave would be better written as:

if (!empty($account['user_mmtid'])) {
  $edit['redirect'] = 'mm/' . $account['user_mmtid'];
}

That way, if the user does not have a value in this field for some reason, they won't end up at a Page Not Found.

On 6/3/13 3:40 PM, Tove Tronslien wrote:
Thanks Dan,

I will likely go with the hook user_login, where I will check for the users role and make the redirect based on the role.

I do however find it interesting/inconsistent that my own user takes me to the page users/username when I login.


Tove Tronslien, MSc, Informatics
Manager, Web Development Services
Lakehead University
Thunder Bay | Orillia, Ontario, Canada
[hidden email]
(807) 343-8499


On Mon, Jun 3, 2013 at 3:36 PM, Dan Wilga <[hidden email]> wrote:
Hi Tove,

MM doesn't really do anything to alter what happens when a user first logs-in. There are really so many possible things that could happen, that I don't think it's a good idea for MM to try to second-guess what the "best" outcome is. Here at Amherst, we use custom code to go to one of two places, depending on context:

  1. If the user is starting from the site's homepage, go to a "portal" page that is generated by the homebox module and an extension we wrote.
  2. Otherwise, return the user to the last page they were at before logging-in. That way, they get to the see the page with proper permissions, whereas they may not have been able to see the content prior to logging-in.

If you really do want the behavior you noted, I might suggest you write a short implementation of hook_user_login() which looks something like this (untested):

function mymodule_user_login(&$edit, $account) {
  $edit['redirect'] = 'users/' . $account->name;
}

Or, you could redirect user/uid to users/name, which would take care of the admin links, too:

function mymodule_menu_alter(&$callbacks) {
  $callbacks['user/%user']['page callback'] = 'mymodule_goto_user';
}

function mymodule_goto_user($account) {
  mm_goto('users/' . $account->name);
}

You should test this, to make sure it doesn't interfere with user/uid/edit, which would prevent you from being able to change a user's settings as an admin.


On 6/3/13 3:02 PM, Tove Tronslien wrote:
Preamble: Monster Menu Help text reads When enabled, each newly-added user gets a personal home page, starting at users. Note: If you disable and then re-enable this option, any users created during the time it was disabled will not have home pages.

I've been able to add the user to the user list,  assigned a 'user_home' based on the userid and gave the user full ownership. The user can log in and add content to their "home," using the assigned content type at location users/username.

The issue: when the user logs in and when we view the user record from administrative view we are directed to Drupal's default user/uid instead of Monster Menus users/username - which would be preferred.

The Question: is the opportunity for the redirect to work gone when the user was created during a time when personal homepage option was disabled or is there something I am missing?

In advance, thanks for any input.


-- 
Dan Wilga                                 [hidden email]
Web System Administrator/Programmer             http://www.amherst.edu
Amherst College                                      Tel: 413-542-2175
Amherst, MA  01002

---

You are currently subscribed to monster_menus as: [hidden email].

To unsubscribe click here: http://lists.middlebury.edu/u?id=685503.6b071f880fe6a965a128164e6d09ea81&n=T&l=monster_menus&o=690105

(It may be necessary to cut and paste the above URL if the line is broken)

or send a blank email to [hidden email]

Loading...