Osclass Support Forums

Osclass plugin support => User Rating Plugin => Topic started by: 7ala on September 02, 2021, 08:44:45 AM

Title: Number of user reviews
Post by: 7ala on September 02, 2021, 08:44:45 AM
welcome
Thank you for your great support
Is there a way to show the number of user ratings
or the number of item ratings
Total number per user or per item
In the user control panel

thank you
Title: Re: Number of user reviews
Post by: MB Themes on September 02, 2021, 03:53:00 PM
@7ala
I would recomment to check model of plugin for custom functions.
Title: Re: Number of user reviews
Post by: 7ala on September 03, 2021, 12:23:03 PM
Code: [Select]
// COUNT RATINGS ON USER ACCOUNT FROM SOME USER (to check if user already left rating)
public function countRatingsByUserId( $user_id, $user_email, $from_user_id ) {
  $this->dao->select('count(*) as i_count');
  $this->dao->from( $this->getTable_Rating() );

  if($user_id == 0 || $user_id == '') {
    $this->dao->where('s_user_email = "' . $user_email . '" AND fk_i_from_user_id = ' . $from_user_id );
  } else {
    $this->dao->where('fk_i_user_id = ' . $user_id . ' AND fk_i_from_user_id = ' . $from_user_id );
  }


  $result = $this->dao->get();
  if( !$result ) { return array(); }
  return $result->row();
}

I expect the code responsible for this
This function
but
What is the code to get the number of reviews?
Thanks