I've noticed the Badge image does not display for anonymous users and there is no permission option. Is this typical?

Comments

Richard Blackborder’s picture

This is not usually the case. Are you using the private download setting in your Drupal installation? If so, that might be the reason. The dev version is compatible with private download, but not the 1.5 version.

Otherwise, I do not believe the problem is related to User Badges.

But if you give more info, I may be able to help.

rewted’s picture

The File system is set to: Public - files are available using HTTP directly.

Badge is displayed only when logged in.

Richard Blackborder’s picture

Try going to the admin menu, under "performance" and clicking the "Clear Cached Data" button.

rewted’s picture

Yeah, that was one of the first thing I tried before submitting the initial post. :)

Richard Blackborder’s picture

On what page and at what location does the badge image not display?

Please tell me exactly what is not displaying.

Is it that the badge image is broken, or the badge is not displaying at all?

Is there anything else that is not displaying? Even if it's just a line or a title, it makes a difference.

Please give as much info as possible. I will try to help, but I need more information.

rewted’s picture

The image (badge I set) isn't displaying for anonymous users, but I can see it once logged in.

- No, the image is not broken. Nothing is being displayed.
- Everything else seems to display.
- The line I use to produce the badge is: print user_badges_for_uid($user->uid);
- That line is in my comments.tpl.php
- Anonymous users have permission to view uploaded content.

Richard Blackborder’s picture

Assigned: Unassigned » Richard Blackborder
Status: Active » Fixed

I think $user that you are retrieving is the current viewing user, not the comment's author.
Try this:

print user_badges_for_uid($comment->uid);

Alternatively, consider the Author Pane module, which integrates with this one.

rewted’s picture

Ok that seems to work. I didn't really understand the README doc, perhaps you can update it with a little more detail under the "display badges" segment.

$user = current viewing user.
$comment = owner of comment
$node = What will this display?

Are there others?

Thanks for your time and assistance.

Richard Blackborder’s picture

Did you see this bit in the README file? I think it is pretty clear:

Note: $uid means 'a user id' here, not the literal use of $uid. Most people will use the uid of the node ($node->uid) or comment ($comment->uid) author.

rewted’s picture

Yes, of course. I just commented on it above.

May make sense to you, but for individuals that do not know PHP or familiar with Drupal may not understand.

Richard Blackborder’s picture

In Drupal (and theming), $node is a PHP object that represents the node, and $comment represents the comment. They are not always both available in every template file, so check the comments at the top of the file to see what is available. You may have access to other uids (user ids), and in these cases you can replace $uid with that value.

Status: Fixed » Closed (fixed)

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

tbrowninfinitymark’s picture

Doh - I answered my own question. My apologies.