Is it possible to have two different access denied pages? I would like the main domain (example.com) to show one version of the access denied page, and the sub.example.com to show a different version. We currently have a custom access denied page that is set in admin/settings/error_reporting .
If you have any suggestions about this, please let me know. :)
Comments
Comment #1
agentrickardSure. Use hook_domainbatch() to expose that variable. See API.php.
You want something similar to what is used for the frontpage:
Comment #2
davidsje commentedThanks for the quick response :)
I'll try it out and let you know how it goes.
Comment #3
davidsje commentedAck, server problems! And it probably won't get fixed until after 5pm. I'll get back to this issue in a couple weeks (after my vacation).
In the meantime, where is that frontpage code located?
Thanks!
Comment #4
agentrickardhttp://api.therickards.com/api/function/domain_conf_domainbatch/domain
I may just go ahead and add these, since it is pretty easy.
Comment #5
agentrickardTurns out this is really easy in the D6 version (which uses hook_domainbatch() for all configuration settings).
In D5, hook_domainbatch() only adds to the batch update screen (which may be enough). you would need additional code to domain_conf_form_alter() in order to add the setting to the normal configuration screen.
To really make this work, the domain_conf_form() changes from D6 would have to be backported, which isn't likely to happen.
Comment #6
agentrickardThe patch to backport is #405148: Remove hook_form_alter from Domain Conf (patch from #2)
Comment #7
davidsje commentedSorry about the delay - I've been on vacation. Thanks for your repsonses, they're helpful.
I haven't added the patch yet - I don't know if it's needed. I can set the custom access denied page for the main page at admin/settings/error_reporting. Then with the code you provided, I should be able to set the subdomain's access denied page on the domain settings page.
However, I put the code you provided (from #5) into the domainbatch function in domain_conf.module and ran update.php. The new option is still not showing up in the domain settings.
Anything I might have forgotten to do?
Comment #8
davidsje commentedI did make one change to the code you provided. There was a #variable set to 'site_frontpage', and I changed it to 'site_403'. However, the option still doesn't show up on the subdomain's domain settings page (admin/build/domain/conf/1).
Comment #9
davidsje commentedI misunderstood why the patch was needed - I'll add it straight away (as I don't have access to the batch update screen on this site).
Thanks!
Comment #10
davidsje commentedI tried adding the patch and here is the output:
/var/www/drupal-5.1/sites/all/modules/domain$ patch -p0 < 405148-conf.patch
patching file API.php
Hunk #1 succeeded at 445 (offset -4 lines).
can't find file to patch at input line 37
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|Index: domain_conf/domain_conf.admin.inc
|===================================================================
|RCS file: /cvs/drupal-contrib/contributions/modules/domain/domain_conf/domain_conf.admin.inc,v
|retrieving revision 1.7
|diff -u -p -r1.7 domain_conf.admin.inc
|--- domain_conf/domain_conf.admin.inc 25 Mar 2009 17:31:44 -0000 1.7
|+++ domain_conf/domain_conf.admin.inc 25 Mar 2009 20:01:20 -0000
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.
3 out of 3 hunks ignored
patching file domain_conf/domain_conf.module
Hunk #1 FAILED at 125.
Hunk #2 succeeded at 380 (offset 206 lines).
Hunk #4 succeeded at 414 (offset 206 lines).
Hunk #6 succeeded at 448 (offset 206 lines).
misordered hunks! output would be garbled
Hunk #8 FAILED at 386.
Hunk #9 FAILED at 403.
Hunk #10 FAILED at 419.
Hunk #11 FAILED at 434.
Hunk #12 FAILED at 451.
Hunk #13 FAILED at 470.
Hunk #14 FAILED at 486.
Hunk #15 FAILED at 498.
9 out of 15 hunks FAILED -- saving rejects to file domain_conf/domain_conf.module.rej
I understand the first error because there is no file with that name. I'm using Domain Access 5.x-1.14, is that what this patch was written for? I'm not very experienced with patches, so I'm not sure how to proceed. Any help would be much appreciated. Thank you.
Comment #11
agentrickardThe patch is for D6. The patch itself needs to be ported to D5.
Otherwise, the code I gave you using hook_domainbatch() will appear as a Batch option, not under Domain Conf settings.
Comment #12
davidsje commentedClosing this issue -
I got access to the "Batch Updating" portion of Domain Access, and used your suggestion of adding that block of code to domain_conf.module. It works like a charm! For now, I'm happy with being able to set this in Batch Update.
Thanks :)
Comment #13
davidsje commentedSo I guess I jumped the gun when I said it worked. It seems that the settings on admin/settings/error-reporting don't play nice with the code I added to the Domain Access module.
If the setting in /admin/settings/error-reporting is left blank, the specified error pages on the batch updating (in Domain Access) work only for the subdomain. When you specify a page for the main domain, my error page appeared incorrectly for anonymous users (instead of showing the content of my custom error page, it showed just "Content" as the title and "2" as the body).
Any ideas on how to deal with this?
Thanks :)
Comment #14
agentrickardProper hook_domainconf() on the 'site_404' and 'site_403' variables (in D5). Or hook_domainbatch() in D6.
Comment #15
agentrickardFor D6, you can also try http://drupal.org/node/713026.
Comment #16
agentrickardD5 is closed to new features.