Site logo

Archived topic

Php code snippet in hook element does not work

1 reply · Started by Carsten on August 3, 2020

Viewing posts 1–2 of 2

Hi there, I added this code to a hook element, but it does not render anything out. The code should be ok, any idea why it does not work in the element?

<?php  
/* custom Recent visitor code to list it anywhere for logged in user */
$visitors = visitors_get_recent_visitors(get_current_user_id(), 5);//pass the user id for which we are retriving and how many we want
foreach( (array) $visitors as $visitor_id ){
    echo bp_core_get_userlink( $visitor_id );//display the name of the 
    //bp_core_get_user_displayname( $visitor_id ); //use it to fetch the user display name
    //bp_core_get_user_domain( $visitor_id ); //use it to get user profile url
    //bp_core_fetch_avatar( array('item_id'=> $visitor_id, 'height'=>25, 'width'=> 25)); //fetch user avatar
}
?>

Thanks

Hi there,

Just to confirm, you've checked to execute PHP?

The element itself doesn't change your code at all.

Does the code work outside of a hook element?

This archived topic is closed to new replies.