EasyDiscuss 4.0.19

Comments

Learn how to integrate your EasySocial's comment with your own third party extensions.
  Advanced

EasySocial comes with a comment system which can be used throughout EasySocial and your extensions as well. By enabling EasySocial comments on your extension, you will be able to link comments from the stream into the comment area of your items.

Rendering Library

To render the comments library, you may load it up using the following codes:

<?php
require_once( JPATH_ROOT . '/components/com_easysocial/includes/foundry.php' );

$lib    = Foundry::comments( $uid , $element , $verb , $group , $options );

Arguments:

$uid (int) - This determines the unique id for your item. If you are linking this to an article, it should be the article id.
$element (string) - This determines the type of item. It should be your extension name. If you are linking this to an article, it should be com_content
$verb (string) - This determines the verb of the item. It is typically the action that leads to the creation of the parent item.
$group (string) - Determines if the comments should be processed by a group or user app.
$options (Array) - An array of options.

Options:

$options[ 'url' ] - This is the permalink to your item.
$options[ 'hideEmpty' ] - This will hide the comment block if there are no comments.
$options[ 'hideForm' ] - Setting this to true will hide the comment form.


Obtaining Comment Count

The library also provides an easy way to get the count of comments made for a particular item. To retrieve the count, you may do so using the following codes:

require_once( JPATH_ROOT . '/components/com_easysocial/includes/foundry.php' );

$lib    = Foundry::comments( $uid , $element , $verb , $group , $options );
echo $lib->getCommentCount();

Deleting Comments

To remove comments from a particular item, you can do so with the codes below:

require_once( JPATH_ROOT . '/components/com_easysocial/includes/foundry.php' );

$lib    = Foundry::comments( $uid , $element , $verb , $group , $options );
$lib->delete();

Retrieving Participants

You will also be able to retrieve a list of participants in a comment section.

require_once( JPATH_ROOT . '/components/com_easysocial/includes/foundry.php' );

$lib    = Foundry::comments( $uid , $element , $verb , $group , $options );
$lib->getParticipants();