Closed (fixed)
Project:
GMap Module
Version:
5.x-1.x-dev
Component:
Miscellaneous
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
12 Mar 2008 at 00:56 UTC
Updated:
10 Nov 2008 at 03:56 UTC
Jump to comment: Most recent
Comments
Comment #1
scedwar commentedHmmm. This looks like a good step forward:
http://drupal.org/project/keys_api
Comment #2
agentrickardPlease do not hack or patch the core module.
The Domain module has an internal API for new features, and it was designed for just this situation. You should consider writing a small extension module -- or encouraging it as a patch to the other modules.
You want to use Domain Conf in most cases, extended by hook_domainconf. This will work for any module that stores its settings in the {variables} table.
In the sample code, the default user picture is changed for each subdomain. You can do the same for gmap
If the module uses its own database tables, then Domain Prefix is the correct answer, and no hacking is necessary.
However, there are instances, such as with Forums, where modules use both database tables and {variables}. These cases do not have a general solution yet, and must be considered on a case-by-case basis.
I looked at the modules mentioned. Gmap and Recaptcha use the {variables} table exclusively and should be extensible using hook_domainconf.
Comment #3
agentrickardhttp://drupal.org/project/keys_api is interesting, but I don't think it solves your problem -- though it might.
Comment #4
scedwar commentedThanks - that was just the info I needed.
When I said "patching the original module" I meant, for example, patching gmap to be domain module aware using your hooks.
keys_api could be a more elegant solution that hopefully all module developers with api keys would adopt.
Comment #5
agentrickardGot it. I looked briefly at keys_api, and it doesn't quite work with Domain (due to the variables/table mixture).
Comment #6
scedwar commentedI've just been trying this out with beta1 and all seems fine. Am I missing the problem, or have you slipped this in to the new release? :-)
Comment #7
scedwar commentedAnd this code also appears to work for setting recaptcha keys: http://drupal.org/node/150100#comment-775278
Comment #8
agentrickardI don't understand comment #6.
http://drupal.org/node/150100#comment-775278 is fine if you are not using Domain Configuration module. If you are. it would be better to implement hook_domainconf(). Otherwise, you end up running similar lookup code multiple times.
Comment #9
scedwar commentedYou said: "I looked briefly at keys_api, and it doesn't quite work with Domain (due to the variables/table mixture)."
I said: "I've just been trying this out with beta1 and all seems fine. Am I missing the problem?"
My point is that keys_api appears to be working with domain although I haven't done extensive testing. What are the issues that cause you to say "it doesn't quite work"?
Thanks, Stephen
Comment #10
agentrickardI have not tested keys_api. My concern, simply from looking at the code, is that the table storage may complicate the use of Domain Conf.
If there is no conflict, that's great, but I have not made any changes to accommodate keys_api.
Comment #11
Memeshift commentedKeep in mind that when working with subdomains you'll need to generate a SEPARATE Google API Map key for each site.
For instance if you have TWO Drupal installs, like one in the root and one in a directory with a sub domain, you'll need TWO API Keys.
i.e. one key for http://www.sandbox.mywebsite.com
and another key for http://www.mywebsite.com
I just figured this out pretty quickly, but for those who get stuck...
-morgan
Comment #12
agentrickardFor integrating these types of features into Domain Access, see http://therickards.com/api/function/hook_domainconf/Domain
Comment #13
duellj commentedI ran into this very problem with my multi-domain setup with the Domain module. Here's an implementation of hook_domainconf that fixes the problem:
Comment #14
agentrickardExactly.
Comment #15
Anonymous (not verified) commentedI need multiple Google Maps API keys for my sites and am trying to implement this, but must be doing something wrong...
I've put the code from #13 into my template.php file (I'm assuming that's where it goes), but cannot find where to add extra API keys.
I've looked in the GMap settings, Domain-specific settings and batch update settings but can't see anything...
Comment #16
agentrickardYou can't put it in template.php, that is too late.
It either needs to go in a custom module file (which is what #13 does), or you can create the following file:
See section 4.2 Using domain_conf.inc of the Domain Conf README.txt file.
Comment #17
Anonymous (not verified) commentedThanks, creating a domain_conf.inc file did the trick.
Had to rename the function to 'gmap_domainconf()', but that wasn't too hard ;)
I'll see about adding this to the GMap module...