Pragmatism in code

If you run a social site chances are that you probably use both JomSocial and Kunena. If you do you have probably noticed that the Kunena events shown in the activity stream allow users to add comments directly to the activity stream event. This can be a little confusing to users - As kunena is a third party integration the comment will not be added to the forum thread and there is every chance that it will simply go unnoticed.

To fix this problem we can simply disable the ability to add a comment to the Kunena event in the activity stream. Here's how...


Find and edit /components/com_community/templates/yourtemplatename/activities.actions.php

Find the following code...

// Allow comment for system post
if($appName == 'system'){
$allowComment = !empty($my->id);

Add the following code after the code above...

//[DeeEmm] No comment Kunena
if($act->app == '' ){
$allowComment = false;
//[DeeEmm] No comment Kunena

You can actually add it anywhere in the file but it makes sense to me to keep it with other code of a similar function. I also like to enclose my mods in comments that I can easily search for, this makes it easy to maintain core hacks such as this when updating. You can change or omit the comments as you require.

That's it. Now when you view Kunena events in the activity stream the option to comment on them should be gone.