Closed (fixed)
Project:
Fivestar Extra
Version:
6.x-1.x-dev
Component:
User interface
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
6 Jun 2009 at 13:49 UTC
Updated:
6 Mar 2012 at 12:58 UTC
How do I use the user rating widget in a custom profile or custom node template?
Comments
Comment #1
Richard Blackborder commentedI'm no expert at the theme system. I can tell you that the Fivestar Extra widget is added to the $account object as $account->content['fivestarextra']['widget']. I don't know if that helps.
Comment #2
TechnoBuddhist commentedI've just tried to print the contents of the account object on a node page and there was no reference to fivestarextra at all.
I copied profile-block.tpl.php to my theme and added the following code;
print '
';
It showed a lot of things, but it didn't show fivestarextra.
This block shows all the profile fields and the picture of the user and I want to show the fivestarextra user rating at least. If I could get the voting part as well without going to the user page then brilliant, but it won't even show the current rating.
Am I doing something wrong?
Comment #3
Richard Blackborder commentedTry $profile instead. I output $profile in user-profile.tpl.php and got an element 'fivestarextra' containing a bunch of HTML.
Comment #4
Richard Blackborder commentedComment #5
Nigeria commentedCould someone please show me a code example for
a) a page or node
b) a block
Thanks in advance
Comment #6
Richard Blackborder commentedNigeria I don't know enough about theming to give you the best answers on how to do this. With what knowledge I have, I'll try to point you in the right direction:
What you are looking for is either a way to get a $profile object or a $user object. If you get the $profile object, the widget is in $profile['fivestarextra'].
Pages, nodes and blocks don't come with these objects included (at least from what I can see), so you would need to know which user you wanted the widget for and then go fetch the $user object for that user.
For that kind of info and understanding, you need to go learn a bit more about theming. A Fivestarextra issue is not the best place to do that because you're not asking experts here. Go read Drupal theme stuff.
Comment #8
czeky commentedAny ideas? looking for the same, have fivestar rating of the user profile using node_profile and want to display user profile rating on all nodes user created... thanx
Comment #9
Richard Blackborder commentedI'd use the devel module and the theme developer there to see which theme templates/functions you have access to and, if any of them have a $profile or $user or $account object, use that to print the Fivestar Extra form.
Comment #10
czeky commentedthanx.. solved here... http://drupal.org/node/344210
Comment #11
drecute commentedWhat I've noticed is that, outside from the user profile page, fivestarextra is unavailable. I was went ahead to enable fivestar rating on content profile, but fivestarextra still is unavailable.
I tested with the following code on node page:
Comment #12
alexmoreno commentedfor anyone looking for a solution, try: