On these pages are my WordPress plugins, the odd article and my Support Forum.

For my random rantings on everything else please visit my blog at Yellow Swordfish

WP Plugins


Articles

If you find any of my plugins useful, please comsider a donation towards my running costs.

Thank you

Current User: Guest
Please consider registering

 
Search Forums:


 




how to show avatars?

UserPost

12:30 pm
28 Mar 2008


mark

Guest

 
1

Hi

First of all thank you mister swordfish for the great plugins!

But I have a little question. Wich php function shows the useres avatar? I want to integrate into a list called “the team”

thank you for your time and go on like thi

1:14 pm
28 Mar 2008


Yellow Swordfish

Admin

Peterborough, England

posts 4562

 
2

I think I must have written this post a dozen times!

sf-topiccomponents.php

function:

sf_render_avatar($icon, $userid, $useremail, $guestemail)


the $icon parameter must be set to 'admin', 'member' or 'guest'

the $userid speaks for itself or pass a null string if not a user

the last two also speak for themselves - the email address of the member and/or guest with the other being passed as a null.

The problem is that there is formatting (i.e., class assignments). So yiuld be better off copying the function and then changing it to suit.

A template tag for this is on the card

3:19 pm
28 Mar 2008


mark

Guest

 
3

Sorry that you have to post theese things so often but is searched for avatar and didnt find anything :(

Im no php guru so can you say me what i have to include into my wordpress template for the team page ?

I Hope you are so kind

greetings mark

11:11 pm
28 Mar 2008


Yellow Swordfish

Admin

Peterborough, England

posts 4562

 
4

Well that was what post 2 was all about really. I can't help you with the parameters as i dont know your system.

4:14 am
29 Mar 2008


mark

Guest

 
5

Its just a normal template i use in this wordpress page

and i want to show the avatar

so i dont know what to write in the src of the img tag!

i hope you got me now!

and go on like this with your great plugins i live them

9:18 am
29 Mar 2008


Yellow Swordfish

Admin

Peterborough, England

posts 4562

 
6

Ah! I thought you were writing your own code.

Best approach will be await the next version of the forum as we hope to include a proper temlate tag for this.

Or - if you use the gravatar service - the forthcoming wp2.5 has a new temlate tag for this very purpose.

1:24 pm
31 Mar 2008


mark

Guest

 
7

Hey

I tested now Gravatars and i dont like the system Cry

cant you say me the code snipped you used in the board software`?

thanks!

1:57 pm
31 Mar 2008


Yellow Swordfish

Admin

Peterborough, England

posts 4562

 
8

As I said already the code function is above. It's not just a matter of what you put in the src and if you do not code in php then you probably wont be able to do it.

We will be introducing a template tag for this very soon

4:16 pm
31 Mar 2008


mark

Guest

 
9

Shit

what does soon mean? hours ,days , or weeks because i need it as fast as possible

thanks for your answer

6:21 pm
31 Mar 2008


Yellow Swordfish

Admin

Peterborough, England

posts 4562

 
10

If you are that impatient I suggest you find someone who can code it for you.

6:36 pm
1 Apr 2008


mark

Guest

 
11

My budget is so low at the moment :(

cant you post it? i think a lot like to know the code for showing avatars in comment

6:44 pm
1 Apr 2008


Yellow Swordfish

Admin

Peterborough, England

posts 4562

 
12

I'm sorry but I do keep telling you that you will need code. There is nothing to post. I have also said that there will be a template tag in the next update. That will probably be around this weekend coming.

7:06 pm
1 Apr 2008


mark

Guest

 
13

okay i will wait :)

i hope it will be this weekend

6:05 pm
2 Apr 2008


Synister

Member

posts 8

 
14

hi mark,


here is how i am currently doing it.. i am using forum avatar to post on my comments wordpress page based on commentid.


<img src=”http://www.yourwebsite.com/wp-content/forum-avatars/<?php $myid = $wpdb->get_var(”SELECT id FROM wp_users WHERE user_login='”.get_comment_author().”';”); $myavatar = get_usermeta($myid, 'sfavatar'); if ($myavatar==””){ echo “commentdefault.jpg”; } else { echo $myavatar; } ?>” alt=”<? comment_author() ?>'s Avatar” class=”avatar” height=”30″ width=”30″ />


$myid is the id of the users avatar you want. (numeric id not string id)


if you already have the numeric id then get_usermeta($myid, 'sfavatar') will return the image name of the users avatar. return is null if there is no avatar so you would load a default image.

7:23 pm
7 Apr 2008


mark

Guest

 
15

The avatar template tag is out now. But im not 100% Happy.

How can i give the avatars am max height and width so that they wont look bad like doing it with html image width if they are not in the right relation

greetz mark

7:54 pm
7 Apr 2008


Yellow Swordfish

Admin

Peterborough, England

posts 4562

 
16

I'm not happy tonight either. I've had a bitch of a day which included having to go shopping for shoes and I absolutely hate shopping for shoes. But I did pick up a new LED torch to replace mine with the broken on/off switch so that was good. And then when we got home the tree man came and told me it would cost about £1000 to pollard the Ash tree out front so that was sort of depressing as I wasn't expecting it to cost that much.


And when I finally sat down and opened up the laptop I found some bugs I needed to fix and a whole lot of people on the forum here asking questions that I have to answer.


So that's two of us not happy. As to your question.. the answer really is 'I don't know'.

8:52 pm
7 Apr 2008


mark

Guest

 
17

Oh so im more unhappy if you are unhappy but don't worry be happy

If you can find some time to have a solution like show_avatars ( 50 , 60 ) or something like this

here i found somethin you can use i think


function resize_jpg($inputFilename, $new_side){
$imagedata = getimagesize($inputFilename);
$w = $imagedata[0];
$h = $imagedata[1];

if ($h > $w) {
$new_w = ($new_side / $h) * $w;
$new_h = $new_side;
} else {
$new_h = ($new_side / $w) * $h;
$new_w = $new_side;
}

$im2 = ImageCreateTrueColor($new_w, $new_h);
$image = ImageCreateFromJpeg($inputFilename);
imagecopyResampled ($im2, $image, 0, 0, 0, 0, $new_w, $new_h, $imagedata[0], $imagedata[1]);
return $im2;
}


9:35 pm
7 Apr 2008


Yellow Swordfish

Admin

Peterborough, England

posts 4562

 
18

I'm sorry but I really do believe it is not the function of the forum system to be resizing images.

The easiest way is to edit the code and remove the size parameters…

10:17 am
8 Apr 2008


mark

Guest

 
19

Okay i will try :)

where is the tag defined and the sice of the image

greetz


11:33 am
8 Apr 2008


Yellow Swordfish

Admin

Peterborough, England

posts 4562

 
20

start with the new tag in 'sf-tags.php' and trace it back from there. The call it makes in the tag is to a function in the file 'sf-pagecomponents.php' that does all the work.


4:22 pm
8 Apr 2008


mark

Guest

 
21

in wich line?

i cant finde the class sfavatartag ore something similar there :) i search the part <img class=”'sfavatartag” .-…..

greetz

5:55 pm
8 Apr 2008


Yellow Swordfish

Admin

Peterborough, England

posts 4562

 
22

where did you look? As I said, the tag is in sf-tags.php which calls the avatar display routine in sf-pagecomponents.php. In that routne the wifht and heoght are embedded into the image string. It's not hard to find if you look for it.

9:02 pm
8 Apr 2008


mark

Guest

 
23

I cant find

here it says that it will be an img tag with the class of the avatar

/* ===================================================================

sf_show_avatar($forumids)

displays avatar of current user

parameters: None

returns: <img> class = 'sfavatartag'
====================================================================*/

function sf_show_avatar()
{
global $current_user;

sf_extend_current_user('', 0);

if($current_user->guest) $icon='guest';
if($current_user->member) $icon='user';
if($current_user->forumadmin) $icon='admin';

echo sf_render_avatar($icon, $current_user->ID, $current_user->user_email, $current_user->guestemail, true); return;
}

But when I search in the sf-pagecomponets for the class i cant find it, so wehere is this defined? can you give me the line perhaps


9:36 pm
8 Apr 2008


Yellow Swordfish

Admin

Peterborough, England

posts 4562

 
24

Yes - apologies. My mistake. The routine was in sf-pagecomponents right up to V3 and it got moved to sf-topiccomponents.php. So apologies. I still keep looking in thw wrong place for quite a lot of routines.

sf_render_avatar()

7:45 am
23 Apr 2008


faze one

Guest

 
25

i ve read the whole forum and, sir you are one of the most criptic people i have ever came across, Could you please post the code to add our aviatars in user comments on the BLOG, i know alot of people are asking for it, mabey sticky it to a hacks thread


this is drivin me bananas, are you just tryng to teach us a lesson, dude !



Reply to Topic: how to show avatars?

NOTE: New Posts are subject to administrator approval before being displayed

Guest Name (Required):

Guest EMail (Required):

Guest URL (required)

Math Required!
What is the sum of: 5 + 9        (Required)

Topic Reply:


 
 

About the Stuff at Yellow Swordfish forum

Currently Online:

14 Guests

Maximum Online: 71

Forums:

Groups: 3

Forums: 15

Topics: 1739

Posts: 11775

Members:

There are 798 members

There are 737 guests


Yellow Swordfish has made 4562 posts

Top Posters:

Mr Papa - 1226

-Radio- - 475

ovizii - 85

jfv - 80

angelic007 - 66

Administrator: Yellow Swordfish | Moderators: Yellow Swordfish, Mr Papa, -Radio-


© Simple:Press Forum - Version 3.1.3 (Build 356)