Domain source does not support non-editor creation of nodes.

RoboPhred - November 2, 2009 - 01:50
Project:Domain Access
Version:6.x-2.0
Component:- Domain Source
Category:bug report
Priority:normal
Assigned:Unassigned
Status:fixed
Description

I am trying to allow users to create content on the domains, but I do not want them to choose a domain; the source domain should be the one the user is currently on.

When a user creates a content type, this warning is thrown:

warning: array_merge() [function.array-merge]: Argument #1 is not an array in sites/all/modules/domain/domain_source/domain_source.module on line 150.
warning: in_array() [function.in-array]: Wrong datatype for second argument in sites/all/modules/domain/domain_source/domain_source.module on line 157.
The source affiliate must be selected as a publishing option.

The current domain should be used as source for the content by default, even if the user cannot modify the domain settings.

#1

RoboPhred - November 2, 2009 - 02:46

I found the cause in domain_source_nodeapi

<?php
     
if (!empty($node->domains)) {
       
$allowed = $node->domains;
      }
      if (!empty(
$node->domains_raw)) {
       
$allowed = array_merge($node->domains, $node->domains_raw);
      }

?>

here, $allowed is set to $node->domains if $node->domains is not empty. However, if $node->domains_raw is not empty, $node->domains is still used directly. I assume this should be $allowed instead.

<?php
     
if (!empty($node->domains)) {
       
$allowed = $node->domains;
      }
      if (!empty(
$node->domains_raw)) {
       
$allowed = array_merge($allowed, $node->domains_raw);
      }

?>

#2

lara.s - November 2, 2009 - 12:10

I had the same problem on my site, the fix in post#1 solves this issue.

#3

agentrickard - November 2, 2009 - 14:44

Yes, and we need to make sure $allowed is set to an array before doing the merge.

We should probably use $allowed += $node->domains_raw; here.

#4

agentrickard - November 2, 2009 - 14:45
Version:6.x-2.x-dev» 6.x-2.0

#5

agentrickard - November 2, 2009 - 14:51
Status:active» needs review

Try this patch.

AttachmentSize
620596-ds.patch 814 bytes

#6

emilyf - November 2, 2009 - 20:05

patch works for me except when applying from within the overall domain directory, it can't find the correct file to patch. had to manually enter 'domain_source/domain_source.module'. then it worked fine.

#7

agentrickard - November 2, 2009 - 22:30
Status:needs review» fixed

OK. Committed.

#8

agentrickard - November 3, 2009 - 16:21
Status:fixed» patch (to be ported)

This (or something similar) bit the D5 version as well.

#9

agentrickard - November 3, 2009 - 16:22
Status:patch (to be ported)» needs review

Reset to a status I pay attention to.

#10

Bartezz - November 10, 2009 - 13:37

Bug confirmed--- patch reviewed and found working like a charm.

Thanx all!

#11

agentrickard - November 20, 2009 - 19:48

D5 patch.

AttachmentSize
620596-d5-source.patch 2.2 KB

#12

agentrickard - November 20, 2009 - 19:54

Committing the above and rolling 5.x.1.14 release.

#13

agentrickard - November 20, 2009 - 20:00
Status:needs review» fixed
 
 

Drupal is a registered trademark of Dries Buytaert.