1

I have this situation:

<?php 
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 
    $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.

1 Answer 1

1

My solution

CRoute::_('index.php?option=com_community&actid='.$activity->id)

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>'
1
  • If this answer resolved your issue, please mark your answer with the green tick. Mar 12, 2019 at 1:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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