Avatars clickable for unregistered users?

paul_constantine - February 17, 2009 - 14:41
Project:Avatar Blocks
Version:5.x-1.2
Component:Miscellaneous
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs review
Description

I do not know if that is design or a bug.

Before I installed avatar blocks the display of the new users and users online worked like this:

  • When you are online as a registered user you can click on a name and will get the profile of the user you click on.
  • When you are visiting the site as an unregistered user you can not click on the names - they are not linked.

Now after installing avator blocks I noticed that the avatars can be clicked in even if you are not registered. Now I checked the permissions and I did not allow unregistered users to view profiles.

Strange. Is this a bug or intentional?

Regards, Paul.

#1

yingtho - February 26, 2009 - 22:56
Status:active» needs review

I have the same issue and found there is a bug in the ImageCache section of the code. It doesn't check if the user have access to the user profile. Please see diff code.

--- original avatar_blocks.module 2008-08-04 23:59:34.000000000 +-0100
+++ modified avatar_blocks.module 2009-02-26 23:48:40.000000000 +-0100
@@ -266,24 +266,32 @@
$preset_options = array();
foreach (imagecache_presets() as $preset) {
$preset_options[] = $preset['presetname'];
}
// does the specified preset exist?
if (!(array_search($imagecache_preset, $preset_options) === FALSE)) {
- if ($online_member->picture) {
- // process the user's picture with imagecache
- $output .= l(theme("imagecache", $imagecache_preset, $online_member->picture, $online_member->name, $online_member->name), "user/".$online_member->uid, array('title' => $online_member->name), NULL, NULL, FALSE, TRUE);
+ if (user_access('access user profiles')) {
+ if ($online_member->picture) {
+ // process the user's picture with imagecache
+ $output .= l(theme("imagecache", $imagecache_preset, $online_member->picture, $online_member->name, $online_member->name), "user/".$online_member->uid, array('title' => $online_member->name), NULL, NULL, FALSE, TRUE);
+ }
+ else {
+ // process the default picture with imagecache
+ $output .= l(theme("imagecache", $imagecache_preset, $default_picture, $online_member->name, $online_member->name), "user/".$online_member->uid, array('title' => $online_member->name), NULL, NULL, FALSE, TRUE);
+ }
}
else {
- // process the default picture with imagecache
- $output .= l(theme("imagecache", $imagecache_preset, $default_picture, $online_member->name, $online_member->name), "user/".$online_member->uid, array('title' => $online_member->name), NULL, NULL, FALSE, TRUE);
+ if ($online_member->picture) {
+ // process the user's picture with imagecache
+ $output .= theme("imagecache", $imagecache_preset, $online_member->picture, $online_member->name, $online_member->name);
+ }
+ else {
+ // process the default picture with imagecache
+ $output .= theme("imagecache", $imagecache_preset, $default_picture, $online_member->name, $online_member->name);
+ }
}
- }
- // no such preset, just call theme_user_picture
- else {
- $output .= theme_user_picture($online_member);
}
}
// not using imagecache, just call theme_user_picture
else {
$output .= theme_user_picture($online_member);
}

#2

paul_constantine - April 17, 2009 - 13:49

Update.

After a reinstall I did not have the problem anymore. Then I installed imagecache_profiles and now my avatars are clickable for unregistered users again :-(

 
 

Drupal is a registered trademark of Dries Buytaert.