Example #1
0
/**
 * Add a comment menu item in post
 *
 * @return void
 */
function ossn_wall_comment_menu($callback, $type, $params)
{
    $guid = $params['post']->guid;
    ossn_unregister_menu('comment', 'postextra');
    ossn_unregister_menu('commentall', 'postextra');
    if (!empty($guid)) {
        $comment = new OssnComments();
        ossn_register_menu_item('postextra', array('name' => 'comment', 'class' => "comment-post", 'href' => "javascript::void(0)", 'data-guid' => $guid, 'text' => ossn_print('comment:comment')));
        if ($comment->countComments($guid) > 5) {
            ossn_register_menu_item('postextra', array('name' => 'commentall', 'href' => ossn_site_url("post/view/{$guid}"), 'text' => ossn_print('comment:view:all')));
        }
    }
}
        echo ossn_view('system/templates/link', $link);
    } else {
        $user_liked = true;
        $link['onclick'] = "Ossn.EntityUnlike({$object});";
        $link['href'] = 'javascript::;';
        $link['text'] = ossn_print('ossn:unlike');
        echo ossn_view('system/templates/link', $link);
    }
    ?>
        </div>
        <span class="dot-comments">.</span> <a href="#comment-box-<?php 
    echo $object;
    ?>
">Comment</a>
        <?php 
    if ($OssnComments->countComments($object, 'entity') > 5) {
        ?>
            <span class="dot-comments">.</span> <a href="#">View all comments</a>
        <?php 
    }
    ?>
    </div>
<?php 
}
/* Likes and comments don't show for nonlogged in users */
?>

<?php 
if ($OssnLikes->CountLikes($object, 'entity')) {
    ?>
    <div class="like_share">
    } else {
        $user_liked = true;
        $link['onclick'] = "Ossn.PostUnlike({$object});";
        $link['href'] = 'javascript::;';
        $link['text'] = ossn_print('ossn:unlike');
        echo ossn_view('system/templates/link', $link);
    }
    ?>
        </div>
        <span class="dot-comments">.</span>
        <a href="#comment-box-<?php 
    echo $object;
    ?>
">Comment</a>
        <?php 
    if ($OssnComments->countComments($object) > 5) {
        ?>
            <span class="dot-comments">.</span> <a href="<?php 
        echo ossn_site_url("post/view/{$object}");
        ?>
">View all
                comments</a>
        <?php 
    }
    ?>
    </div>

<?php 
}
/* Likes and comments don't show for nonlogged in users */
?>