How would I include Fivestar User ratings in Author Panel?

Comments

Michelle’s picture

Project: Author Pane » Fivestar Extra

I haven't the foggiest idea... Moving it over there. They can add it in using the hook if they want. (I'll explain further if it's needed)

Michelle

Richard Blackborder’s picture

Michelle’s picture

If it's added to the user object on user load, which is what that implies, then you can access it with the $account variable in the AP template.

Michelle

Richard Blackborder’s picture

Status: Active » Fixed

It is indeed. Sounds like a fix to me.

Nigeria’s picture

Could someone please show me a code example for

a) a page or node
b) a block

Thanks in advance

Richard Blackborder’s picture

Status: Fixed » Closed (fixed)

This is a thread about Author Panel and Fivestarextra, so I'm leaving questions about nodes and blocks for the issue in #2.

drecute’s picture

@Michele

After going through the author_pane module, I tried implementing the hook like this

function fivestarextra_preprocess_author_pane(&$variables) {

global $user;

$uprofile = user_load(array('uid'=>$variables['account']->uid));

//Some fivestarextra function to call. But I dont know, as the fivestarextra_widget_form is not that clear about the usage.

$variables['fivestarextra_widget_form'] = 'fivestarextra_widget_form';


}

Can you please lead me from here.

I also noticed that one cannot access fivestarextra in Author Pane from $account or $user or $profile. It seems the module(fivestarextra) is only available on the user profile page.

Michelle’s picture

Status: Closed (fixed) » Active

I don't use Fivestar Extra so I have no idea. Setting this back to active since you need more help.

Michelle

Tafa’s picture

Hi,

I was just wondering if you managed to get past this issue. If so, would you be able to share some of your knowledge to us as I am trying to do the same here too.
Thanks
T

Q2U’s picture

Subscribe

yosisays’s picture

Subscribing

yosisays’s picture

Well its been a full year since I've seen any activity in this thread. Has anyone been able to work on this?

Michelle’s picture

Considering the last commit was August 29, 2009, I think this module is abandoned.

Michelle

rogical’s picture

Title: FiveStar Extra User Ratings in Author Panel? » FiveStar in Author Panel
Project: Fivestar Extra » Fivestar
Version: 6.x-1.x-dev » 7.x-2.0-alpha1
Component: User interface » Code

Can anyone give some guides how to show fivestar in author pane?

And read-only to self while voteable to others.

thanks!

alexmoreno’s picture

for anyone looking for a solution, try:

$user = user_load($uid);
echo drupal_get_form('fivestarextra_form_comment_'. $comment->cid, 'comment', $comment->cid);
Michelle’s picture

You don't ever want to load a UID into the $user variable as you risk that colliding with the global $user. Always use $account (for clarity) or at least something other than $user. Further, in this case, you aren't even using the $user variable so that loading serves no purpose. Using echo on a form is a bit icky but at least doesn't pose a security risk.

alexmoreno’s picture

thanks a lot, yes $usuario for example is what i often to use.

Which one is the correct manner to put the form in a tpl.php?

Thanks a lot :-).

ericduran’s picture

In Drupal 7 fivestar is a field. You can include it in any entity like any other field. Then you can print it in the tpl like you should any other field.

Does this help?

yosisays’s picture

Michelle, per #15 and your response in #16 (and the post in http://drupal.org/node/673114#comment-5695056), does this mean that its now possible to add a user rating widget into the user profile author panel for user ratings?

Michelle’s picture

I have no idea. I was just commenting on the coding quality in the snippet.

dbt102 credited dbt102.

dbt102’s picture

Issue summary: View changes
Status: Active » Fixed

node --> https://www.drupal.org/docs/7/howtos/create-a-node-in-code

block --> https://www.drupal.org/docs/7/creating-custom-modules/declaring-the-block

I think this issue got highjacked along the line, but thanks for great replies.

Status: Fixed » Closed (fixed)

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