Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I need to show on the user profile its connected heartbeat stream to everyone. For that I use the friendlist_activity module.
Out of the box I could not make this happen, as only logged users can read other users' connected heartbeat stream.
I've checked the module and found:
/**
* Implementation of hook_heartbeat_register_access_types().
*/
function friendlist_activity_heartbeat_register_access_types() {
return array(
0 => array(
'name' => 'Heartbeat relational activity',
'class' => 'ConnectedHeartbeat',
'path' => 'connectedheartbeat.inc',
'module' => 'friendlist_activity',
'access' => 'user_is_logged_in'
),
);
}
I've commented out the last line which restrict access, so it works as I want, but this work around implies that I modify the contrib module, which I'd really would like to avoid. Any ideas on a better way to implement that?
Comments
Comment #1
Stalski CreditAttribution: Stalski commentedWell, in this case, in fact, you need to add your code in a new custom stream
And then just define your class as extension of ConnectedHeartbeat:
myconnectedheartbeat.inc:
Comment #2
Stalski CreditAttribution: Stalski commentedI will set this to "by design" , however for drupal7 i will tackle this problem more convenient.
Most important thing is that you can do it without hacking heartbeat. That's what the hooks are for: customization. In the worst case scenario, you need to extend on HeartbeatAccess base class and take over the complete class body of ConnectedHeartbeat.
Greetz,
Stalski
Comment #3
Cap'taine Crochet CreditAttribution: Cap'taine Crochet commentedThat's exactly what I was looking for. The code you provided works fine, but I had to change the heartbeat_include like that:
Thanks for your efficient support.
Comment #4
Stalski CreditAttribution: Stalski commentedGlad i could help.
I started an issue crosslink on http://heartbeat.menhireffect.be/page/documentation to this issue. Certainly something that needs to be covered in drupal7 by default. I will do this by moving this access to UI configuration.
Comment #5
get paid to upload CreditAttribution: get paid to upload commentedI like your way of writing and explaining the topics. Keep it up. I’m going to follow your blog.Thank you
very much….earn per download