Download & Extend

Hide "Send to all affiliates" and force domain selection

Project:Domain Access
Version:6.x-2.0-rc8
Component:User interface
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed (fixed)
Issue tags:user interface improvements

Issue Summary

Would it be possible to hide the checkbox "Send to all affiliates" and make the domain selection mandatory?
Right now both options are visible. I think this is strange behaviour (why is it possible to select a domain after checking "Send to all affiliates"?) which can be improved.

Comments

#1

Domain selection is already forced.

You must select a domain even if "send to all affilaites" is checked, as this is the 'root domain' for the node and is used for editing and linking purposes.

You could have a separate permission that would allow the removal of 'send to all affilaites', but I believe the current permissions cover this, see section 3 of the README.

You can do what you want now with a simple hook_form_alter. Just set $form['domain_site'] = array('#type' => 'value', '#value' => FALSE).

I might consider looking at a patch.

#2

Just my 2 cents - on one of our sites we've approached it the other way around, when "send to all affiliates" is checked a specific domain (in our case default) is checked as well. All it takes is some jquery magic. You could reverse this approach if you wanted "publish to all" checked when a specific domain is checked.

#3

Hi, I could use a little clarification too.

We are setting up a site with 3 domains and the users would like us to be able to hide the 'send to all affiliates' checkbox completely, but they would still like to be able to publish content to any and all domains by checking individual boxes only.

Is there a way to do this with the current configuration and permissions settings? If so, could you let me know what settings I need to select to make this happen? I have read section 3 of the readme.txt file and it is still unclear to me.

Thanks for your help,
Nancy

#4

I read through the readme.txt again and I think I may have answered my own question. In the domain access config, I need to assign the users to all domains. In permissions, uncheck 'set domain access' and check 'publish to any assigned domain'. That seems to have taken care of it. Thanks, Nancy

#5

Status:active» closed (fixed)

That would do it, yes. Or you could use hook_form_alter() in a custom module.

#6

Just wanted to add a quick jQuery example to follow up on comment #2 in case someone stumbles onto this issue later on. I wanted to uncheck the "send to all affiliates" box by default using jQuery. Keep in mind that, as the other comments have mentioned, this box will be unchecked as long as you have not selected to share the content for a particular node type under Domain Node Types (admin/build/domain/advanced). To uncheck the affiliates box, I added the a js file containing the following to my custom form_overrides module.

$(document).ready(function() {
if ($('input[name=domain_site]').is(':checked'))
{
  $('input[name=domain_site]').attr('checked', false);
}
});

Then, I used drupal_add_js within hook_form_alter to attach the js to a particular node type.

function form_overrides_form_alter(&$form, $form_state, $form_id) {
    switch ($form_id) {
    case 'webform_node_form':
           drupal_add_js(drupal_get_path('module', 'form_overrides') .'/uncheck_domain.js');
    break;
  }
}

I think that there's probably a better way to do this using Drupal behaviors. Additionally, just using hook_form_alter may be a simpler solution.

nobody click here