The Joomla! Forum ™



Forum rules


Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.



Post new topic Reply to topic  [ 18 posts ] 
Author Message
PostPosted: Fri Mar 18, 2011 5:07 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Thu Oct 28, 2010 4:26 pm
Posts: 12
I have been looking for a solution to use JomSocial (2.0.6) avatars with a link to the JS profile in the comments of Zoo (2.3) applications. After much searching, I found some code on a Russian forum, but it had many syntax errors and killed my template.

I cleaned up all the syntax errors I saw, but it doesn't quite work. I, however, am NOT a coder and am not sure what I am missing to make it work. I am sure others would like this functionality as well, so I am posting the code for the modified components/com_zoo/partials/_comment.php in hopes that one of the code gurus on here can complete it so that those of us using these components have a bit more integration on our site until the guys at YooTheme ad this functionality.
Code:
<?php

/**
* @package   ZOO Component
* @file      _comment.php
* @version   2.3.7 March 2011
* @author    YOOtheme http://www.yootheme.com
* @copyright Copyright (C) 2007 - 2011 YOOtheme GmbH
* @license   http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 only
*/


// no direct access

defined('_JEXEC') or die('Restricted access');



// set author name

$author->name = $author->name ? $author->name : JText::_('Anonymous');



?>

<div id="comment-<?php echo $comment->id; ?>" class="comment <?php if ($author->isJoomlaAdmin()) echo 'comment-byadmin'; ?>">
<Div class = "comment-Head" >
<?php  if  ( ! empty ( $author -> user_id ) ) : ?>
<?php
      $userid = $author -> user_id ;
      if ( file_exists ( JPATH_BASE. DS. 'Components' . DS. 'com_community' . DS. 'libraries' . DS. 'core.php' ) ) {
         require_once ( JPATH_BASE. DS. 'Components' . DS. 'com_community' . DS. 'libraries' . DS. 'core.php' ) ;
 
         $link = CRoute::_('index.php?option=com_community&view=profile&userid='.$userid);
         $user  = CFactory::getUser( $userid );
         $name  = $user->getDisplayName();
         $avatarUrl = $user->getThumbAvatar();
      }
      else
      {
         $link = JRoute:: _ ('index.php?option=com_user&view=user&userid='.$userid);
         $user =& JFactory::getUser();
         $name = $user -> name ;
         $avatarUrl = "" ;
      }
      ?>
<?php  if  ( $avatarUrl ) : ?>
<Div class = "avatar" >
<?php  echo  '<img src="'. $avatarUrl .'"/>';  ?>
</ Div>
<?php  endif ; ?>
<Div class = "Author" >
<a href = "<?php echo $link ?>" Title = "<?php echo $name ?>" rel = "nofollow" > <?php echo  $name ?> </ a>
      </ Div>
        <?php  else : ?>
        <?php  if  ( $params -> Get ( 'avatar' , 0 ) ) : ?>
        <div class="avatar"> <?php echo $author->getAvatar(50); ?> </div>
        <?php  endif ; ?>
        <?php  if  ( $author -> url ) : ?>
        <div class="author"> <a href="<?php echo JRoute::_($author->url); ?>" title="<?php echo $author->url; ?>" rel="nofollow"><?php echo $author->name; ?></a> </div>
        <?php  else : ?>
        <Div class = "Author" > <?php echo  $author -> name ;?> </ div>
  <?php  endif ; ?>
  <?php  endif ; ?>
  <div class="meta"> <?php echo JHTML::_('date', $comment->created, JText::_('DATE_FORMAT_COMMENTS') ); ?> | <a class="permalink" href="#comment-<?php echo $comment->id; ?>">#</a> </div>
  <div class="comment-body">
            <p class="content"> <?php echo CommentHelper::filterContentOutput($comment->content); ?> </p>
            <?php if ($comment->getItem()->isCommentsEnabled()) : ?>
            <div class="reply"><a href="#" rel="nofollow"><?php echo JText::_('Reply'); ?></a></div>
            <?php endif; ?>
            <?php if ($comment->state != Comment::STATE_APPROVED) : ?>
            <div class="moderation"><?php echo JText::_('COMMENT_AWAITING_MODERATION'); ?></div>
            <?php endif; ?>
          </div>
</div>


Any help would be greatly appreciated.


Top
 Profile  
 
PostPosted: Tue Oct 11, 2011 9:07 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Tue Aug 14, 2007 10:19 am
Posts: 15
Would be a great if someone can help with it!


Top
 Profile  
 
PostPosted: Wed Oct 19, 2011 8:24 pm 
User avatar
Joomla! Apprentice
Joomla! Apprentice

Joined: Tue Nov 14, 2006 1:32 am
Posts: 15
Location: USA
Try this on for size! I had the same issue.

Code:
<?php
/**
* @package   com_zoo
* @author    YOOtheme http://www.yootheme.com
* @copyright Copyright (C) YOOtheme GmbH
* @license   http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 only
*/

// no direct access
defined('_JEXEC') or die('Restricted access');

// set author name
$author->name = $author->name ? $author->name : JText::_('Anonymous');

//
if  ( !empty($author->user_id )) {
    $userid = $author->user_id;
    $api_JS = JPATH_BASE.DS.'components'.DS.'com_community'.DS.'libraries'.DS.'core.php';
    if ( file_exists($api_JS) ) {
        require_once($api_JS);
        // overrides value in dbase
        $author->url = CRoute::_('index.php?option=com_community&view=profile&userid='.$userid);
        $user = CFactory::getUser($userid);
        $author->name = $user->getDisplayName();
        $avatarUrl = $user->getThumbAvatar();
        $avatar = '<img title="'.$author->name.'" src="'.$avatarUrl.'" height="50" width="50" alt="'.$author->name.'" smartload="26" class="" style="visibility: visible; zoom: 1; opacity: 1; ">';

    }

}

?>
<li>
   <div id="comment-<?php echo $comment->id; ?>" class="comment <?php if ($author->isJoomlaAdmin()) echo 'comment-byadmin'; ?>">

      <div class="comment-head">

         <?php if ($params->get('avatar', 0)) : ?>
         <div class="avatar">
                            <?php if  ( !empty($author->user_id )) : ?>
                                <?php echo $avatar; ?>
                            <?php else : ?>
            <?php echo $author->getAvatar(50); ?>
                            <?php endif; ?>
         </div>
         <?php endif; ?>

         <?php if ($author->url) : ?>
            <div class="author">
               <a href="<?php echo JRoute::_($author->url); ?>" title="<?php echo $author->url; ?>" rel="nofollow"><?php echo $author->name; ?></a>
            </div>
         <?php else: ?>
            <div class="author"><?php echo $author->name; ?></div>
         <?php endif; ?>

         <div class="meta">
            <?php echo $this->app->html->_('date', $comment->created, $this->app->date->format(JText::_('DATE_FORMAT_COMMENTS')), $this->app->date->getOffset()); ?>
            | <a class="permalink" href="#comment-<?php echo $comment->id; ?>">#</a>
         </div>

      </div>

      <div class="comment-body">

         <p class="content">
            <?php echo $this->app->comment->filterContentOutput($comment->content); ?>
         </p>

         <?php if ($comment->getItem()->isCommentsEnabled()) : ?>
            <div class="reply"><a href="#" rel="nofollow"><?php echo JText::_('Reply'); ?></a></div>
         <?php endif; ?>

         <?php if ($comment->state != Comment::STATE_APPROVED) : ?>
            <div class="moderation"><?php echo JText::_('COMMENT_AWAITING_MODERATION'); ?></div>
         <?php endif; ?>

      </div>

   </div>

   <ul class="level<?php echo ++$level; ?>">
      <?php
      foreach ($comment->getChildren() as $comment) {
         echo $this->partial('comment', array('level' => $level, 'comment' => $comment, 'author' => $comment->getAuthor(), 'params' => $params));
      }
      ?>
   </ul>

</li>

_________________
- Dustin
Klovera, Inc.
www.klovera.com


Top
 Profile  
 
PostPosted: Wed Oct 19, 2011 11:39 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Tue Aug 14, 2007 10:19 am
Posts: 15
Thats great loophole! Thanks a lot!
Is it possible to make the zoo comment module compatible also, please?


Top
 Profile  
 
PostPosted: Mon Oct 24, 2011 3:22 pm 
User avatar
Joomla! Apprentice
Joomla! Apprentice

Joined: Tue Nov 14, 2006 1:32 am
Posts: 15
Location: USA
Should be able to do something similar for the comment module. The example above was for a project I'm currently working on. If we end up taking it to the comment module I'll post the code for that as well.

_________________
- Dustin
Klovera, Inc.
www.klovera.com


Top
 Profile  
 
PostPosted: Sat Nov 19, 2011 3:51 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Tue Aug 14, 2007 10:19 am
Posts: 15
any news on it?


Top
 Profile  
 
PostPosted: Mon Nov 21, 2011 3:03 pm 
User avatar
Joomla! Apprentice
Joomla! Apprentice

Joined: Tue Nov 14, 2006 1:32 am
Posts: 15
Location: USA
Nothing yet. We should be wrapping up the project in the next few days. So far there hasn't been a need to do this in the comment module.

_________________
- Dustin
Klovera, Inc.
www.klovera.com


Top
 Profile  
 
PostPosted: Wed Dec 07, 2011 9:45 am 
User avatar
Joomla! Apprentice
Joomla! Apprentice

Joined: Tue Nov 14, 2006 1:32 am
Posts: 15
Location: USA
May not be the best solution, but this works for the bubble-angle-v comments layout:

Code:
<?php
/**
* @package   ZOO Comment
* @author    YOOtheme http://www.yootheme.com
* @copyright Copyright (C) YOOtheme GmbH
* @license   http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 only
*/

// no direct access
defined('_JEXEC') or die('Restricted access');

// include css
$zoo->document->addStylesheet('mod_zoocomment:tmpl/bubble-angled-v/style.css');

$count = count($comments);
$table = $zoo->table->item;


?>

<div class="zoo-comment bubble-angled-v">

   <?php if ($count) : ?>

      <ul>
         <?php $i = 0; foreach ($comments as $comment) : ?>

            <?php // set author name
               $author = $comment->getAuthor();
               $author->name = $author->name ? $author->name : JText::_('COM_ZOO_ANONYMOUS');
               $item = $table->get($comment->item_id);
                                        <!-- edit here -->
                                        if  ( !empty($author->user_id )) {
                                            $userid = $author->user_id;
                                            $api_JS = JPATH_BASE.DS.'components'.DS.'com_community'.DS.'libraries'.DS.'core.php';
                                            if ( file_exists($api_JS) ) {
                                                require_once($api_JS);
                                                // overrides value in dbase
                                                $author->url = CRoute::_('index.php?option=com_community&view=profile&userid='.$userid);
                                                $user = CFactory::getUser($userid);
                                                $author->name = $user->getDisplayName();
                                                $avatarUrl = $user->getThumbAvatar();
                                                $avatar = '<img title="'.$author->name.'" src="'.$avatarUrl.'" height="50" width="50" alt="'.$author->name.'" smartload="26" class="" style="visibility: visible; zoom: 1; opacity: 1; ">';

                                            }

                                        }
                                        <!-- end edit here -->
            ?>

            <li class="<?php if ($i % 2 == 0) { echo 'odd'; } else { echo 'even'; } ?> <?php if ($author->isJoomlaAdmin()) echo 'comment-byadmin'; ?>">

               <div class="bubble">

                  <div class="bubble-arrow"></div>

                  <div class="bubble-t1">
                     <div class="bubble-t2">
                        <div class="bubble-t3"></div>
                     </div>
                  </div>

                  <div class="bubble-1">
                     <div class="bubble-2">
                        <div class="bubble-3"><?php echo $zoo->comment->filterContentOutput($zoo->string->truncate($comment->content, CommentModuleHelper::MAX_CHARACTERS)); ?></div>
                     </div>
                  </div>

                  <div class="bubble-b1">
                     <div class="bubble-b2">
                        <div class="bubble-b3"></div>
                     </div>
                  </div>

               </div>

               <div class="speaker">

                  <?php if ($params->get('show_avatar', 1)) : ?>
                  <div class="avatar">
<!-- edit here -->
<?php if ($author->url) : ?><a href="<?php echo $author->url; ?>" title="<?php echo $author->url; ?>" rel="nofollow"><?php endif; ?>
<?php if  ( !empty($author->user_id )) : ?>
<?php echo $avatar; ?>
<?php else : ?>
<?php echo $author->getAvatar($params->get('avatar_size', 50)); ?>
<?php endif; ?>
<?php if ($author->url) : ?></a><?php endif; ?>
<!-- end edit here -->

                  </div>
                  <?php endif; ?>

                  <?php if ($params->get('show_author', 1)) : ?>
                  <h3 class="author">
                     <?php if ($author->url) : ?><a href="<?php echo $author->url; ?>" title="<?php echo $author->url; ?>" rel="nofollow"><?php endif; ?>
                     <?php echo $author->name; ?>
                     <?php if ($author->url) : ?></a><?php endif; ?>
                  </h3>
                  <?php endif; ?>

                  <?php if ($params->get('show_meta', 1)) : ?>
                  <p class="meta">
                     <?php echo $zoo->html->_('date', $comment->created, $zoo->date->format(JText::_('ZOO_COMMENT_MODULE_DATE_FORMAT')), $zoo->date->getOffset()); ?>
                     | <a class="permalink" href="<?php echo JRoute::_($zoo->route->comment($comment)); ?>">#</a>
                  </p>
                  <?php endif; ?>

               </div>

            </li>

         <?php $i++; endforeach; ?>
      </ul>

   <?php else : ?>
      <?php echo JText::_('COM_ZOO_NO_COMMENTS_FOUND'); ?>
   <?php endif; ?>

</div>

_________________
- Dustin
Klovera, Inc.
www.klovera.com


Top
 Profile  
 
PostPosted: Fri Dec 09, 2011 6:13 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Tue Aug 14, 2007 10:19 am
Posts: 15
Great mate! Thanks a lot!


Top
 Profile  
 
PostPosted: Fri Dec 09, 2011 11:00 pm 
User avatar
Joomla! Apprentice
Joomla! Apprentice

Joined: Tue Nov 14, 2006 1:32 am
Posts: 15
Location: USA
My pleasure. Hope it helps!

_________________
- Dustin
Klovera, Inc.
www.klovera.com


Top
 Profile  
 
PostPosted: Tue Dec 13, 2011 6:59 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Thu Oct 28, 2010 4:26 pm
Posts: 12
Works like a charm...thank you so much.


Top
 Profile  
 
PostPosted: Wed Dec 28, 2011 12:24 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Tue Aug 14, 2007 10:19 am
Posts: 15
Too bad! It breaks with the latest zoo :/ Yoo team changed mod_yoocomment a bit... Can you please rewrite it?


Top
 Profile  
 
PostPosted: Wed Dec 28, 2011 6:50 pm 
User avatar
Joomla! Apprentice
Joomla! Apprentice

Joined: Tue Nov 14, 2006 1:32 am
Posts: 15
Location: USA
Darn it all ;)

When I circle back around to this I'll post the update here.

_________________
- Dustin
Klovera, Inc.
www.klovera.com


Top
 Profile  
 
PostPosted: Wed Dec 28, 2011 7:46 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Tue Aug 14, 2007 10:19 am
Posts: 15
We love you!


Top
 Profile  
 
PostPosted: Tue Jun 19, 2012 5:58 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Sat Nov 24, 2007 6:48 pm
Posts: 6
Integration jomsocial to yoflash


Last edited by asifagaria on Tue Jun 19, 2012 6:02 pm, edited 1 time in total.

Top
 Profile  
 
PostPosted: Tue Jun 19, 2012 5:59 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Sat Nov 24, 2007 6:48 pm
Posts: 6
Sir I Integration jomsocial to yoflash user play game only show game name i wont show name and image game how to do please help me


Top
 Profile  
 
PostPosted: Fri Feb 22, 2013 10:38 pm 
Joomla! Fledgling
Joomla! Fledgling

Joined: Fri Feb 22, 2013 10:34 pm
Posts: 2
Hello,

This code doesn´t work anymore. Anyone has an actual version of it? I need the JomSocial avatar and a JS profile link in the zoo comments. (Joomla 2.5)

Thanks for any help.


Top
 Profile  
 
PostPosted: Fri Feb 22, 2013 11:23 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Tue Aug 14, 2007 10:19 am
Posts: 15
Yeah! That will be great!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 18 posts ] 



Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group