• [MOD] User Gravatars 5 0 5 1
Currently:  

Author Topic: [MOD] User Gravatars  (Read 24539 times)

0 Members and 1 Guest are viewing this topic.

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] User Gravatars
« Reply #15 on: April 08, 2010, 03:31:55 AM »
In theory you can combine both mods using the same method as in my first reply.

i.e.
$comment_user_gravatar "<img src='http://www.gravatar.com/avatar.php?gravatar_id=$md5&amp;size=$default_size&amp;rating=$default_rating&amp;default=".$script_url."/"TEMPLATE_PATH."/avatars/".(($user_row_comment['user_avatar'] == "") ? "blank.gif" $user_row_comment['user_avatar']) . "' width='$default_size' height='$default_size' alt='' />";
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline surferboy

  • Full Member
  • ***
  • Posts: 142
    • View Profile
Re: [MOD] User Gravatars
« Reply #16 on: April 08, 2010, 05:46:52 AM »
Hi -

I'm using v1.7.7

I have installed the MOD and tried to incorporate a default 50x50 default gif instead of the Gravatar icon, following V@no's code. Here is what I added in Details.php:

Quote
$comment_user_ip = ($user_info['user_level'] == ADMIN) ? $comment_row[$i]['comment_ip'] : "";
      $default_size = "50"; // width/height of avatars
      $default_rating = "X"; // An optional rating parameter may follow with a value of [ G | PG | R | X ] which determines the highest rating (inclusive) that will be returned.
      $md5 = md5( strtolower( $comment_row[$i][$user_table_fields['user_email']] ) );
      $comment_user_gravatar = "<img src='http://www.gravatar.com/avatar.php?gravatar_id=$md5&amp;size=$default_size&amp;rating=$default_rating&amp;default='http://www.domain.com/ourgallery/templates/default/images/imagename.gif' width='$default_size' height='$default_size' alt='' />";

Also, there are two locations where
Quote
"comment_user_ip" => $comment_user_ip,
appears.

I assumed it went in this section:

Quote
$site_template->register_vars(array(
        "comment_id" => $comment_row[$i]['comment_id'],
        "comment_user_id" => $comment_user_id,
        "comment_user_status_img" => $comment_user_status_img,
        "comment_user_name" => $comment_user_name,
        "comment_user_info" => $comment_user_info,
        "comment_user_profile_button" => $comment_user_profile_button,
        "comment_user_email" => $comment_user_email,
        "comment_user_email_save" => $comment_user_email_save,
        "comment_user_mailform_link" => $comment_user_mailform_link,
        "comment_user_email_button" => $comment_user_email_button,
        "comment_user_homepage_button" => $comment_user_homepage_button,
        "comment_user_icq_button" => $comment_user_icq_button,
        "comment_user_ip" => $comment_user_ip,
        "comment_user_gravatar" => $comment_user_gravatar,
        "comment_headline" => format_text($comment_row[$i]['comment_headline'], 0, $config['wordwrap_comments'], 0, 0),
        "comment_text" => format_text($comment_row[$i]['comment_text'], $config['html_comments'], $config['wordwrap_comments'], $config['bb_comments'], $config['bb_img_comments']),
        "comment_date" => format_date($config['date_format']." ".$config['time_format'], $comment_row[$i]['comment_date']),
        "row_bg_number" => $row_bg_number,
        "admin_links" => $admin_links

A user with a gravatar account was added to the gallery.  His gravatar immediately appeared on the member profile page but his Gravatar did not appear in the comment section when I logged in under his username and made a comment about an image that was posted by another user. Note that I have the MOD Show Received Comments V.2, topic 12695.0.  I believe this MOD is not the source of the problem but the cause of the updates from this MOD not appearing on my gallery. I have to say that I am so thankful that I have kept a record log of each MOD that I have done because I was able to see my notes on where I inserted the user_image in that MOD install which made me realize that this MOD is asking me to make changes to comment_bit.html when I should be making changes to member_comment_bit.htm.

Trying now and we'll see if that fixes the problem. Nope, that did not fix it although I do have the right template. I know that because there is an extra line break in the comment box that was not there before.

So something else is wrong. Here is the member_comment_bit.html code:
Quote
<tr>
  <td class="commentrow{row_bg_number}" nowrap="nowrap"> <strong>{comment_image}</strong></td>
  <td class="commentrow{row_bg_number}" nowrap="nowrap"><div align="right">Mark
      as read:
      <input type="checkbox" name="remove_id[{count}]" value="{comment_id}">
    </div></td>
</tr>
<tr>
  <td class="commentrow{row_bg_number}" valign="top" nowrap="nowrap"> <b>{comment_user_name}</b><br />
    {comment_user_gravatar}<br />
    {comment_user_info} {if comment_user_ip}<br /> <br /> <b>IP:</b> {comment_user_ip}{endif
    comment_user_ip} </td>
  <td width="100%" class="commentrow{row_bg_number}" valign="top"> <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td valign="top"><b>{comment_headline}</b></td>
        <td valign="top" align="right">{if admin_links}{admin_links}{endif admin_links}</td>
      </tr>
    </table>
    <hr size="1" />
    {comment_text} </td>
</tr>
<tr>
  <td class="commentrow{row_bg_number}" nowrap="nowrap"> <span class="smalltext">{comment_date}</span>
  </td>
  <td class="commentrow{row_bg_number}"> {comment_user_status_img} {comment_user_profile_button}
  </td>
</tr>
<tr>
  <td colspan="2" class="commentspacerrow"><img src="{template_url}/images/spacer.gif" width="1" height="1" alt="" /></td>
</tr>

Getting closer but still two problems - no default .gif instead of the gravatar and no gravatar in the comment box.

[UPDATE]
The more I am rereading the MOD for Show Received comments, it looks like if this MOD is installed, then some additional coding is needed in the member.php file to tell it to put the user_gravatar in the member_comment_bit.html file.

Thanks,

Brian

Also, I'll post on the Shoutbox MOD to ask where  I should put the or how to put the user_gravatar in the shoutbox, under the username.
« Last Edit: April 08, 2010, 06:01:12 AM by surferboy »

Offline surferboy

  • Full Member
  • ***
  • Posts: 142
    • View Profile
Re: [MOD] User Gravatars
« Reply #17 on: April 11, 2010, 03:29:29 AM »
Hi -

Tried every possible permutation to make this MOD work. No luck.

One portion of the MOD works:

1. if the member has a gravatar account, their profile appears in the member profile. If the member does not have a gravatar account, the gravatar default icon appears there instead.

2. No gravatar or default icon appears at all in the comment boxl. As I said, I am using MOD Show Received Comments V.2. I tried adding the same code to the member_comment_bit.html but that did not work.

3. My default image that I would like to appear does not appear. Here is the code I tried to use in details.php:

Quote
$comment_user_gravatar = "<img src='http://www.gravatar.com/avatar.php?gravatar_id=$md5&amp;size=$default_size&amp;rating=$default_rating&amp;default=http://www.domain.com/galleryname/templates/default/images/our_image.gif' width='$default_size' height='$default_size' alt='' />";

4. I tried to use the same code in the member_profile.html so that our default avatar would appear. When I tried to paste this:

Quote
<img src='http://www.gravatar.com/avatar.php?gravatar_id=$md5&amp;size=$default_size&amp;rating=$default_rating&amp;default=http://www.domain.com/galleryname/templates/default/images/our_image.gif' width='$default_size' height='$default_size' alt='' />

in place of

Quote
<img src="http://www.gravatar.com/avatar.php?gravatar_id=<?=$md5?>&amp;size=<?=$default_size?>&amp;rating=<?=$default_rating?>" width="<?=$default_size?>" height="<?=$default_size?>" alt="" />

the entire gravatar disappears altogether. 

Kind of run out of ideas.

Anyone?

Thanks,

Brian

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] User Gravatars
« Reply #18 on: April 11, 2010, 04:17:17 AM »
When you open the page where you expect to see avatar, look in it's source, perhaps it will give you some clues what is wrong.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline surferboy

  • Full Member
  • ***
  • Posts: 142
    • View Profile
Re: [MOD] User Gravatars
« Reply #19 on: April 11, 2010, 09:38:43 AM »
Hi -

Took a look at the page:
http://www.domain.com/ourgallery/member.php?action=readcomments

have uploaded both the comment_bit.html file and the member_comment_bit.html file and both files feature the added code:

<b>{comment_user_name}</b><br />
        {comment_user_gravatar}<br /> where this line is the one that needs to be added.

selected FF 3.6.3 View Page Source

if I upload the {comment_user_gravatar} to just the comment_bit.html but omit that code from the member_comment_bit.html,

then you don't see this line, all by itself: <br />

if I do upload that code to the member_comment_bit.html file, then yes, I see this <br /> on a line all by itself, right after the user name ...

which makes sense based on my previous post notes about the member_comment_bit.html having the  comment_user_gravatar code and there being an additional space opened in the comment box but nothing appeared, no image. If I remove that code so that the member_comment_bit.html reverted to the file before I started calling attention to it, there is no separator line even though the code is still present in coment_bit.html.

This confirms to me that because I have installed the MOD Show Received Comments V.2, topic 12695.0, the comment_bit.html is no longer called for in the php code and that the member.php and/or the details.php files are now working with member_comment_bit.html

so this brings the focus back to adjusting the code in the one of these two files, member.php or details.php to create an action to happen in the member_comment_bit.html file with the code {comment_user_gravatar} present.

I thought it might involved adding some code to the lines that feature

$comment_user_email = "";
perhaps adding a line similar like $comment_user_gravatar = "";

and then adding follow on code that is similar to each of the other comment lines, something like:

$comment_user_gravatar =
(isset($comment .... etc.

and also adding a similar code a little further down  where there are these comment lists:

"comment_user_id" => $comment_user_gravatar,

I tried adding this last bit but it didn't do anything. I have no idea what kind of code to write for the first section that has isset in it.

That's the best sleuthing I can do.

Thanks for reading this!

Brian

Offline x23piracy

  • Sr. Member
  • ****
  • Posts: 420
    • View Profile
    • FHG
Re: [MOD] User Gravatars
« Reply #20 on: October 23, 2010, 12:50:56 PM »
How can i show the gravatar of an user in their profile?
In member.php find:
Code: [Select]
     "user_email" => $user_email,

Insert below:
Code: [Select]
     "user_email_orig" => $user_row['user_email'],


In templates/<your template>/member_profile.html add:
Code: (template/HTML+PHP) [Select]
<?php
$default_size 
"50"// width/height of avatars
$default_rating "G"// An optional rating parameter may follow with a value of [ G | PG | R | X ] which determines the highest rating (inclusive) that will be returned. 
$md5 md5(strtolower("{user_email_orig}"));
?>

<img src="http://www.gravatar.com/avatar.php?gravatar_id=<?=$md5?>&amp;size=<?=$default_size?>&amp;rating=<?=$default_rating?>" width="<?=$default_size?>" height="<?=$default_size?>" alt="" />

Hi,

i like to display the gravatar on the member_editprofile.html

i've tryed this code in that file but the default gravatar is shown

Code: (template/HTML+PHP) [Select]
<?php
$default_size 
"50"// width/height of avatars
$default_rating "G"// An optional rating parameter may follow with a value of [ G | PG | R | X ] which determines the highest rating (inclusive) that will be returned. 
$md5 md5(strtolower("{user_email_orig}"));
?>

<img src="http://www.gravatar.com/avatar.php?gravatar_id=<?=$md5?>&amp;size=<?=$default_size?>&amp;rating=<?=$default_rating?>" width="<?=$default_size?>" height="<?=$default_size?>" alt="" />

that code allready exists in member.php

Code: [Select]
     "user_email_orig" => $user_row['user_email'],
but the gravatar is not shown any ideas? something missing?


Greetz X23
« Last Edit: October 23, 2010, 02:26:57 PM by x23piracy »

Don't trust in md5 it's unsafe change your 4i galerys password hash algorythm! second pw db field, create new hashes over some time, deny old hash. Help members that cry, send informationen mail to the rest. Camouflage new pw hash in cookie. Done!

--(◔̯◔)--