The install function has two bugs which prevent proper installation and use of the module. This may or may not be due to changes in the relation module.

Anyway this is what the function looks like now:

function subuser_install() {
  $record = array(
    'predicate' => 'subuser',
    'label' => t('Subuser'),
    'directional' => TRUE,
    'source_bundles' => array('user:user'),
    'target_bundles' => array('user:user'),
  );
  relation_type_save($record);
}

This is what it should look like:

function subuser_install() {
  $record = array(
    'relation_type' => 'subuser',
    'predicate' => 'subuser',
    'label' => t('Subuser'),
    'directional' => TRUE,
    'source_bundles' => array('user:user'),
    'target_bundles' => array('user:user'),
  );
  $record = (object) $record;
  relation_type_save($record);
}

The function relation_type_save() expects an object and also expects the value 'relation_type' to be set.

Comments

BillyTom’s picture

I got the following error when trying to enable this module:
Invalid argument supplied for foreach() relation.module:278 [warning]

Your changes to the install file made it work, thanks.

zeit_geist’s picture

It works fine with me 2. Thx for good job.

hooface’s picture

Thanks.

akalata’s picture

Status: Active » Closed (duplicate)

Consolidating install issues. Marking as duplicate of #1241934: Relation API has changed so subuser install is broken.