did a backtrace, and the code that is causing this issue is in domain_form_alter() on line 1812.
on admin/build/domain/settings I have
SEO: Do not rewrite URLs
Default source domain: Do not change domain
Diving into why this happens; working backwards.
Line 1811: $domain == -1 - This triggers the if statement
Line 1809: $domain = domain_lookup($first_domain);
Line 1780: $first_domain = current($user_domains); $first_domain = -1 at this point
Line 1775-1779:
foreach ($user->domain_user as $key => $value) {
if (abs($value) > 0) {
$user_domains[] = $value;
}
}
In domain_get_user_domains()
if ($data->domain_id == 0) {
$domains[$uid]['-1'] = -1;
}
But in domain_lookup() there is no special case for -1. Working on a patch.
Comments
Comment #1
mikeytown2 commentedComment #2
mikeytown2 commenteddiff in patch takes care of secondary issue where user is assigned to current domain; but is still redirected.
Comment #3
bleen commentedI'm having this identical issue (for one, and only one of my users WTF?) but this patch does not seem to fix the issue .. I havent had much time to do anything other than try the patch and note that it doesnt help
Comment #4
bleen commentedincidentally, shouldn't this be:
Comment #5
mikeytown2 commented@bleen18
The user will get redirected to the domain default (did:0) if that user is not assigned to the current domain. If the user tries to create a node on a domain they are not assigned to, they will be redirected to one where they have the correct permissions to do so (domain_default()).
Yes, you could combine both if statements into one like you did.
What are the inputs & what is the desired outcome for your situation?
Comment #6
bleen commentedUser ONLY belongs to domian ID 4 ... she goes to domain4.com/node/add, fills in form, hits save and gets redirectoed to domain0.com/title-of-new-content
If she goes back and edits domain4.com/title-of-new-content everything works fine
Its driving me nuts. This is the only one of my "bloggers" that has this issue.
EDIT:
Also, SEO rewrite = on
Comment #7
mikeytown2 commentedmy patch #2 only works with SEO = off. Looks like I need to redo the patch after reading the SEO configuration
By "all node links", I think this means node/NUMBER not node/* thus the
elseif (variable_get('domain_seo', 0) == 0) {check is not needed in the patch.Comment #8
agentrickardThe issue that bleen18 is one of the oldest, most frustrating issues in the queue. Currently we even try to handle this redirect with session handling. See #624360: First time node save gets redirected to main domain
Comment #9
agentrickardSee also #683400: ImageField Tokens causes redirect to main domain on node save
Comment #10
bleen commentedagentrickard - that issue seems to fit my symptoms, but only for one user?!
Comment #11
bleen commentedEDIT: removed incorrect info
More info: Ok, so it turns out this is not isolated to one blogger (only one blogger who is smart enough to report it). As of 5 days ago, my site had 5 domains (including the Main domain) ad we did not see this behavior. We added a 6th domain, and it was then (I suspect but cannot prove) that we began having the problem of redirecting to the main domain on node->save
Why would it have worked fine for all this time, and now stop?
... I should probably be moving these comments to the other issue, huh?
Comment #12
bleen commentedTurns out that #227947-50: After editing nodes user is redirected to the main domain did the trick for me ... agentrickard: thanks for pointing me in the right direction ... any response to #227947-61: After editing nodes user is redirected to the main domain would be welcome.
Comment #13
agentrickardMoving to needs work based on #7.
Comment #14
sukr_s commentedIn my case, the user is always redirected to a first domain (can be any domain other than primary domain). debugging i found that in domain.module, domain_form_alter function redirects the user to the first domain irrespective of the current domain due to the line 1832 where current($user_domains) is used and this returns the first domain_id in the array.
the following changes which checks if the current domain is in user's domain list and then retains the current domain_id or it reassigns the first one fixes this problem i.e. change line 1832
to
can domain access expert comment if this fix is okay or has any side effects?
Comment #15
agentrickardhttp://drupal.org/patch/create
Please patch against DRUPAL-6--2. Instructions are at http://drupal.org/project/domain/cvs-instructions.
And please format your code to conventions. http://drupal.org/coding-standards
Comment #16
sukr_s commentedhere is the patch for #14. can this be reviewed and applied?
Comment #17
agentrickardProperly formatted patch.
Reviewers?
Comment #18
R.Muilwijk commentedsubscr
Comment #19
agentrickardThanks for nothing, @R.Muilwijk
Please _review the patch_.
Comment #20
mikeytown2 commentedpatch #17 appears to fix this issue. Will RTBC after we thoroughly test this.
Comment #21
agentrickardHooray!
Comment #22
agentrickardCurrent patch for 6.x. Committed.
Comment #23
mikeytown2 commentedForgot to report back. Yes the patch works great! Thanks again!
Comment #24
agentrickardPatch for both versions of 7. Committed.