You are here

function reviews_load in Reviews 7

Helper function to load a review into an object.

1 call to reviews_load()
reviews_edit_review in includes/reviews.pages.inc
Form builder for edit review page.

File

includes/reviews.api.inc, line 166
This file contains API functions for the reviews system.

Code

function reviews_load($rid) {
  $review = db_select('reviews', 'r')
    ->fields('r')
    ->condition('rid', $rid, '=')
    ->execute()
    ->fetchAll();
  if (count($review) != 0) {
    $tmp = unserialize($review[0]->review);
    $rvw = new stdClass();
    $rvw->rid = $rid;
    $rvw->nid = $review[0]->nid;
    $rvw->uid = $review[0]->uid;
    $rvw->review = array(
      'value' => $tmp['value'],
      'format' => $tmp['format'],
    );
    $rvw->rating = $review[0]->rating;
    $rvw->created = $review[0]->created;
    return $rvw;
  }
  else {
    return new stdClass();
  }
}