Closed (fixed)
Project:
MySite
Version:
5.x-2.2
Component:
Code
Priority:
Minor
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
27 Jun 2007 at 13:53 UTC
Updated:
30 Jun 2007 at 22:05 UTC
When accessing a user's MySite page (e.g. /mysite/123/view) for the very first time I get a redirect loop. The loop is caused by mysite_page(123,TRUE) calling theme_mysite_create_help on line 622 which in turn calls mysite_page(0, FALSE) on line 2747. The latter results in a call to drupal_goto('mysite/'.$user->uid.'/view') on line 702, redirecting the browser to the very same page (/mysite/123/view).
I've attached a patch fixing this issue.
| Comment | File | Size | Author |
|---|---|---|---|
| mysite_2.patch | 496 bytes | sos4nt |
Comments
Comment #1
agentrickardI have a feeling that permission configuration causes this error, since I've never seen it before.
What permission settings do you have for the MySite access control? What role is user 123?
Comment #2
agentrickardI cannot replicate this error.
My suspicion is this problem occurs when someone other than the user tries to look at their MySite page before it has been created.
There must be something else going on here, because look at the existing code: (#comments are added for clarity)
It looks like this may occur IF you have 'administer mysite' permissions AND no page has been created yet, but I could not duplicate the error.
Comment #3
agentrickardTitle change: 'default view' means something else in the MySite context. It means the MySite user page to show at path 'mysite/default' (which is unrelated to this issue).
Comment #4
sos4nt commentedThanks for your help. The user (role) didn't have permission to "view all mysites" and that caused the redirect loop. I changed the permissions and now everything is fine.
However, I think it would be better to show an access denied page if the user doesn't have permission to view his or her own MySite page.
Comment #5
agentrickardI'm still a little confused by this behavior, and it probably needs to be corrected.
User 123 is looking at his/her own page: 'mysite/123/view'? And has the 'edit own mysite' permission but not 'view all mysites'?
Comment #6
sos4nt commentedThat's right. User 123 with "edit mysite" permission and without "view all mysites" permissions gets this redirect loop when accessing
mysite/123/view. This only happens as long as there's no MySite database entry for this user.Everything works as expected when setting the "view all mysites" permission, i.e. default MySite page with "start by customizing the settings for your personal page" message.
Comment #7
agentrickardConfirmed and fixed in HEAD.
My fix is slightly different, as if requires two changes to IF statements.
Line 565:
if ($user->uid > 0 && user_access('edit mysite')) {Line 628:
else if (user_access('administer mysite') || $mysite->uid == 0 || ($mysite->status == 1 && user_access('view all mysites'))) {Comment #8
sos4nt commentedGreat, thanks!
Comment #9
agentrickardFixed in 5.x.2.3