The following Members Profile script works well in both PHP4 and PHP5 with Drupal 6.5, but fails and causes the following error in PHP5 with Drupal version 6.6 through 6.17:

Fatal error: Cannot access empty property in /home/iamtotal/public_html/includes/common.inc(1699) : eval()'d code on line 28

Any ideas on how I can fix the following code to make it work now?

I am currently running Drupal 6.17.

Thanks in advance,

Sam308

Members Profile script:

<?php
// Displays a list of all users (all roles)

$header = array(
          array('data' => t('Username'), 'field' => 'u.name'),
          array('data' => t('Photo'), 'field' => 'u.picture'),
          array('data' => t('Accepting Donations')),
          array('data' => t('Gender')),
          array('data' => t('Age')),
          array('data' => t('Marital Status')),
          array('data' => t('Location')),
    //      array('data' => t('Zipcode')),
          array('data' => t('Profession')),
          array('data' => t('Education')),
          array('data' => t('Income Situation')),
          array('data' => t('Last access'), 'field' => 'u.access', 'sort' => 'desc')
);
$sql = 'SELECT u.uid, u.name, u.status, u.created, u.access, u.picture FROM {users} u WHERE (uid != 0 and uid != 1)';
$sql .= tablesort_sql($header);
$result = pager_query($sql, 20);

$status = array(t('blocked'), t('active'));
while ($account = db_fetch_object($result)) {
       $account = user_load(array('uid' => $account->uid));
       if($account->picture){$account->picture = '<a href="?q=user/'.$account->uid.'"><img src="'.$account->picture.'" height="50" width="50" border="1" alt=""></a>';}
         else{$account->picture = '<a href="?q=user/'.$account->uid.'"><img src="../assets/images/default-user-sm.gif" height="50" width="50" border="1" alt=""></a>';}
       if ($account->profile_accepting_donations_status == 1) { $account->profile_accepting_donations_status = "Yes"; } else { $account->profile_accepting_donations_status = "No"; }
       if ($account->profile_location == "" ||  $account->profile_location == "0") { $account->$profile_location = "---"; }
       if ($account->profile_education == "" ||  $account->profile_education == "0") { $account->$profile_education = "---"; }
       if ($account->profile_income == "" ||  $account->profile_income == "0") { $account->profile_income = "---"; }


$rows[] = array(theme('username', $account),
          $account->picture,
          $account->profile_accepting_donations_status,
          $account->profile_gender,
          $account->profile_age,
          $account->profile_marital_status,
          $account->profile_location,
  //        $account->profile_zipcode,
          $account->profile_profession,
          $account->profile_education,
          $account->profile_income,
          $account->access ? t('%time ago', array('%time' => format_interval(time() - $account->access))) : t('never')
          );
}

$output = theme('table', $header, $rows);
$output .= theme('pager', NULL, 20, 0);
print ($output);
?>

Comments

cog.rusty’s picture

Try changing

->$

to

->

(in 2 places).

Sam308’s picture

Thanks, it worked