Attached is a patch to domain.module so that when the devel generate module is used to create content, a random domain (from those available) is attached to each generated node.

For those sites that have "Enforce rules on administrators" enabled this is an absolutely necessity. Without it, generated nodes become lost in the ether.

Please include in HEAD

Comments

agentrickard’s picture

Nice!

Has anyone else tested it?

bleen’s picture

no one I know of ... "needs review" :)

agentrickard’s picture

Why is domain_site always FALSE? Should we send some content to all affiliates for testing?

And should we assign content to inactive domains?

It would also be awesome if the user could choose how they want the generation to work:

a) Random, sites only
b) Random, sites and all affilaites
c) Chosen, via a form

bleen’s picture

To be honest, I am really new to "Domain Access." I would need a bunch of guidence to get some of your suggestions working. Like, for instance ... what is the "domain_site"?

To get this patch working I simply peered into a node and reproduced its values. If you want to point me in the right direction Ill happily give it a shot...

Conceptually, I suppose we could simply add another fieldgroup to the settings tab if the generate module is installed...

Thoughts?

agentrickard’s picture

domain_site is the 'send to all affiliates grant, which you have hardcoded to FALSE. It might be as simple as a random boolean generator there.

I was thinking of using hook_form_alter() on the generate form itself, to pass values to your presave hook.

bleen’s picture

I was thinking of using hook_form_alter() on the generate form itself, to pass values to your presave hook.

even better ... giving this a whirl. I may have a few questions as I go

bleen’s picture

StatusFileSize
new3.9 KB

Ok .. this patch gives users a few more options in the devel generate form that are domain access specific.

Procedure to test:

  • install Domain with a couple of domains
  • install devel generate (part of http://drupal.org/project/devel)
  • generate some content (/admin/generate/content) ... note the two options for domain at the bottom of the form

Things to definitely pay attention to:

  • the handling of "subdomains" in the hook_nodeapi() ... I'm not positive what this should look like so I winged it
  • do a generate of >1 node and then do another generate with "delete content" checked off... I'm getting a weird error, but I'm 99% sure I was getting it before I even installed domain access. I'm 100% sure I was getting this error before this patch. Worth checking into though

Todo (assuming this all works well):

  • integrate generate users
bleen’s picture

bump

bleen’s picture

This couldn't make it in v2.1?

agentrickard’s picture

Obviously not. 6.x is really in bugfix only mode.

Anyone else care to review this patch?

nonsie’s picture

StatusFileSize
new3.57 KB

Here's a bit improved patch. It will come quite handy while trying to solve #534170: Integrate with Domain Access

bleen’s picture

@nonsie, looks great... only thing I dont understand is this:

+ $form['#submit'][] = 'domain_devel_generate_submit';

Why is this needed?

nonsie’s picture

Your patch had a custom submit handler - this is not needed in this case.

bleen’s picture

Status: Needs review » Reviewed & tested by the community

ahahah ... I was looking at my own patch when I asked that question. DOH!

Anyway, the patch in #11 works great ...

agentrickard’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new4.97 KB

That patch was broken and failed to assign content to the default domain in my tests.

The attached seems to work, and cleans things up quite a bit. It also uses the new 'select list or checkbox' form element and move the form alter into its own, named hook.

dave reid’s picture

Feels like this should probably live in a domain_generate sub-module.

agentrickard’s picture

Status: Needs review » Fixed

Committed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.