Hi,

I will use the fivestarextra module on custom profile.

How do I have to use the function

print fivestarextra_widget_form(&$form_state, $content_type, $content_id):

Can anybody explain me what the variables stand for?

function fivestarextra_widget_form(&$form_state, $content_type, $content_id) {
 
  global $user;

  $votes = fivestar_get_votes($content_type, $content_id);

  $values = array(
    'user' => isset($votes['user']['value']) ? $votes['user']['value'] : NULL,
    'average' => isset($votes['average']['value']) ? $votes['average']['value'] : NULL,
    'count' => isset($votes['count']['value']) ? $votes['count']['value'] : NULL,
  );

thx
mathias

Comments

Richard Blackborder’s picture

Status: Active » Fixed

I think you might find this is what you are looking for:

#483738: Showing the user rating widget in places other than the user profile.

Status: Fixed » Closed (fixed)

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

TapSkill’s picture

I have to reopen this because I now require the answer as well.

I need to figure out a way to display the user's average rating without the ability to vote on the rating (for disabling the ability to vote on yourself), and this code does not work:

 if ($user->uid && $account->uid !== $user->uid) {
			//print "<br />".$profile['fivestarextra']; (This code shows the category header, so I don't like it.)
			print "<br />".drupal_get_form('fivestarextra_form_user_'.$account->uid,'user',$account->uid);
		} else if ($user->uid) {
			$current_rating = fivestar_get_votes($account, $account->uid);
			//print "<br /><strong>Your rating:</strong> ".theme('fivestar_static_element', $star_display, $title, $text_display);
			print "<br /><strong>Your rating:</strong> ".theme('fivestar_static', $current_rating, 5);
		} else {
			//$current_rating = votingapi_get_voting_result('node', $account->uid, 'percent', 'vote', 'average');
			print "<br /><strong>Rating:</strong> ".theme('fivestar_static', $account->uid, 5);
		} 

Commented out code is there because I was trying a lot of methods I found or thought up, but nothing has worked.

TapSkill’s picture

Title: PHP Code to include » include non-interactive star rating of user
Status: Closed (fixed) » Active