168 - Implement Avatar/Gravatars for Joomla! v 1.5

Google's Highly Open Participation Program tries to get young students into Open Source and Joomla! specifically. Everyone is welcome, there are not limits. You can be a coder, documenter, tester, translator to help out. Jump in and start helping!
User avatar
depresz
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 104
Joined: Thu Nov 29, 2007 4:14 pm
Location: Piotrków Trybunalski, Poland
Contact:

168 - Implement Avatar/Gravatars for Joomla! v 1.5

Post by depresz » Wed Jan 09, 2008 5:58 pm

Implement Avatar/Gravatar Support for Joomla! v 1.5 in these ways:

    * Install UserMeta extension and create additional user metadata for:
      +  Gravatar or Avatar preference;
      +  Gravatar URL;
      +  Avatar file;
      +  User-defined preference to display Avatar with articles;
      +  User-defined preference to display Gravatar with comments.
    * Display Gravatar or Avatar with author's article, if preferred.
    * Display Gravatar or Avatar with author's comments, if preferred.

Note: Do not include the UserMeta plugin in the extension package, but
rather provide instructions on how it should be configured for use with
this extension.

Resources:

    * Use Kevin Devine's UserMeta extension (simply provide instructions)
    * Gravatar implementor's guide http://site.gravatar.com/site/implement
    * Use yvComment extension for comments -
http://extensions.joomla.org/component/ ... Itemid,35/
Hmmm... Today I will create plan of project, and, I think tommorow, I'm going to start coding. Will a lot of fun  :laugh:
Last edited by mcsmom on Mon Feb 04, 2008 5:59 am, edited 1 time in total.
Great Hacking Opportunity Project
numbers? sure! 3d 22h on forum, about 500h of work <- this is real GHOP

AmyStephen
Joomla! Champion
Joomla! Champion
Posts: 7018
Joined: Wed Nov 22, 2006 3:35 pm
Location: Nebraska
Contact:

Re: 168 - Implement Avatar/Gravatars for Joomla! v 1.5

Post by AmyStephen » Wed Jan 09, 2008 6:11 pm

Tomasz -

Given this and other contributions made by your peers, Joomla! is going to have some seriously cool social networking, blogging and group blogging capabilities. I can't wait to start pulling it all together - then showing off what GHOP has made possible for the Joomla! community.

Thanks for your many contributions!
Amy :)

User avatar
depresz
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 104
Joined: Thu Nov 29, 2007 4:14 pm
Location: Piotrków Trybunalski, Poland
Contact:

Re: 168 - Implement Avatar/Gravatars for Joomla! v 1.5

Post by depresz » Fri Jan 11, 2008 5:11 pm

I am very busy now, because I have a lot of non-Joomla! work (Joomla! works too, but's not so prioritaire).
I know how to do this plugin (from A to Z). I won't need help, so you, Amy, you can feel free in this task ;)
A lot of things depend on calendar_icon plugin which I am developing (few improvements left). BTW: This plugin rlz! I wonder what have I done xD People love it  :)
I think that first version will be ready 15-16 Jan.

Right... after GHOP, Joomla! will be not this same project like before 8)

Thanks,
depresz
Great Hacking Opportunity Project
numbers? sure! 3d 22h on forum, about 500h of work <- this is real GHOP

User avatar
depresz
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 104
Joined: Thu Nov 29, 2007 4:14 pm
Location: Piotrków Trybunalski, Poland
Contact:

Re: 168 - Implement Avatar/Gravatars for Joomla! v 1.5

Post by depresz » Mon Jan 14, 2008 6:31 pm

Image
Here you have list of functions that will be added inside UserMeta & plugin configuration page.
I implemented simpler than in calendar_icon function (simpler = less work and more stable)

Everything is fine ;) Just no problem!

Thanks,
Tomasz Dobrzyñski
Last edited by depresz on Thu Jan 17, 2008 2:31 pm, edited 1 time in total.
Great Hacking Opportunity Project
numbers? sure! 3d 22h on forum, about 500h of work <- this is real GHOP

User avatar
depresz
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 104
Joined: Thu Nov 29, 2007 4:14 pm
Location: Piotrków Trybunalski, Poland
Contact:

Re: 168 - Implement Avatar/Gravatars for Joomla! v 1.5

Post by depresz » Wed Jan 16, 2008 3:24 pm

Today good and bad news.

Header avatar done...
Bottom avatar (yvcomment)...

... Houston, we have a problem...

I especially can not connect to the yvcomment. This component doesn't provide some back door, you know, like onPrepareContent function. How can I connect to this component and change some variable from view?
I am a little confused because I am seeking solution second day, without certain results.

What's now?
Need help

Today and dey before I talked with Yuri Volkov and we found solution of my problem. yvcomment will use this same like in com_content event function: onPrepareContent. It will provide more flexibility with writing a code.

I have just resumed work

PROGRESS: 60% 17 Jan
Last edited by depresz on Thu Jan 17, 2008 2:29 pm, edited 1 time in total.
Great Hacking Opportunity Project
numbers? sure! 3d 22h on forum, about 500h of work <- this is real GHOP

User avatar
depresz
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 104
Joined: Thu Nov 29, 2007 4:14 pm
Location: Piotrków Trybunalski, Poland
Contact:

Re: 168 - Implement Avatar/Gravatars for Joomla! v 1.5

Post by depresz » Fri Jan 18, 2008 7:56 pm

Hi guys!

I've got good news, especially screenshots say everything. Main view:

Image

Other (very important) screen shows overview of selected article (yvcomment avatars). My plugin won't work with yvcomment until new version of Yuri's extension will be released. I felt real spirit of Open Source by talk with Yuri. He's great developer and very open for propositions. It was impossible to create avatars in comments withoutthis  communication. Thanks Yuri for creating flexible platform for me and others programmers.

http://www.depresz.piotrkow.net.pl/ghop ... RTICLE.png

Main scelet of plugin has been just created. Now I'm gonna do following tasks:
*Internationalization (English, Polish and probably German)
*Documentation (very detailed in PDF; because after installation of plugin administrator will have to update User Meta System Plugin's file, I decided to create txt file from which he will just Ctrl+c and Ctrl-c to user meta file. Very simple solution and you'll not loose time by handly re-writing code to file from PDF ).

PROGRESS: 85% 18 Jan

I'll provide code next time.

Oh, maybe I don't know well English, and maybe I don't have great grades in school but I know what Joomla! means. You know, this is not only project. For me it became part of LIFE
Great Hacking Opportunity Project
numbers? sure! 3d 22h on forum, about 500h of work <- this is real GHOP

User avatar
mcsmom
Joomla! Exemplar
Joomla! Exemplar
Posts: 7897
Joined: Thu Aug 18, 2005 8:43 pm
Location: New York
Contact:

Re: 168 - Implement Avatar/Gravatars for Joomla! v 1.5

Post by mcsmom » Sat Jan 19, 2008 1:30 am

Looking great; can't wait to have something to install :).
So we must fix our vision not merely on the negative expulsion of war, but upon the positive affirmation of peace. MLK 1964.
http://officialjoomlabook.com Get it at http://www.joomla.org/joomla-press-official-books.html Buy a book, support Joomla!.

AmyStephen
Joomla! Champion
Joomla! Champion
Posts: 7018
Joined: Wed Nov 22, 2006 3:35 pm
Location: Nebraska
Contact:

Re: 168 - Implement Avatar/Gravatars for Joomla! v 1.5

Post by AmyStephen » Sun Jan 20, 2008 8:24 am

depresz wrote:
I'll provide code next time.

Oh, maybe I don't know well English, and maybe I don't have great grades in school but I know what Joomla! means. You know, this is not only project. For me it became part of LIFE
You do *excellent* work. Excellent work. So far, you have translated the installation guide into Polish; then, you created a most amazing Twitter Plugin that updates on title post - after getting the URL  and converting it to a tiny url using Curl. Then, you created a blog entry date calendar - which is beautiful. There, you stopped to do THREE unit tests because you knew it was important, given where J! is at. Now, you are building an Avatar/Gravator extension.

Also - your extensions are providing for Kevin Devine's User Extension - and now for Yuri's commenting tool.

I would say you have found something that you are *excellent* at.

Now, school is important so get that done, too, and focus on your work. You are certainly a good match for this type of work and we are so very, very pleased you joined us at Joomla!.

That picture is fabulous. I cannot wait to try your newest extension.

Thanks to Yuri for his work with you and his contributions to Joomla!, as well.

Amy :)

User avatar
Jinx
Joomla! Champion
Joomla! Champion
Posts: 6508
Joined: Fri Aug 12, 2005 12:47 am
Contact:

Re: 168 - Implement Avatar/Gravatars for Joomla! v 1.5

Post by Jinx » Sun Jan 20, 2008 2:33 pm

Tomasz,

I just wanted to personaly congratulate you with the work you are doing ! Those avatars are looking great.
Keep it up and if you ever have a question just send me a PM. I'll be happy to help.

Good luck with the rest of the GHOPC.

Johan
Johan Janssens - Joomla Co-Founder, Lead Developer of Joomla 1.5

http://www.joomlatools.com - Joomla extensions that just work

User avatar
MiCCAS
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 188
Joined: Mon Jan 01, 2007 6:59 am
Contact:

Re: 168 - Implement Avatar/Gravatars for Joomla! v 1.5

Post by MiCCAS » Sun Jan 20, 2008 2:40 pm

That is looking awesome mate, I look forward to seeing this once it's finished.. now, where is that dusty bookmark button?
MiCCAS.net Free PC Services

User avatar
willebil
Joomla! Guru
Joomla! Guru
Posts: 762
Joined: Thu Aug 18, 2005 12:06 pm
Location: Netherlands

Re: 168 - Implement Avatar/Gravatars for Joomla! v 1.5

Post by willebil » Sun Jan 20, 2008 10:06 pm

What more can I say then those before me already said. Way to go!

User avatar
depresz
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 104
Joined: Thu Nov 29, 2007 4:14 pm
Location: Piotrków Trybunalski, Poland
Contact:

Re: 168 - Implement Avatar/Gravatars for Joomla! v 1.5

Post by depresz » Mon Jan 21, 2008 6:09 pm

Thank you so much.

Amy: I was starting with (without) nothing. I knew that exist something like Joomla!, but I didn't like (even hate) this CMS! I told bad things about Joomla! without trying this, before. Now, when I understand everything, I can say that I was completly fool. I didn't suppose that I will create so many lines of code, translate entire installation guide, etc. Everytime when I start new thing I feel more experienced. I remember, when I started task with Twitter. I didn't know what the hell is plugin for Joomla! but I took a risk. Many hours with underground coding (nobody knew, even my parents that my 366Mhz machine was running and servers were working xD). I feel proud, what I have done, but other side I feel really, really nasty when I think, that I couldn't help in Joomla! Doc Camp. I hadn't free time, but I declared I will... My honor fell.

You know, Google is power for newbies (me), but... Sure, if I will have some problems, just send PM to you, Johan ;) One more contact xD.

Oh, willebil and MiCCAS, I have something done... but it is not final product yet. You will have to wait for new version of yvcomment also. But now, you can see at this beautiful php signs ;) Plan of parametrs placed on top of this site is a little diffrent from real realization. Oh, I almost forget describe this plugin.


Avatar/Gravatar 1.02 is very flexible, and ready for most (ironic) exception:
* when user will not enter path in UserMeta System Plugin (will be insert default image)
* when user enter path of standar image (e.g. 573x362px, plugin change size to maximum 80x80px size)


Plugin automaticly carry out whether text entried into the Avatar/Gravatar Box is Avatar URL path or Gravatar Username. Now, I can say that user will not finish off installation WITHOUT additional instructions! I know, that's bad, but user has to know, how to enable yvcomment layer that provide avatar space, what enter in UserMeta config file, etc. Installation guide will be very IMPORTANT here.

One of the most important things here is that function getimagesize need more privilages: allow_url_fopen=1.
"Warning: getimagesize() [function.getimagesize]: URL file-access is disabled in the server configuration in".
Plugin is ready to work, even when that's impossible to turn On. I am very preciesly creating every step. I helped yvcomment (other plugins has free way to changing content of yvcomment, now) extension, and yvcomment helped me (special trigger event and generally avatar support).

Every day new version is released (me and Yuri testing it). Again, big thanks for Yuri. HE's doing great work for me. Oh, I just received new e-mail from him ;) Every day I implement brand new thing. Development of this extension is really huge. Only last Saturday and Sunday, totally I intended for Avatar/Gravatar about 20 hours. I have a lot of work with this extension but I love this. If you have any ideas, according code or 'user thinking' things. I think that I will use 200% power for complete this task until GHOP end  :laugh:

I think that I will make an awesome 18 birthday present, finishing this plugin (31 Jan)

PROGRESS: 92% 21 Jan

BTW: Amy, your help is INVALUABLE!

Thankz,
Tomasz
You do not have the required permissions to view the files attached to this post.
Last edited by depresz on Mon Jan 21, 2008 6:13 pm, edited 1 time in total.
Great Hacking Opportunity Project
numbers? sure! 3d 22h on forum, about 500h of work <- this is real GHOP

User avatar
yvolk
Joomla! Guru
Joomla! Guru
Posts: 979
Joined: Thu Jun 01, 2006 1:52 pm
Location: Moscow, Russia
Contact:

Re: 168 - Implement Avatar/Gravatars for Joomla! v 1.5

Post by yvolk » Mon Jan 21, 2008 7:04 pm

depresz wrote: ...I have something done... but it is not final product yet. You will have to wait for new version of yvcomment also. But now, you can see at this beautiful php signs ;)
For your convenience, I've posted version of yvComment (1.12), that works with gravatar-avatar: see it at yvComment's Homepage.
Text of all my messages is available under the terms of the GNU Free Documentation License: http://www.gnu.org/copyleft/fdl.html

AmyStephen
Joomla! Champion
Joomla! Champion
Posts: 7018
Joined: Wed Nov 22, 2006 3:35 pm
Location: Nebraska
Contact:

Re: 168 - Implement Avatar/Gravatars for Joomla! v 1.5

Post by AmyStephen » Mon Jan 21, 2008 7:13 pm

Yuri - respect.  8)

deepthoughts
Joomla! Apprentice
Joomla! Apprentice
Posts: 45
Joined: Tue Sep 27, 2005 1:12 pm
Location: The northern part of Sweden (Piteå)

Re: 168 - Implement Avatar/Gravatars for Joomla! v 1.5

Post by deepthoughts » Mon Jan 21, 2008 10:35 pm

I've downloaded this plugin to test it since I really like the concept of Gravatars and I must say it works really great!

Kudos to you for creating this great plugin. However I have a humble suggestion: Give the avatar/gravatar-image a css-class so that it's easy to style only the (gr)avatar image.

I'm still trying to decide if I like the concept of having to write in your Gravatar-email but everything else is really great.

Great job!
Stefan Nitsche
stefan_at_nitsche_dot_se

AmyStephen
Joomla! Champion
Joomla! Champion
Posts: 7018
Joined: Wed Nov 22, 2006 3:35 pm
Location: Nebraska
Contact:

Re: 168 - Implement Avatar/Gravatars for Joomla! v 1.5

Post by AmyStephen » Tue Jan 22, 2008 4:35 am

Thanks Stefan, for your valuable feedback.

User avatar
depresz
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 104
Joined: Thu Nov 29, 2007 4:14 pm
Location: Piotrków Trybunalski, Poland
Contact:

Re: 168 - Implement Avatar/Gravatars for Joomla! v 1.5

Post by depresz » Tue Jan 22, 2008 6:11 am

CSS are good. Where have I heared that? ;) I changed type of plugin: Content => System. Now, even in back-end list of comments,avatars are available. Of coure I improved also "preview" method in comments of article (nov avatar available when you press Preview button)

Many things things left to do.

I am so glad that so many people are interested what's going on with my Avatar/Gravatar plugin. I have to represent higest quality of code. I discovered another developer's truth:

Doesn't matter how the code is constructed, and wthat type of function is using. User suppose working product. User don't care when something went wrong. He will just Uninstall plugin. That's why I want to create so high quality product.

I was joking that for my plugin you would carry out unit test  :laugh:
Great Hacking Opportunity Project
numbers? sure! 3d 22h on forum, about 500h of work <- this is real GHOP

User avatar
Jinx
Joomla! Champion
Joomla! Champion
Posts: 6508
Joined: Fri Aug 12, 2005 12:47 am
Contact:

Re: 168 - Implement Avatar/Gravatars for Joomla! v 1.5

Post by Jinx » Wed Jan 23, 2008 3:28 am

Hi Thomasz,

I just got your PM. I'll put my reply here for everyone to read.

Your question :
I am creating Avatar/Gravatar extension. As you said that you can help me, I'll use your power  ;)  I have following problem: I want to create support for avatars in this same server where is Joomla! I'll give you an example:

I have avatar in path:
http://someserver.com/joomla/images/avatar.png

I want to enter in User's config images/avatar.png, not full path http://someserver.com/joomla/images/avatar.png

Does Joomla! provide some variable that return path to the joomla server? I remember that something was, but didn't work in RC3/RC4 or something like that... can't remember.
There are a few ways to handle this problem :

1. Using JHTML::_('image', $url, $alt, $attribs)

This function adds the root path himself and would be the preferred way of outputting an img element in html. If you use this one it will be something like JHTML::_('image', 'images/avatar.png', 'my avatar', array('class' => 'avatar'));

2. Using JURI::root()

This function will output the root url for the joomla installation, root url being the base url of the site application. You can then use this url to access the images folder.

Hope this helps ?

Cheers,

Johan
Johan Janssens - Joomla Co-Founder, Lead Developer of Joomla 1.5

http://www.joomlatools.com - Joomla extensions that just work

User avatar
depresz
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 104
Joined: Thu Nov 29, 2007 4:14 pm
Location: Piotrków Trybunalski, Poland
Contact:

Re: 168 - Implement Avatar/Gravatars for Joomla! v 1.5

Post by depresz » Wed Jan 23, 2008 6:05 am

Sure, Johan. You helped me  8)

I have created this kind of function manually in Twitter Plugin, but in this extension, implementation won't work. I still don't know what function use. I will have to test both, and check which is better.

Again, thank you Johan. You make that I will not wast precious minutes (or hours - who know?).
After party (school), I'll continue coding.

PROGRESS: 94% 23 Jan // 6:43 p.m. local time

Next time I'll attach new package with many improvements (especially code). Big tribute to Yuri.

Code with many, many (coding) improvements available. This is not final version. It's for testing only.
You do not have the required permissions to view the files attached to this post.
Last edited by depresz on Wed Jan 23, 2008 5:42 pm, edited 1 time in total.
Great Hacking Opportunity Project
numbers? sure! 3d 22h on forum, about 500h of work <- this is real GHOP

User avatar
depresz
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 104
Joined: Thu Nov 29, 2007 4:14 pm
Location: Piotrków Trybunalski, Poland
Contact:

Re: 168 - Implement Avatar/Gravatars for Joomla! v 1.5

Post by depresz » Sat Jan 26, 2008 10:58 am

New development version 1.06 available.

Fixed many bug, especially:
  • preview event check on guest click
  • advanced css styling enable/disable
  • new line on frontpage
  • better behavior on front-end and back-end
  • added default values to variables from system & user config
  • new default size of avatar (after installation without configuration) [better look]
  • some PHP4 improvement
  • ...and many little programming things.
Would be great if this plugin will be worked in PHP4 without any warning. Unfortunetly, I don't have access to PHP4 (localhost, and inet server). I am working with PHP5. It's not so important but would be great.

PROGRESS of plugin: 98%
PROGRESS of doc: 0%
You do not have the required permissions to view the files attached to this post.
Last edited by depresz on Sat Jan 26, 2008 11:06 am, edited 1 time in total.
Great Hacking Opportunity Project
numbers? sure! 3d 22h on forum, about 500h of work <- this is real GHOP

Umit
Joomla! Apprentice
Joomla! Apprentice
Posts: 21
Joined: Mon May 28, 2007 1:12 am

Re: 168 - Implement Avatar/Gravatars for Joomla! v 1.5

Post by Umit » Sat Jan 26, 2008 7:27 pm

First of all, I'd like to thank you for your effort. This is a great plugin.

I got a little problem tho (it might be my setup)

When I click on the PDF icon, i get this error:

Code: Select all

TCPDF error: Unsupported image type: php?gravatar_id=9505423dda2c2797ee05425a47b0258d&size=55
Could you tell me whether its my setup, or a code error?

Thanks in advance,

Umit.

User avatar
depresz
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 104
Joined: Thu Nov 29, 2007 4:14 pm
Location: Piotrków Trybunalski, Poland
Contact:

Re: 168 - Implement Avatar/Gravatars for Joomla! v 1.5

Post by depresz » Sat Jan 26, 2008 7:44 pm

I have similiar problem. I don't know yet, but I think it's my fault.

I have another big problem. I talked with Yuri about CSS styles, and...

Everything would be OK with styles, but there is problem with rendering site, when my plugin is ative. On first sight, looks OK, but go inside source of page. There is no flexibility in my code (look: "" doesn't have closing in right place!!!!!. I could't fix this bug but fortunetly, somehow it works. There are only problems with Firefox, when you first time open site with my plugin enabled (Seems like content page is fragmented: on left side: news, on right side: blank). Every next time while you refresh site, everything is OK: it's something like just: "Oh, I understand that I did something wrong, and I have to render site in diffrent way." (words of web browser). Look at the attachment to this message. I can't support such a big flexibilty with CSS because my plugin is very static. Reason of this problem is small flexibilty of onPrepareContent parameters. I mean, not every element of code is ready to write: (for example I can attach datas to following var:
$row->text = ''.$row->text;
but I can't attach this same code to title variable:
$row->title = ''.$row->title;)
Designing my code I knew that in the future will be problems like CSS, but I had to keep on going. There was no other soultion to working this code. I wanted to avoid solution from "Calendar Icon Plugin" because there, every var, was controlled partial by me and system (I can see that was very, very bad, and I'm trying to use Avatar/Gravatar method, but without results).
Look at core of Joomla component. There is no "block code" (every parameter begin or end HTML code in diffrent place). That's why I don't want to give users excessive access. OK, I understand templates, etc, but look at code of plugin.

Code: Select all

<table style="width:100%; float:right;" cols=1><tr width="100%"><td colspan=2 ><img src="'.$url;
float is right. I wanted to fight with rendering problems, so I thinked out bla, bla, bla: cols=1, colspan=2, but without any success.

Now I am at exit point: Problem is very BIG because I am depend on table, which is float:right. If not: is problem in Internet Explorer. I have to delete somehow and from my plugin, and insert only . This case is very important because make me stop thinking about everything.

I think that somebody understand me and help with creating my extension. I just want to delete from my code of plugin. I tried with HTML style tricks, but without effects. I need very flexible trick to work with Firefox, Internet Explorer, Safari and Opera.

Please, people with experience, help me


Tags , ... seems OK in my code. So what's going on with Firefox? If someone had this same situation like from attachment, please write circumstance of situation. (did you first time open site?, server type, version of Fox, etc...).
You do not have the required permissions to view the files attached to this post.
Last edited by depresz on Sun Jan 27, 2008 9:26 am, edited 1 time in total.
Great Hacking Opportunity Project
numbers? sure! 3d 22h on forum, about 500h of work <- this is real GHOP

User avatar
yvolk
Joomla! Guru
Joomla! Guru
Posts: 979
Joined: Thu Jun 01, 2006 1:52 pm
Location: Moscow, Russia
Contact:

Re: 168 - Implement Avatar/Gravatars for Joomla! v 1.5

Post by yvolk » Sun Jan 27, 2008 9:28 am

depresz wrote: ...Reason of this problem is small flexibility of onPrepareContent parameters. I mean, not every element of code is ready to write: (for example I can attach datas to following var:
$row->text = ''.$row->text;
but I can't attach this same code to title variable:
$row->title = ''.$row->title;)
...
...I just want to delete from my code of plugin. I tried with HTML style tricks, but without effects. I need very flexible trick to work with Firefox, Internet Explorer, Safari and Opera.
Tomasz aka depresz already knows my view, but I still want to put it here, and in more detail, for others to discuss.

I think, that content plugin shouldn't try to do more, than it is devised to do (by Joomla! core team): It may change content, but it may not change design of the page (design is done by template AFTER content plugin have executed).
I mean, that this is template work to put avatar to the right place of the page.

So, let's turn to avatar-gravatar plugin: 'original' templates of Joomla! are part of Joomla! core and (preferably) shouldn't be changed. So, maybe we should take this for granted and write some instruction for user: "How you should change your template to see avatars in your articles".

We already have a good example, how this may be done: see the code, that integrates avatar-gravatar plugin with yvComment:
1. yvComment fires the same "onPrepareContent" event
2. avatar-gravatar builds img tag and puts it in the new, special attribute of the $article object: $article->avatar - this attribute is not persisted in database, but it is used for information exchange between components only.
3. Template of yvComment's MVC code (
  components/com_yvcomment/views/comment/tmpl/default.php or
  components/com_yvcomment/views/list/tmpl/default.php,
  -depending on current view of yvComment (that is not the same, as article's view...))
sees this new attribute and inserts it in the right place of the page. Moreover, if some user of yvComment would decide to customize yvComment's template (and will create custom template, e.g. 'templates/mytemplatename/html/com_yvcomment/comment/default.php'), he (or she) may decide to put that avatar of comment to other place,
without patching anything (not Joomla! core, not yvComment, not avatar-gravatar).

So, my proposal is to use for Articles (i.e. for com_content component) the same approach, as is successfully implemented for yvComment: return avatar's img tag to the 'avatar's aware' template though $article->avatar attribute  ???
Text of all my messages is available under the terms of the GNU Free Documentation License: http://www.gnu.org/copyleft/fdl.html

User avatar
depresz
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 104
Joined: Thu Nov 29, 2007 4:14 pm
Location: Piotrków Trybunalski, Poland
Contact:

Re: 168 - Implement Avatar/Gravatars for Joomla! v 1.5

Post by depresz » Sun Jan 27, 2008 9:46 am

I think that's good way of thinking.

I will just leave default Joomla template, as it is now, and I will try to prepare universal $row->avatar var, that will return ONLY tag, without changing $row->text, etc. It's not hard work, but in conjuction with CSS created by user, it will provide very, very, very flexible solution. New, we can talk about CSS Yuri  :pop

I hope that users will not use default Joomla template, because once per 15 loading page, is problem with showing site on Firefox (other browsers don't have this problem) ;)

BTW: I thought that my code will have max. 50-60 lines; small signs became moster (more thank 300 lines). And it's not end.
Great Hacking Opportunity Project
numbers? sure! 3d 22h on forum, about 500h of work <- this is real GHOP

User avatar
depresz
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 104
Joined: Thu Nov 29, 2007 4:14 pm
Location: Piotrków Trybunalski, Poland
Contact:

Re: 168 - Implement Avatar/Gravatars for Joomla! v 1.5

Post by depresz » Sun Jan 27, 2008 8:46 pm

After day of work I present you one of the last version (but not last).
Version 1.08

Improvements:
  • CSS technology:
    *plugin
    *template
    *neither
  • Gravatars of guests. Now, even guest when enter e-mail can have gravatar icon next him comment. It was impossible to today. (It is very big change, and very smart)
edit (forgot):
  • Ready for advanced templating (user can select in his own template, where place Avatar/Gravatar). It is very comfortable in conjunction with CSS.
It is the best code, I have ever wrote! Twitter Status Plugin was nothing according to this.
Yeah... I love YOU Joomla!  :-*

BTW: Next time I will attach screenshots, what's really going on in my plugin. Without documentation, hard to tell, yet.
You do not have the required permissions to view the files attached to this post.
Last edited by depresz on Mon Jan 28, 2008 6:56 am, edited 1 time in total.
Great Hacking Opportunity Project
numbers? sure! 3d 22h on forum, about 500h of work <- this is real GHOP

User avatar
yvolk
Joomla! Guru
Joomla! Guru
Posts: 979
Joined: Thu Jun 01, 2006 1:52 pm
Location: Moscow, Russia
Contact:

Re: 168 - Implement Avatar/Gravatars for Joomla! v 1.5

Post by yvolk » Mon Jan 28, 2008 7:42 am

Hi, Tomasz!

Just tested avatars for guests on two your versions (1.07 and 1.08) and on two locations:

I can see gravatar of guest, when I'm previewing new Comment (before posting it),
but I don't see it (I see default gravatar), when Comment is stored
and even when I preview old Comment while editing it (email is stored! Of cause, I'm logged in as publisher to edit guest's comment))

By the way, how does your extension know, that the comment is made by guest? (you don't have any such parameter...). In yvComment comments, made by guests, are stored with some special (configurable) user (Guest user) as an author.
Text of all my messages is available under the terms of the GNU Free Documentation License: http://www.gnu.org/copyleft/fdl.html

User avatar
depresz
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 104
Joined: Thu Nov 29, 2007 4:14 pm
Location: Piotrków Trybunalski, Poland
Contact:

Re: 168 - Implement Avatar/Gravatars for Joomla! v 1.5

Post by depresz » Mon Jan 28, 2008 4:10 pm

Seems like... you tested somehow old version  ???
I tested latest version attached to previous post and everything was OK. (

How can I recognize does user is guest?
Look at lines 178+

Code: Select all

		//reading guest ID
		$yvcomment = JPluginHelper::getPlugin( 'content', 'yvcomment' );
		$yvcomment_params = new JParameter( $yvcomment->params );
		$guest_username = $yvcomment_params->get('guest_username', '');
		$guestID = JUserHelper::getUserId($guest_username);

		/* reading path of image of gravatar username (automaticly detected)
		  two params: for guest, and logged-in user; to minimize delivery of
		  params and warnings or notices in all_errors, PHP */
		if( $comment==1 )
		{
			if( $row->created_by==$guestID )
				$url = $this->_avatar_path($author, $row->metadata);
			else
				$url = $this->_avatar_path($author, 'not');
		}
$row->created_by==$guestID idicate that user is guest. It's recommended by you from yvcomment.

Maybe you accidental tested 1.o7, Yuri?
Great Hacking Opportunity Project
numbers? sure! 3d 22h on forum, about 500h of work <- this is real GHOP

User avatar
yvolk
Joomla! Guru
Joomla! Guru
Posts: 979
Joined: Thu Jun 01, 2006 1:52 pm
Location: Moscow, Russia
Contact:

Re: 168 - Implement Avatar/Gravatars for Joomla! v 1.5

Post by yvolk » Mon Jan 28, 2008 8:04 pm

Hi, Tomasz!
I tested v.1.08 again and the problem still exists.
Anyway, I think, you should rewrite 'function _avatar_path' - it's very 'non-transparent' :-(
I don't see clear logic, but:
- guest's email is decoded from metadata Ok...
- next, there are some unnecessary operations/operations with unclear (uncommented) purpose...
- and in the end this logic decides to use default guest's avatar instead: '/images/guest.png' on my site :-(

(I don't have admin rights on your site, so I can't see/change parameters...)

...And I have another question: is it good to link your extension to yvComment (load it's parameters to find out GuestUserName...)?  Maybe, it would be be better to duplicate something and don't mention yvComment directly... ?!
So some day your extension will be compatible with some other commenting extension also?
Last edited by yvolk on Mon Jan 28, 2008 8:12 pm, edited 1 time in total.
Text of all my messages is available under the terms of the GNU Free Documentation License: http://www.gnu.org/copyleft/fdl.html

User avatar
depresz
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 104
Joined: Thu Nov 29, 2007 4:14 pm
Location: Piotrków Trybunalski, Poland
Contact:

Re: 168 - Implement Avatar/Gravatars for Joomla! v 1.5

Post by depresz » Mon Jan 28, 2008 8:13 pm

Yeeah, that's fact. I was adding, and adding, and adding new thing to functions, and I didn't watch for optimization of code. It's final step so I can optimize everything. I will improve this function and... done? I don't want to end  :laugh:

OK, I will try to found out solution for commenting extensions.
Last edited by depresz on Mon Jan 28, 2008 8:15 pm, edited 1 time in total.
Great Hacking Opportunity Project
numbers? sure! 3d 22h on forum, about 500h of work <- this is real GHOP

User avatar
yvolk
Joomla! Guru
Joomla! Guru
Posts: 979
Joined: Thu Jun 01, 2006 1:52 pm
Location: Moscow, Russia
Contact:

Re: 168 - Implement Avatar/Gravatars for Joomla! v 1.5

Post by yvolk » Mon Jan 28, 2008 8:21 pm

depresz wrote: Yeeah, that's fact. I was adding, and adding, and adding new thing to functions, and I didn't watch for optimization of code. It's final step so I can optimize everything. I will improve this function and... done? I don't want to end  :laugh:
I would not call this 'optimize', but rather structurize/make code nice to look at  :P  (optimization, on the other hand, often means less readable and less maintainable code :( )
depresz wrote: I will improve this function and... done? I don't want to end  :laugh:
It depends on you... I've read somewhere, that people often need some 'caching' of gravatars to improve site performance :)
This will make you busy for awhile  ;D
Text of all my messages is available under the terms of the GNU Free Documentation License: http://www.gnu.org/copyleft/fdl.html


Locked

Return to “Google's Highly Open Participation Contest”