please help me to disable the like from comment

hi

i want to prevent user likes the our and other comments members

by stop show like icon in comment box

 

  • Override likes_permissions_check_annotate function in your own plugin:

    elgg_unregister_plugin_hook_handler('permissions_check:annotate', 'all', 'likes_permissions_check_annotate', 0);
    
    elgg_register_plugin_hook_handler('permissions_check:annotate', 'all', 'my_likes_permissions_check_annotate', 0);
    
    function my_likes_permissions_check_annotate($hook, $type, $return, $params) {
        if (elgg_extract('annotation_name', $params) !== 'likes') {
            return;
        }
    
        $user = elgg_extract('user', $params);
        $entity = elgg_extract('entity', $params);
    
        if (!$user || !$entity instanceof ElggEntity) {
            return false;
        }
    
        $type = $entity->type;
        $subtype = $entity->getSubtype();
        
        if ($subtype == 'comment') {
            return false;
        }
    
        return (bool)elgg_trigger_plugin_hook('likes:is_likable', "$type:$subtype", [], false);
    }
  • thanks RvR

    it is work very good yesterday i used the same technical but i read

     if ($subtype == 4) {
            return false;
        }
    
    

    I want to ask the Override is mandatory in all elgg functions or I can edit the basic function and why?