Google Plus Author Links

For Joomla! 2.5 Coding related discussions, please use: http://groups.google.com/group/joomla-dev-general
Note: All 1.6, 1.7 and 3.5 releases have reached end of life and should be updated to 3.x.

Moderator: ooffick

Forum rules
Please use the mailing list here: http://groups.google.com/group/joomla-dev-general rather than this forum.
JWeiry
Joomla! Apprentice
Joomla! Apprentice
Posts: 16
Joined: Thu Apr 08, 2010 4:41 am

Google Plus Author Links

Post by JWeiry » Tue Sep 27, 2011 4:14 am

Had a quick look around and noticed that there didn't seem to be anything like this around at the moment.. Or my searching just sucks..

But wanted to implement the Google Plus author links to show your author profile on Google if your using G+.
http://www.google.com/support/webmaster ... er=1408986

Please note, any privacy concerns etc are completely up to the person on G+ to manage. This simply links to their designated profile.

This is sample idea for those who can actually write components etc. Anyone can use this code if they feel like it but if your going to use it, at least credit me in your work please.

If you want an example of it, then you can check it out at:
http://www.weirynet.com

This is not a module or a component, because i couldn't be bothered. It is a patch to com_content tmpl files. Therefore i am not using Joomla's in build database query functions etc. If you want that, then someone can rewrite it to work off that.

If you use this, then you it won't let you use Joomla's default contact details page. However you could still link it if you really wanted to by adding the location of the contact page into the contact's webpage field.

Step 1.
Put the vNetWebAuthor class file in the components/com_content/helpers/ directory. (attached to this post)

Step 2.
For each view of articles, find the <dd class="createdby"> and look inside there for JText::sprintf('COM_CONTENT_WRITTEN_BY' ...

Replace the "COM_CONTENT_WRITTEN_BY" sprintf function with this:

Code: Select all

require_once JPATH_COMPONENT.'/helpers/vNetWebAuthor.php';
$vnet = new vNetWebAuthor();
$cntlink = $vnet->getWebLink($this->item->contactid);
echo JText::sprintf('COM_CONTENT_WRITTEN_BY', JHtml::_('link', JRoute::_($cntlink), $author)); ?>
Step 3.
Add your user contact details to Joomla's Contact section and link it to your user.
For the web page field, make this your G+ profile URL.


vNetWebAuthor Class

Code: Select all

<?php
/*
 * @file vNetWebAuthor.php
 * @description Author link to contact webpage
 * @author James Weir
 * @website www.weirynet.com
 */

class vNetWebAuthor extends JConfig{

        private $link;

        public function __construct(){

                $this->link = mysql_connect($this->host, $this->user, $this->password) or die("MySQL Error: ".mysql_error());
                mysql_select_db($this->db, $this->link);

        }

        public function getWebLink($userID){

                $q = sprintf("SELECT `webpage` FROM `".$this->dbprefix."contact_details` WHERE `id` = '%s'",
                        mysql_real_escape_string($userID));

                $r = mysql_query($q,$this->link);

                if(mysql_num_rows($r) == 1){
                       	$arr = mysql_fetch_assoc($r);
                        return $arr['webpage'].'?rel=author';
                }
                return false;
        }
}
?>

Thoughts or comments?
Try to leave some constructive feedback if you see fit, keeping in mind my obvious explanations posted above.
I may not check this afterwards, however i thought it would be useful for people to see.

RedEye
Joomla! Ace
Joomla! Ace
Posts: 1460
Joined: Sat Jan 21, 2006 8:42 pm

Re: Google Plus Author Links

Post by RedEye » Tue Sep 27, 2011 6:37 am

Nice idea, here another one for that

Code: Select all

<?php
$db = JFactory::getDbo();
$query = 'SELECT `webpage` FROM `#__contact_details` WHERE `id` = '. (int) $this->item->contactid;
$db->setQuery($query);
$page = $db->loadResult().'?rel=author';
echo JText::sprintf('COM_CONTENT_WRITTEN_BY', JHtml::_('link', JRoute::_($page), $author));
?>

JWeiry
Joomla! Apprentice
Joomla! Apprentice
Posts: 16
Joined: Thu Apr 08, 2010 4:41 am

Re: Google Plus Author Links

Post by JWeiry » Tue Sep 27, 2011 12:58 pm

RedEye wrote:Nice idea, here another one for that
Excellent :D

Thanks for that RedEye, i knew there would be a better way around it, but due to lack of time in learning the functionality of Joomla's core, i haven't gotten around to figure much out yet :)

aesentia
Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Thu Nov 17, 2011 10:37 pm

Re: Google Plus Author Links

Post by aesentia » Thu Nov 17, 2011 10:40 pm

I find this very useful, however, it didn't work, and I want it so much!

I'm not a programmer, so I think I failed with this replacing part (part 2) - can somebody tell which part to replace and in what file?

RedEye
Joomla! Ace
Joomla! Ace
Posts: 1460
Joined: Sat Jan 21, 2006 8:42 pm

Re: Google Plus Author Links

Post by RedEye » Thu Nov 17, 2011 10:48 pm

works at the time we write our posts here, not tested it again, have you done step 3 from JWeiry`s first post?
Step 3.
Add your user contact details to Joomla's Contact section and link it to your user.
For the web page field, make this your G+ profile URL.

aesentia
Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Thu Nov 17, 2011 10:37 pm

Re: Google Plus Author Links

Post by aesentia » Thu Nov 17, 2011 11:00 pm

Thank you for your reply!

I did, I added the Google+ page to Contact form, but click on author name then redirects me to "Contact", and still shows user's Google+ page as normal page, when it should link from article directly to Google+ page, right?

I think I didn't do the replacement right. :(
(It doesn't say which files to edit exactly, and what exactly to replace)

RedEye
Joomla! Ace
Joomla! Ace
Posts: 1460
Joined: Sat Jan 21, 2006 8:42 pm

Re: Google Plus Author Links

Post by RedEye » Thu Nov 17, 2011 11:03 pm

well than where is the code from your file, so that we can take a look :p

aesentia
Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Thu Nov 17, 2011 10:37 pm

Re: Google Plus Author Links

Post by aesentia » Thu Nov 17, 2011 11:10 pm

You're so kind, I'd marry you :D

Tried to do it for the featured articles, so I edited com_content > views > featured > default.php

Code: Select all

<?php if ($params->get('show_author') && !empty($this->item->author )) : ?>
	<dd class="createdby">
	<?php $author = $this->item->created_by_alias ? $this->item->created_by_alias : $this->item->author; ?>
	<?php if (!empty($this->item->contactid) && $params->get('link_author') == true): ?>
	<?php
		$needle = 'index.php?option=com_contact&view=contact&id=' . $this->item->contactid;
		$item = JSite::getMenu()->getItems('link', $needle, true);
		$cntlink = !empty($item) ? $needle . '&Itemid=' . $item->id : $needle;
	?>
		<?php echo JText::require_once JPATH_COMPONENT.'/helpers/vNetWebAuthor.php';
$vnet = new vNetWebAuthor();
$cntlink = $vnet->getWebLink($this->item->contactid);
echo JText::sprintf('COM_CONTENT_WRITTEN_BY', JHtml::_('link', JRoute::_($cntlink), $author)); ?> JHtml::_('link', JRoute::_($cntlink), $author)); ?>
	<?php else: ?>
		<?php echo JText::sprintf('COM_CONTENT_WRITTEN_BY', $author); ?>
	<?php endif; ?>
	</dd>
<?php endif; ?>
Once again, thank you very much for your help!

RedEye
Joomla! Ace
Joomla! Ace
Posts: 1460
Joined: Sat Jan 21, 2006 8:42 pm

Re: Google Plus Author Links

Post by RedEye » Thu Nov 17, 2011 11:26 pm

replace your code with the following, if you enable linking to author it should use Joomla contact page, disabled G+ link
vNetWebAuthor.php - you don`t need this file, step3 and the code I posted before should do the job

Code: Select all

<?php if ($params->get('show_author') && !empty($this->item->author )) : ?>
   <dd class="createdby">
   <?php $author = $this->item->created_by_alias ? $this->item->created_by_alias : $this->item->author; ?>
   <?php if (!empty($this->item->contactid) && $params->get('link_author') == true): ?>
   <?php
      $needle = 'index.php?option=com_contact&view=contact&id=' . $this->item->contactid;
      $item = JSite::getMenu()->getItems('link', $needle, true);
      $cntlink = !empty($item) ? $needle . '&Itemid=' . $item->id : $needle;
   ?>
<?php echo JText::sprintf('COM_CONTENT_WRITTEN_BY', JHtml::_('link', JRoute::_($cntlink), $author)); ?>
   <?php else: ?>
    <?php
$db = JFactory::getDbo();
$query = 'SELECT `webpage` FROM `#__contact_details` WHERE `id` = '. (int) $this->item->contactid;
$db->setQuery($query);
$page = $db->loadResult().'?rel=author';
echo JText::sprintf('COM_CONTENT_WRITTEN_BY', JHtml::_('link', JRoute::_($page), $author));
?>
   <?php endif; ?>
   </dd>
<?php endif; ?>

aesentia
Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Thu Nov 17, 2011 10:37 pm

Re: Google Plus Author Links

Post by aesentia » Thu Nov 17, 2011 11:55 pm

It worked! It worked! Thank you so much! <3 <3 <3 <3 <3

valentino86
Joomla! Apprentice
Joomla! Apprentice
Posts: 9
Joined: Sat Nov 12, 2011 6:30 pm

Re: Google Plus Author Links

Post by valentino86 » Fri Jan 27, 2012 12:56 am

I want just to add the rel="author" tag to the link of the author name of an article. How can I do it? thanks

RedEye
Joomla! Ace
Joomla! Ace
Posts: 1460
Joined: Sat Jan 21, 2006 8:42 pm

Re: Google Plus Author Links

Post by RedEye » Sat Jan 28, 2012 5:52 pm

change JHtml::_() call, attribs are passed as array
from
JHtml::_('link', JRoute::_($page), $author)
to
JHtml::_('link', JRoute::_($page), $author, array('rel' => 'author'))
see JHtml::link()

miggalvez
Joomla! Apprentice
Joomla! Apprentice
Posts: 33
Joined: Sat Jul 01, 2006 4:00 pm

Re: Google Plus Author Links

Post by miggalvez » Thu Feb 09, 2012 5:11 pm

I don't think this is working any more in J2.5.1. I edited the file components>com_content>views>article>tmpl>default.php and I used the code quoted here and it didn't work.

If I have Joomla setup to not link author names the names show up without a link. If I select the option to link author names then it links to the Joomla author's contact page showing the G+ link in the website field.

Any ideas? Can anyone put this in a plugin, so we can avoid editing all the tmpl files in the different article views?
RedEye wrote:replace your code with the following, if you enable linking to author it should use Joomla contact page, disabled G+ link
vNetWebAuthor.php - you don`t need this file, step3 and the code I posted before should do the job

Code: Select all

<?php if ($params->get('show_author') && !empty($this->item->author )) : ?>
   <dd class="createdby">
   <?php $author = $this->item->created_by_alias ? $this->item->created_by_alias : $this->item->author; ?>
   <?php if (!empty($this->item->contactid) && $params->get('link_author') == true): ?>
   <?php
      $needle = 'index.php?option=com_contact&view=contact&id=' . $this->item->contactid;
      $item = JSite::getMenu()->getItems('link', $needle, true);
      $cntlink = !empty($item) ? $needle . '&Itemid=' . $item->id : $needle;
   ?>
<?php echo JText::sprintf('COM_CONTENT_WRITTEN_BY', JHtml::_('link', JRoute::_($cntlink), $author)); ?>
   <?php else: ?>
    <?php
$db = JFactory::getDbo();
$query = 'SELECT `webpage` FROM `#__contact_details` WHERE `id` = '. (int) $this->item->contactid;
$db->setQuery($query);
$page = $db->loadResult().'?rel=author';
echo JText::sprintf('COM_CONTENT_WRITTEN_BY', JHtml::_('link', JRoute::_($page), $author));
?>
   <?php endif; ?>
   </dd>
<?php endif; ?>

RedEye
Joomla! Ace
Joomla! Ace
Posts: 1460
Joined: Sat Jan 21, 2006 8:42 pm

Re: Google Plus Author Links

Post by RedEye » Thu Feb 09, 2012 7:21 pm

I`m not tested this in J2.5 but it should work.
Also it`s not recommend to edit com_content, you should do this in a template override.

Ok after reading your post again I tested this, because what you describe can not be to the simple fact that when you activate "link to author" in Joomla the php code what creates the G+ link is not executed and can not display the google link.
However Joomla code has also changed a bit here, but only for the Joomla link to the contact page, so in 2.5 it looks like this and it worked.

Code: Select all

<?php if ($params->get('show_author') && !empty($this->item->author )) : ?>
	<dd class="createdby">
		<?php $author =  $this->item->author; ?>
		<?php $author = ($this->item->created_by_alias ? $this->item->created_by_alias : $author);?>

			<?php if (!empty($this->item->contactid ) &&  $params->get('link_author') == true):?>
				<?php 	echo JText::sprintf('COM_CONTENT_WRITTEN_BY' ,
				 JHtml::_('link', JRoute::_('index.php?option=com_contact&view=contact&id='.$this->item->contactid), $author)); ?>

			<?php else :?>
				<?php //echo JText::sprintf('COM_CONTENT_WRITTEN_BY', $author); ?>
<?php
$db = JFactory::getDbo();
$query = 'SELECT `webpage` FROM `#__contact_details` WHERE `id` = '. (int) $this->item->contactid;
$db->setQuery($query);
$page = $db->loadResult().'?rel=author';
echo JText::sprintf('COM_CONTENT_WRITTEN_BY', JHtml::_('link', JRoute::_($page), $author));
?>
				
			<?php endif; ?>
	</dd>
<?php endif; ?>

miggalvez
Joomla! Apprentice
Joomla! Apprentice
Posts: 33
Joined: Sat Jul 01, 2006 4:00 pm

Re: Google Plus Author Links

Post by miggalvez » Thu Feb 09, 2012 8:13 pm

Thank you so much!

I'm eager to test this, but... how do I create a template override for this?

RedEye
Joomla! Ace
Joomla! Ace
Posts: 1460
Joined: Sat Jan 21, 2006 8:42 pm

Re: Google Plus Author Links

Post by RedEye » Thu Feb 09, 2012 8:18 pm

miggalvez wrote:how do I create a template override for this?
pls take a look here http://docs.joomla.org/How_to_override_ ... omla!_core

miggalvez
Joomla! Apprentice
Joomla! Apprentice
Posts: 33
Joined: Sat Jul 01, 2006 4:00 pm

Re: Google Plus Author Links

Post by miggalvez » Thu Feb 09, 2012 8:56 pm

Awesome! It works! Thanks a lot!

RedEye
Joomla! Ace
Joomla! Ace
Posts: 1460
Joined: Sat Jan 21, 2006 8:42 pm

Re: Google Plus Author Links

Post by RedEye » Thu Feb 09, 2012 9:01 pm

you`re welcome

miggalvez
Joomla! Apprentice
Joomla! Apprentice
Posts: 33
Joined: Sat Jul 01, 2006 4:00 pm

Re: Google Plus Author Links

Post by miggalvez » Thu Feb 09, 2012 9:32 pm

The code does what it is supposed to, but I tested my articles to check if Google saw the authorship markup and I got an error saying that it didn't.

I think Google's guidelines have changed with respect to this. According to this page http://support.google.com/webmasters/bi ... er=1229920 the correct syntax would be something like this:
The article should link to your Google Profile using rel="author", like this:
Check out <a href="https://plus.google.com/101169865857654555922" rel="author">John's Google+ profile</a>.
What do I have to change in the code for it to render in that way?

RedEye
Joomla! Ace
Joomla! Ace
Posts: 1460
Joined: Sat Jan 21, 2006 8:42 pm

Re: Google Plus Author Links

Post by RedEye » Thu Feb 09, 2012 9:42 pm

pls test this for me :)
$page = $db->loadResult().'?rel=author';
to
$page = $db->loadResult();
and
echo JText::sprintf('COM_CONTENT_WRITTEN_BY', JHtml::_('link', JRoute::_($page), $author));
to
echo JText::sprintf('COM_CONTENT_WRITTEN_BY', JHtml::_('link', JRoute::_($page), $author, array('rel' => 'author')));

edit: add missing closing parenthesis
Last edited by RedEye on Thu Feb 09, 2012 9:56 pm, edited 1 time in total.

miggalvez
Joomla! Apprentice
Joomla! Apprentice
Posts: 33
Joined: Sat Jul 01, 2006 4:00 pm

Re: Google Plus Author Links

Post by miggalvez » Thu Feb 09, 2012 9:51 pm

Yes!! Almost perfect. A closing parenthesis was missing. Here is the final code:

Code: Select all

<?php if ($params->get('show_author') && !empty($this->item->author )) : ?>
   <dd class="createdby">
      <?php $author =  $this->item->author; ?>
      <?php $author = ($this->item->created_by_alias ? $this->item->created_by_alias : $author);?>

         <?php if (!empty($this->item->contactid ) &&  $params->get('link_author') == true):?>
            <?php    echo JText::sprintf('COM_CONTENT_WRITTEN_BY' ,
             JHtml::_('link', JRoute::_('index.php?option=com_contact&view=contact&id='.$this->item->contactid), $author)); ?>

         <?php else :?>
            <?php //echo JText::sprintf('COM_CONTENT_WRITTEN_BY', $author); ?>
<?php
$db = JFactory::getDbo();
$query = 'SELECT `webpage` FROM `#__contact_details` WHERE `id` = '. (int) $this->item->contactid;
$db->setQuery($query);
$page = $db->loadResult()';
echo JText::sprintf('COM_CONTENT_WRITTEN_BY', JHtml::_('link', JRoute::_($page), $author, array('rel' => 'author')));
?>
            
         <?php endif; ?>
   </dd>
<?php endif; ?>

awdesign
Joomla! Apprentice
Joomla! Apprentice
Posts: 10
Joined: Sun Jul 15, 2007 9:49 pm

Re: Google Plus Author Links

Post by awdesign » Sun Mar 11, 2012 1:21 pm

RedEye wrote:I`m not tested this in J2.5 but it should work.
However Joomla code has also changed a bit here, but only for the Joomla link to the contact page, so in 2.5 it looks like this and it worked.

Code: Select all

<?php if ($params->get('show_author') && !empty($this->item->author )) : ?>
	<dd class="createdby">
		<?php $author =  $this->item->author; ?>
		<?php $author = ($this->item->created_by_alias ? $this->item->created_by_alias : $author);?>

			<?php if (!empty($this->item->contactid ) &&  $params->get('link_author') == true):?>
				<?php 	echo JText::sprintf('COM_CONTENT_WRITTEN_BY' ,
				 JHtml::_('link', JRoute::_('index.php?option=com_contact&view=contact&id='.$this->item->contactid), $author)); ?>

			<?php else :?>
				<?php //echo JText::sprintf('COM_CONTENT_WRITTEN_BY', $author); ?>
<?php
$db = JFactory::getDbo();
$query = 'SELECT `webpage` FROM `#__contact_details` WHERE `id` = '. (int) $this->item->contactid;
$db->setQuery($query);
$page = $db->loadResult().'?rel=author';
echo JText::sprintf('COM_CONTENT_WRITTEN_BY', JHtml::_('link', JRoute::_($page), $author));
?>
				
			<?php endif; ?>
	</dd>
<?php endif; ?>
Subject: Google Plus Author Links

Code: Select all

<?php if ($params->get('show_author') && !empty($this->item->author )) : ?>
	<dd class="createdby">
		<?php $author =  $this->item->author; ?>
		<?php $author = ($this->item->created_by_alias ? $this->item->created_by_alias : $author);?>

			<?php if (!empty($this->item->contactid ) &&  $params->get('link_author') == true):?>
				<?php 	echo JText::sprintf('COM_CONTENT_WRITTEN_BY' ,
				 JHtml::_('link', JRoute::_('index.php?option=com_contact&view=contact&id='.$this->item->contactid), $author)); ?>

			<?php else :?>
				<?php //echo JText::sprintf('COM_CONTENT_WRITTEN_BY', $author); ?>
<?php
$db = JFactory::getDbo();
$query = 'SELECT `webpage` FROM `#__contact_details` WHERE `id` = '. (int) $this->item->contactid;
$db->setQuery($query);
$page = $db->loadResult().'?rel=author';
echo JText::sprintf('COM_CONTENT_WRITTEN_BY', JHtml::_('link', JRoute::_($page), $author));
?>
				
			<?php endif; ?>
	</dd>
<?php endif; ?>
[/quote]

Hi Redeye; I used your code above with Joomla 2.5.1 and it works very good. thanks for your help. One problem I have, now I see two Written By at the articles, first one appears at the beginning of the article it does not have the link to GooglePlus, second one appears at the end of the article and it shows link to GooglePlus page and it works fine.
How can I get rid of the first Written by at the beginning of the article?
thanks for your help,
Lewis

RedEye
Joomla! Ace
Joomla! Ace
Posts: 1460
Joined: Sat Jan 21, 2006 8:42 pm

Re: Google Plus Author Links

Post by RedEye » Sun Mar 11, 2012 1:30 pm

The current example you can find in the post from miggalvez http://forum.joomla.org/viewtopic.php?f ... 1#p2740737.
If you have two author links in your page check your override and the rest of the file if the author is added somewhere else a second time.

awdesign
Joomla! Apprentice
Joomla! Apprentice
Posts: 10
Joined: Sun Jul 15, 2007 9:49 pm

Re: Google Plus Author Links

Post by awdesign » Sun Mar 11, 2012 8:06 pm

great. it works, thanks for your help,
Lewis

User avatar
eskwire
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 118
Joined: Sun Sep 25, 2005 3:57 pm
Location: Atlanta, GA
Contact:

Re: Google Plus Author Links

Post by eskwire » Tue Apr 03, 2012 6:32 pm

Thanks for this post. Very Helpful.

Does anyone know of a plugin that is able to accomplish this?

Thanks! -- Steven

User avatar
dbstudios
Joomla! Apprentice
Joomla! Apprentice
Posts: 13
Joined: Tue Mar 27, 2012 10:37 pm
Location: Atlanta
Contact:

Re: Google Plus Author Links

Post by dbstudios » Tue May 15, 2012 1:12 am

Great idea!

Does anyone know if there are any good plugins for this?

Thanks!
Joomla Hosting Reviews and More: http://joomlahosting.co

unleash_it
Joomla! Ace
Joomla! Ace
Posts: 1311
Joined: Wed Nov 05, 2008 11:28 pm

Re: Google Plus Author Links

Post by unleash_it » Tue May 29, 2012 5:01 pm

hello dear Steven hello DbStudio hello dear Redeye

many many thanks for the great thread - i stumbled across this - and well this is very very interesting.
eskwire wrote:Thanks for this post. Very Helpful.

Does anyone know of a plugin that is able to accomplish this?

Thanks! -- Steven
i eagerly want to know this - just let us figure out how this can be accomplished

Look forward to a fruitful discussion

greetings - ;)
regards un-leash,
a big fan for ++ 11 years now: With Joomla you can easily create and extend your website: see the site, that offers you ideas & modules - extensions.joomla.org - it lists over 4000 extensions

User avatar
eskwire
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 118
Joined: Sun Sep 25, 2005 3:57 pm
Location: Atlanta, GA
Contact:

Re: Google Plus Author Links

Post by eskwire » Tue May 29, 2012 8:01 pm

I have not been able to find a plugin that would accomplish this when using just the Joomla core.

There is one that works when you are using Community Builder or Jomsocial. I am not positive about this.

I am in the process of getting one built, it still may be a while.

If I get a working solution I will post my solution here.

Hope this helps! -- Steven

unleash_it
Joomla! Ace
Joomla! Ace
Posts: 1311
Joined: Wed Nov 05, 2008 11:28 pm

Re: Google Plus Author Links

Post by unleash_it » Thu May 31, 2012 4:15 pm

hello Steven

thx for writing back and yes: for steppin up the plate. You defintly deserve a monster congratulation for your engaged work. I am pretty sure that many many of Joomla-Fans are waitin to hear from here ....

greetings
regards un-leash,
a big fan for ++ 11 years now: With Joomla you can easily create and extend your website: see the site, that offers you ideas & modules - extensions.joomla.org - it lists over 4000 extensions

User avatar
MeteorSoul
Joomla! Apprentice
Joomla! Apprentice
Posts: 11
Joined: Thu Apr 21, 2011 6:34 pm
Contact:

Re: Google Plus Author Links

Post by MeteorSoul » Mon Nov 26, 2012 3:20 pm

Thanks to all of you, work good on Joomla 2.5.8
it's nice for people like me that never know about coding, :)

and please help me to put this code

Code: Select all

target="_blank"
to this :eek:

Code: Select all

<?php if ($params->get('show_author') && !empty($this->item->author )) : ?>
   <dd class="createdby">
      <?php $author =  $this->item->author; ?>
      <?php $author = ($this->item->created_by_alias ? $this->item->created_by_alias : $author);?>

         <?php if (!empty($this->item->contactid ) &&  $params->get('link_author') == true):?>
            <?php    echo JText::sprintf('COM_CONTENT_WRITTEN_BY' ,
             JHtml::_('link', JRoute::_('index.php?option=com_contact&view=contact&id='.$this->item->contactid), $author)); ?>

         <?php else :?>
            <?php //echo JText::sprintf('COM_CONTENT_WRITTEN_BY', $author); ?>
<?php
$db = JFactory::getDbo();
$query = 'SELECT `webpage` FROM `#__contact_details` WHERE `id` = '. (int) $this->item->contactid;
$db->setQuery($query);
$page = $db->loadResult().'?rel=author';
echo JText::sprintf('COM_CONTENT_WRITTEN_BY', JHtml::_('link', JRoute::_($page), $author));
?>
            
         <?php endif; ?>
   </dd>
<?php endif; ?>
Please read the Forum rules regarding signatures: http://forum.joomla.org/viewtopic.php?t=65


Locked

Return to “Joomla! 2.5 Coding”