Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • erkdahl Friend
    #158717

    Hi there,

    I’m using AlphaUserPoints component which among other things expands the joomlausers with an avatar. I would like to show this avatar in the JA comments. Is this an upcomming feature?
    I am a professional developer myself, so if this is not going to be a feature in the nearest time, could you please point me in the right direction so I could try to solve this myself?

    Thanks!

    nghiatd Friend
    #371803

    Dear erkdahl,

    I don’t think this wil be an upcoming feature:
    – AlphaUserPoints component is not all that popular and we do not get many requests for its integration. –
    Integration will be complex and will take lot of time.

    But i will help you to solve your problem:

    – Please open the file: administratorcomponentscom_jacommentviewsconfigstmpllayout.php
    find code default in line 126:

    <select name="layout" id="type_avatar" multiple="multiple" size="4">
    <option value="0" <?php if($type_avatar == 0) echo 'selected="selected"';?> id="type_avatar_0"><?php echo JText::_('Default');?></option>
    <option value="1" <?php if($type_avatar == 1) echo 'selected="selected"';?> id="type_avatar_1"><?php echo JText::_('Community Builder');?></option>
    <option value="2" <?php if($type_avatar == 2) echo 'selected="selected"';?> id="type_avatar_3"><?php echo JText::_('Fireboard (Kunena)');?></option>
    <option value="4" <?php if($type_avatar == 4) echo 'selected="selected"'; ?>><?php echo JText::_('JomSocial');?></option>
    <option value="3" <?php if($type_avatar == 3) echo 'selected="selected"';?> id="type_avatar_4"><?php echo JText::_('Gravatar');?></option>
    </select>

    then edit to:

    <select name="layout" id="type_avatar" multiple="multiple" size="4">
    <option value="0" <?php if($type_avatar == 0) echo 'selected="selected"';?> id="type_avatar_0"><?php echo JText::_('Default');?></option>
    <option value="1" <?php if($type_avatar == 1) echo 'selected="selected"';?> id="type_avatar_1"><?php echo JText::_('Community Builder');?></option>
    <option value="2" <?php if($type_avatar == 2) echo 'selected="selected"';?> id="type_avatar_3"><?php echo JText::_('Fireboard (Kunena)');?></option>
    <option value="4" <?php if($type_avatar == 4) echo 'selected="selected"'; ?>><?php echo JText::_('JomSocial');?></option>
    <option value="3" <?php if($type_avatar == 3) echo 'selected="selected"';?> id="type_avatar_4"><?php echo JText::_('Gravatar');?></option>
    <option value="5" <?php if($type_avatar == 5) echo 'selected="selected"';?> id="type_avatar_4"><?php echo JText::_('AlphaUserPoints');?></option>
    </select>

    – Then open file componentscom_jacommenthelpersjahelper.php
    find code default in line 1368

    function getAvatar($userID = 0, $ismodule = 0, $avatarSize = 0, $typeAvatar = '')
    then edit it.

    Best Regards.

    erkdahl Friend
    #372025

    Thanks for good pointers! This was pretty easy to implement. AlphaUserPoints avatars is not much different from CB avatars, so most of the job was done. For anyone else wondering how to do this, here is short description:
    Remember to first edit the layout.php as nghiatd posted above. Then edit jahelper.php
    In the function mentioned above, put the following below case 3 break:


    case 5 :
    $avatar = JACommentHelpers::getAvatarAlphaUserPoints ( $userID );
    break;


    Then create the getAvatarAlphaUserPoints function. Put this close to the other getAvatar-functions. I put mine just above getAvatarGravatar. Insert this:


    function getAvatarAlphaUserPoints ( $userID ){
    if(!defined("_AUP_AVATAR_LIVE_PATH")) {
    define('_AUP_AVATAR_LIVE_PATH', JURI::base(true) . '/components/com_alphauserpoints/assets/images/avatars/');
    }
    $db = & JFactory::getDBO ();
    $sql = "SELECT avatar FROM #__alpha_userpoints WHERE userid='{$userID}'";
    $db->setQuery ( $sql );
    $imgName = $db->loadResult ();

    return ( $imgName!='' ) ? _AUP_AVATAR_LIVE_PATH . $imgName : $defaultAvatarAUP ;

    }

    And there you have it.
    Feel free to implement my code in your future JA Comments-versions.

    Best regards
    Erik

    nghiatd Friend
    #372211

    Hi Mate,

    Thanks you very much.
    We will update your code in next version of jacomment.

    Best Regards. :-*

Viewing 4 posts - 1 through 4 (of 4 total)

This topic contains 4 replies, has 2 voices, and was last updated by  nghiatd 13 years, 5 months ago.

We moved to new unified forum. Please post all new support queries in our New Forum