I receive this error when adjusting the UR block configuration(s):

Notice: Undefined index: size in user_relationship_blocks_block_save() (line 321 of /[...]/sites/all/modules/user_relationships/user_relationship_blocks/user_relationship_blocks.module).
Notice: Undefined index: sort in user_relationship_blocks_block_save() (line 322 of /[...]/sites/all/modules/user_relationships/user_relationship_blocks/user_relationship_blocks.module).

It appears this was an issue during porting to D7 as well, as described in this thread: http://drupal.org/node/671816 (quoted below)

"8. When try to display a block for a one-way relationship--such as "My Relationships: one way friends (Them to You, normal direction)"--I'm getting the following error message shown along with the block:

Notice: Undefined property: stdClass::$sort in template_preprocess_user_relationships_block() (line 371 of /home/sandboxes/sandbox10/public_html/sites/all/modules/contrib/user_relationships/user_relationship_blocks/user_relationship_blocks.module).
Notice: Undefined property: stdClass::$size in template_preprocess_user_relationships_block() (line 377 of /home/sandboxes/sandbox10/public_html/sites/all/modules/contrib/user_relationships/user_relationship_blocks/user_relationship_blocks.module)"

help is always very much appreciated. thanks for the amazing module.

Comments

Status:Active» Postponed (maintainer needs more info)

The default values for both are set just a few lines above that:

<?php
 
if (empty($settings->sort)) {
   
$settings->sort = 'newest';
  }
  if (empty(
$settings->size)) {
   
$settings->size = 10;
  }
?>

No idea why you'd get such an error. Do you have these lines?

Here's line 345-379 of /[...]/sites/all/modules/user_relationships/user_relationship_blocks/user_relationship_blocks.module:

/**
* Template pre processor for the main block view
*/
function template_preprocess_user_relationships_block(&$variables) {
$account =& $variables['account'];
$settings =& $variables['settings'];
$extra =& $variables['extra'];

$query_opts = array('include_user_info' => TRUE);

if (empty($settings->sort)) {
$settings->sort = 'newest';
}
if (empty($settings->size)) {
$settings->size = 10;
}

// select the appropriate set of relationships based on admin's configuration settings
switch ($settings->sort) {
case 'newest': $query_opts['order'] = array('changed', 'DESC'); break;
case 'oldest': $query_opts['order'] = array('changed', 'ASC'); break;
case 'random': $query_opts['order'] = 'RAND()'; break;
}

$query_opts['limit'] = $settings->size;

$key = $extra ? ($extra == 'you_to_them' ? 'requester_id' : 'requestee_id') : 'user';
$args = array($key => $account->uid, 'approved' => TRUE);

if ($settings->rtid != UR_BLOCK_ALL_TYPES) {
$args['rtid'] = $settings->rtid;
}

$variables['relationships'] = user_relationships_load($args, $query_opts);
}

Same issue here.

The notices from 321 and 322 seem possible but as Berdir the values in template_preprocess_user_relationships_block() are being set and the line numbers 371 and 377 don't correspond to uses of either of those keys. I'd mark the second half of this as cannot reproduce.

I'm getting the same message as well when I save the block configure form for the UR Actions block. I checked and the defaults are referenced as stated in comment #1.

I'm on the dev version: 7.x-1.0-alpha4+12-dev

Notice: Undefined index: size in user_relationship_blocks_block_save() (line 321 of /home/jamluhu/public_html/sites/all/modules/user_relationships/user_relationship_blocks/user_relationship_blocks.module).
Notice: Undefined index: sort in user_relationship_blocks_block_save() (line 322 of /home/jamluhu/public_html/sites/all/modules/user_relationships/user_relationship_blocks/user_relationship_blocks.module).

Any tests I should run? I'll take a look in devel and see what I can find out.

Same thing here...

subscribe:
Notice: Undefined index: size in user_relationship_blocks_block_save() (Zeile 321...
Notice: Undefined index: sort in user_relationship_blocks_block_save() (Zeile 322...

UR version 7.1 alpha5

same issue

Same here.

I add some code lines after:

if (empty($edit['bid'])) {
      $edit['bid'] = $edit['delta'];
    }

Add:

if (empty($edit['sort'])) {
      $edit['sort'] = 'newest';
    }
    if (empty($edit['size'])) {
      $edit['size'] = 10;
    }