Hi. Can you tell me, what changes i have to make in community surveys module to show jomsocial avatars instead of text usernames??
Like it on Facebook, Tweet it or share this topic on other bookmarking websites.
  • Re: Show avatars instead of text username in module

    by » 9 years ago


    Add below function to modules/mod_communitysurveys/helper.php

    function getUserAvtar($avatarType='jomsocial', $userid=0, $height=48, $username='username') {
    $db = JFactory::getDBO();
    $jspath = JPATH_BASE.DS.'components'.DS.'com_community'.DS.'libraries'.DS.'core.php';
    $avatar = "";
    if(file_exists($jspath)){
    include_once($jspath);
    // Get CUser object
    $jsuser =& CFactory::getUser($userid);
    $usrname = $jsuser->$username;
    $avatarLoc = $jsuser->getThumbAvatar();
    $link = CRoute::_('index.php? option=com_community&view=profile&userid='.$userid.'&Itemid='.JRequest::getInt('Itemid'));
    $avatar = "<a href=\"$link\"><img class=\"hasTip\" style=\"border: 1px solid #cccccc; height: " . $height . "px;\" src=\"$avatarLoc\" alt=\"$usrname\" title=\"$usrname\" /></a>";
    }

    return $avatar;
    }

    Now you can use this function in your tmpl.latest_surveys.php file or any other
    Replace
    <td align="left"><?php echo ($item->username)?$item->username:JText::_('GUEST'); ?></td>

    With
    <td align="left">
    <?php echo modCommunitySurveysHelper::getUserAvtar('jomsocial', $item->created_by, 48, $item->username);?>
    <?php echo ($item->username)?$item->username:JText::_('GUEST'); ?></td>

    Follow me on twitter: https://twitter.com/corejoomla
    If you use our extensions, please post a rating and a review at the Joomla! Extensions Directory.
    Sociable | Surveys | 
    CjForum | Polls | Answers | Quizzes | Quotes | GPS ToolsCjFit | CjBlog


  • Re: Show avatars instead of text username in module

    by » 9 years ago


    Ok. Thank you. It works, but without tooltip with username when hover on avatar.

  • Re: Show avatars instead of text username in module

    by » 9 years ago


    Did you mean JomSocial tooltip or standard windows tooltip? A standard tooltip with username is already there in code. JomSocial tooltip cannot be added here as it is JomSocial specific and its libraries also need to load to make it.

    Follow me on twitter: https://twitter.com/corejoomla
    If you use our extensions, please post a rating and a review at the Joomla! Extensions Directory.
    Sociable | Surveys | 
    CjForum | Polls | Answers | Quizzes | Quotes | GPS ToolsCjFit | CjBlog


You do not have permissions to reply to this topic.

Powered by CjForum

Trending Topics

Installation error - Warning : constant(): Couldn't find constant JPATH_
  • 3 replies
Hello,I'm running Joomla 3.9.19 and PHP 7.2. I in stalled...

Integrating Surveys with Affiliate Tracker
  • 3 replies
Hello,   We are using Affiliate Tracker as an affiliate...

Athor and category hide
  • 1 reply
Hello, I am new to Community Polls. I already come that far to...

Several issues identified in the Groups Create/Edit
  • 14 replies
Hi, Today I logged into my Sociable front end, clicked on Groups...

community polls - no vote possible
  • 2 replies
Dear all, I face a problem with polls. If I create a poll e.g. with...