You are here

function activity_load in Activity 6

1 call to activity_load()
template_preprocess_views_view_row_activity in ./activity.views.inc
Template handler for theme_views_view_row_activity().

File

./activity.module, line 1420
activity.module

Code

function activity_load($aid) {

  // Build the sql and do the query. Wrapping it in db_rewrite_sql allows other
  // modules to impose access restrictions on activity listings.
  $sql = "SELECT activity.*, activity_targets.target_uid, activity_targets.target_role\n    FROM {activity_targets} activity_targets INNER JOIN {activity} activity ON activity.aid = activity_targets.aid\n    WHERE activity.aid = %d";
  $row = db_fetch_array(db_query(db_rewrite_sql($sql, 'activity_targets', 'aid'), $aid));
  if (!empty($row)) {
    $row['data'] = unserialize($row['data']);
    $row['data']['aid'] = $row['aid'];
    $row['data']['uid'] = $row['uid'];
    $row['data']['module'] = $row['module'];
    $row['data']['type'] = $row['type'];
    $row['data']['operation'] = isset($row['data']['operation']) ? $row['data']['operation'] : $row['operation'];
    $row['data']['created'] = $row['created'];

    // Load Activity comments
    $row['comments'] = activity_comments_load($row['aid']);

    // Invoke activityapi
    activity_invoke_activityapi($row, 'load');
  }
  return $row;
}