You can view the error a user got at: http://i11.photobucket.com/albums/a184/McQ14/Picture1-3.png

ed_classified_utils.inc line 406

Site: nikonclassifieds.com

Comments

milesgillham’s picture

Ah, I'm not surprised. There is a type clash. In lines 405-406 of ed_classified_utils.inc:

function _ed_classified_get_duration($tid) {
  $tid=(int)trim($tid);

This is invoked by _ed_classified_get_longest_duration($terms) which thinks it is getting an array of term ids:

function _ed_classified_get_longest_duration($terms) {
  if (is_array($terms)) {
    $duration = 0;
    foreach ($terms as $term) {
      if ($term) {
        $d = _ed_classified_get_duration($term);

The problem is that $tid is assumed to be an int, but it's actually an object if we look further back through function _ed_classified_get_longest_duration($terms) to the original caller in ed_classified.module:

function _ed_classified_form_submit($form, &$form_state) {
  $node = $form['#node'];
  $terms = $node->taxonomy[_ed_classified_get_vid()];
  $expiration_changed = FALSE;
  $expiration_old = $node->expires_on;
  $expiration =  time() +  _ed_classified_days_to_seconds(_ed_classified_get_longest_duration($terms));

I'm not sure that this could ever work, $terms is an object (ie StdClass), not a list of term ids. What is going to be needed to make this work is modification to the function _ed_classified_form_submit($form, &$form_state) in ed_classified.module as follows by converting a term object into an array of term ids:

function _ed_classified_form_submit($form, &$form_state) {
  $node = $form['#node'];
  $termobjs = taxonomy_node_get_terms_by_vocabulary($node, _ed_classified_get_vid());
  foreach ($termobjs as $termobj) {
    $terms[] = $termobj->tid;
  }
  $expiration_changed = FALSE;
  $expiration_old = $node->expires_on;
  $expiration =  time() +  _ed_classified_days_to_seconds(_ed_classified_get_longest_duration($terms));

Unless anyone else has a better idea I'll do some testing and see if that works.

Cheers,

Miles

milesgillham’s picture

Status: Active » Fixed

Change applied to 6.x development branch for further testing.

Status: Fixed » Closed (fixed)

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