comprar viagra online
comprar viagra generico barato
comprar cialis generico online
comprar cialis online seguro
Enable Gravatar support in !JoomlaComment |
!JoomlaComment is one of the leading free commenting components for Joomla!. I've been using the component since the beginning of my website. Still, !JoomlaComment isn't perfect (yet) in my opinion (And I'm not the only one). I would really like to see Trackback support and the ability to edit your own post in 120 seconds. For my website, I wanted to add Gravatar support, so I went editing the !JoomlaComment code to show those globally recognized avatars. One of the strangest things is that !JoomlaComment already supports most things needed for Gravatar. There is already avatar support for Community Builder. The only thing needed for support Gravatar on a PHP platform is an email address. !JoomlaComment has the build-in functionality to ask the user for his email. So let's edit the PHP code and let's add Gravatar support! This tutorial is written on the latest release of !JoomlaComment at this moment: 3.23. 1. Customizing the PHP code First, open the !JoomlaComment class file with your favorite PHP editor (Dreamweaver, Notepad++, but Notepad will do too). I'm talking about the following file: components/com_comment/joscomment/comment.class.php
Around line 2222 you'll find the following code: $display = $this->_avatar; $html = JOSC_utils::checkBlock('BLOCK-avatar_picture', $display, $html); if ($display){ if(strpos($this->_avatar,"gallery/")===false) $path = "$mosConfig_live_site/images/comprofiler/tn$this->_avatar"; else $path = "$mosConfig_live_site/images/comprofiler/$this->_avatar"; $html = str_replace('{avatar_picture}', $this->profileLink ("<img class='avatar' src='$path' alt='avatar' />", $this->_user_id), $html); } Now delete (or comment out) the total IF statement, starting with $display = $this->_avatar; $html = JOSC_utils::checkBlock('BLOCK-avatar_picture', $display, $html); // START Marcofolio.net Enable Gravatar // Retrieve emailaddress given by user $email = $this->_item['email']; // Set the default avatar if the email address is not know by Gravatar $default = "http://www.marcofolio.net/images/logo/gravatar-default.png"; // Set the size of the Gravatar image $size = 50; // Prepare the gravatar image $totalGrav = "<img class=\"avatar\" src=http://www.gravatar.com/avatar.php?gravatar_id=". md5($email)."&default=". urlencode($default)."&size=". $size." alt=\"Gravatar image\" />"; // Write the Gravatar image to the template $html = str_replace('{avatar_picture}', $totalGrav, $html); // END Marcofolio.net Enable Gravatar You'll need to change Save the file and overwrite your old 2. Customizing the template Now let's change your template file to show the actual avatar. Open the {BLOCK-avatar_picture}<td class='avatarcontainer' width='1' align='center'>{avatar_picture}</td>{/BLOCK-avatar_picture} Remove the Save the file and overwrite your old You're done! Reload your website (with comments) to see the Gravatar support and try it for yourself. Conclusion As you could have guessed, this technique will override the Community Builder avatar support. I also changed the code for the URL link support: By clicking on the avatar image, you'll go to the website of the user, instead of clicking on the little "world" image. To do so, you'll need to make further changes to the class file and your template file. You can download my modified code in the download section. This includes the gravatar to website linking part. Anyway, I hope Gravatar support will be added automatically in one of the next releases of !JoomlaComment, where the admin will need to set the Tags: gravatar customize joomlacomment joomla Interested in this topic? You might enjoy another article I've written called |
< Prev | Next > |
---|
Search |
---|
Or try the sitemap |