I have this situation:

foreach ($activities as $activity){

    // user
    $user  = CFactory::getUser( $activity->actor );
    $name = $user->getDisplayName();
    $link = CRoute::_('index.php?option=com_community&view=profile&userid='.$activity->actor);

    $likes = count(explode(',', $activity->like));
    echo $activity->id. ' - '.JHtml::Date($activity->created, 'd-m-Y H:i:s', true) .' por <a href="'.$link.'">'.$name.'</a>';
    echo ' <i class="fa fa-thumbs-up"></i> '.$likes.'<hr>';

I need the post (activity) link based on activity ID.


My solution


for example: instead

JHtml::Date($activity->created, 'd-m-Y H:i:s', true)

'<a href="'.CRoute::_('index.php?option=com_community&actid='.$activity->id).'">'.
JHtml::Date($activity->created, 'd-m-Y H:i:s', true).'</a>'
  • If this answer resolved your issue, please mark your answer with the green tick.
    – mickmackusa
    Mar 12 '19 at 1:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.