Integration of jLike with Jomsocial

Here are the steps to be followed to integrate jLike with Jomsocial:

1. Enable jLike Jomsocial plugin of type "Community"
2. Here is the code that you need to embed in various files of Jomsocial to Integrate jLlike's Like/Dislike with various items of Jomsocial

<li><?php
$dispatcher = JDispatcher::getInstance();
JPluginHelper::importPlugin('community');
$grt_response = $dispatcher->trigger('onBeforeDisplaylike',array());
?></li>

*Note : Please make sure you embed this code in PHP start (<?php) and end (?>) tags if needed.
To integrate jLike like/dislike for items of Jomsocial given below, follow respective steps :

Profile:

1) Override file Your_site/components/com_community/templates/jomsocial/layouts/profile/focus.php,
- Copy this file to path Your_site/templates/your_site_template/html/com_community/layouts/profile/focus.php

*Note: Create folders if not already exist.

-Open Your_site/templates/your_site_template/html/com_community/layouts/profile/focus.php
-Go to line number 367 to 378, find & comment out following code, put there above mentioned JLike code instead of following

<li class="full liked">
<a href="javascript:"
class="joms-js--like-profile-<?php echo $profile->id; ?><?php echo $isUserLiked > 0 ? ' liked' : ''; ?>"
onclick="joms.api.page<?php echo $isUserLiked > 0 ? 'Unlike' : 'Like' ?>('profile', '<?php echo $profile->id ?>');"
data-lang-like="<?php echo JText::_('COM_COMMUNITY_LIKE'); ?>"
data-lang-liked="<?php echo JText::_('COM_COMMUNITY_LIKED'); ?>">
<svg viewBox="0 0 16 20" class="joms-icon">
<use xlink:href="<?php echo CRoute::getURI(); ?>#joms-icon-thumbs-up"></use>
</svg>
<span class="joms-js--lang"><?php echo ($isUserLiked > 0) ? JText::_('COM_COMMUNITY_LIKED') : JText::_('COM_COMMUNITY_LIKE'); ?></span>
<span class="joms-text--light"> <?php echo $likes; ?></span>
</a>
</li>

 2) Override file Your_site/components/com_community/templates/jomsocial/layouts/profile.miniheader.php
- Copy this file to path Your_site/templates/your_site_template/html/com_community/layouts/profile.miniheader.php

*Note: Create folders if not already exist.

-Open Your_site/templates/your_site_template/html/com_community/layouts/profile/profile.miniheader.php
-Go to line number 219, find & comment out following code, put there above mentioned JLike code instead of following

<li class="half liked">
<a href="javascript:"
class="joms-js--like-profile-<?php echo $profile->id; ?><?php echo $isUserLiked > 0 ? ' liked' : ''; ?>"
onclick="joms.api.page<?php echo $isUserLiked > 0 ? 'Unlike' : 'Like' ?>('profile', '<?php echo $profile->id ?>');"
data-lang-like="<?php echo JText::_('COM_COMMUNITY_LIKE'); ?>"
data-lang-liked="<?php echo JText::_('COM_COMMUNITY_LIKED'); ?>">
<svg viewBox="0 0 16 20" class="joms-icon">
<use xlink:href="<?php echo CRoute::getURI(); ?>#joms-icon-thumbs-up"></use>
</svg>
<span class="joms-js--lang"><?php echo ($isUserLiked > 0) ? JText::_('COM_COMMUNITY_LIKED') : JText::_('COM_COMMUNITY_LIKE'); ?></span>
<span class="joms-text--light"> <?php echo $likes; ?></span>
</a>
</li>

Group:

1) Override file Your_site/components/com_community/templates/jomsocial/layouts/groups/single.php
- Copy this file to path Your_site/templates/your_site_template/html/com_community/layouts/groups/single.php

*Note: Create folders if not already exist.

-Open Your_site/templates/your_site_template/html/com_community/layouts/groups/single.php
-Go to line number 357, find & comment out following code, put there above mentioned JLike code instead of following

<li class="full liked">
<a href="javascript:"
class="joms-js--like-groups-<?php echo $group->id; ?><?php echo $isUserLiked > 0 ? ' liked' : ''; ?>"
onclick="joms.api.page<?php echo $isUserLiked > 0 ? 'Unlike' : 'Like' ?>('groups', '<?php echo $group->id; ?>');"
data-lang-like="<?php echo JText::_('COM_COMMUNITY_LIKE'); ?>"
data-lang-liked="<?php echo JText::_('COM_COMMUNITY_LIKED'); ?>">
<svg viewBox="0 0 14 20" class="joms-icon">
<use xlink:href="<?php echo CRoute::getURI(); ?>#joms-icon-thumbs-up"></use>
</svg>
<span class="joms-js--lang"><?php echo ($isUserLiked > 0) ? JText::_('COM_COMMUNITY_LIKED') : JText::_('COM_COMMUNITY_LIKE'); ?></span>
<span class="joms-text--light"> <?php echo $totalLikes ?></span>
</a>
</li>

 2) Override file your_site/components/com_community/templates/jomsocial/layouts/groups/miniheader.php
- Copy this file to path Your_site/templates/your_site_template/html/com_community/layouts/groups/miniheader.php

*Note: Create folders if not already exist.

- Open Your_site/templates/your_site_template/html/com_community/layouts/groups/miniheader.php
- Go to line number 265, find & comment out following code, put there above mentioned JLike code instead of following

<li class="half liked">
<a href="javascript:"
class="joms-js--like-groups-<?php echo $group->id; ?><?php echo $isUserLiked > 0 ? ' liked' : ''; ?>"
onclick="joms.api.page<?php echo $isUserLiked > 0 ? 'Unlike' : 'Like' ?>('groups', '<?php echo $group->id; ?>');"
data-lang-like="<?php echo JText::_('COM_COMMUNITY_LIKE'); ?>"
data-lang-liked="<?php echo JText::_('COM_COMMUNITY_LIKED'); ?>">
<svg viewBox="0 0 14 20" class="joms-icon">
<use xlink:href="<?php echo CRoute::getURI(); ?>#joms-icon-thumbs-up"></use>
</svg>
<span
class="joms-js--lang"><?php echo ($isUserLiked > 0) ? JText::_('COM_COMMUNITY_LIKED') : JText::_('COM_COMMUNITY_LIKE'); ?></span>
<span class="joms-text--light"> <?php echo $totalLikes ?></span>
</a>
</li>

Event:

1) Override file YOUR_SITE/components/com_community/templates/jomsocial/layouts/events/single.php

- Copy this file to path Your_site/templates/your_site_template/html/com_community/layouts/events/single.php

*Note: Create folders if not already exist.

Open Your_site/templates/your_site_template/html/com_community/layouts/events/single.php
Go to line number 266, find & comment out following code, put there above mentioned JLike code instead of following

<li class="full liked">
<a href="javascript:"
class="joms-js--like-events-<?php echo $event->id; ?><?php echo $isUserLiked > 0 ? ' liked' : ''; ?>"
onclick="joms.api.page<?php echo $isUserLiked > 0 ? 'Unlike' : 'Like' ?>('events', '<?php echo $event->id; ?>');"
data-lang-like="<?php echo JText::_('COM_COMMUNITY_LIKE'); ?>"
data-lang-liked="<?php echo JText::_('COM_COMMUNITY_LIKED'); ?>">
<svg viewBox="0 0 14 20" class="joms-icon">
<use xlink:href="<?php echo CRoute::getURI(); ?>#joms-icon-thumbs-up"></use>
</svg>
<span class="joms-js--lang"><?php echo ($isUserLiked > 0) ? JText::_('COM_COMMUNITY_LIKED') : JText::_('COM_COMMUNITY_LIKE'); ?></span>
<span class="joms-text--light"> <?php echo $totalLikes; ?></span>
</a>
</li>

 2) Override file YOUR_SITE/components/com_community/templates/jomsocial/layouts/events/miniheader.php

- Copy this file to path Your_site/templates/your_site_template/html/com_community/layouts/events/miniheader.php

*Note: Create folders if not already exist.

Open Your_site/templates/your_site_template/html/com_community/layouts/events/miniheader.php
Go to line number 157, find & comment out following code, put there above mentioned JLike code instead of following

<li class="full liked">
<a href="javascript:"
class="joms-js--like-events-<?php echo $event->id; ?><?php echo $isUserLiked > 0 ? ' liked' : ''; ?>"
onclick="joms.api.page<?php echo $isUserLiked > 0 ? 'Unlike' : 'Like' ?>('events', '<?php echo $event->id; ?>');"
data-lang-like="<?php echo JText::_('COM_COMMUNITY_LIKE'); ?>"
data-lang-liked="<?php echo JText::_('COM_COMMUNITY_LIKED'); ?>">
<svg viewBox="0 0 14 20" class="joms-icon">
<use xlink:href="<?php echo CRoute::getURI(); ?>#joms-icon-thumbs-up"></use>
</svg>
<span class="joms-js--lang"><?php echo ($isUserLiked > 0) ? JText::_('COM_COMMUNITY_LIKED') : JText::_('COM_COMMUNITY_LIKE'); ?></span>
<span class="joms-text--light"> <?php echo $totalLikes; ?></span>
</a>
</li>

Video:

1) Override file YOUR_SITE/components/com_community/templates/jomsocial/layouts/videos/single.php
- Copy this file to path Your_site/templates/your_site_template/html/com_community/layouts/videos/single.php

<?php
$dispatcher = JDispatcher::getInstance();
JPluginHelper::importPlugin('community');
$grt_response = $dispatcher->trigger('onBeforeDisplaylike',array());
?>

*Note: Create folders if not already exist.

Open Your_site/templates/your_site_template/html/com_community/layouts/videos/single.php
Go to line number 78, find & comment out following code, put there above mentioned JLike code instead of following

<button class="joms-button--small joms-button--<?php echo $likeLiked ? 'primary' : 'neutral' ?> joms-js--like-videos-<?php echo $video->id; ?>"
onclick="joms.api.page<?php echo $likeLiked ? 'Unlike' : 'Like' ?>('videos', '<?php echo $video->id ?>');"
data-lang="<?php echo JText::_('COM_COMMUNITY_LIKE'); ?>"
data-lang-like="<?php echo JText::_('COM_COMMUNITY_LIKE'); ?>"
data-lang-liked="<?php echo JText::_('COM_COMMUNITY_LIKED'); ?>"><?php
echo JText::_('COM_COMMUNITY_LIKE'); ?><?php echo $likeCountHTML; ?></button>


Album:

1) Override file YOUR_SITE/components/com_community/templates/jomsocial/layouts/photos/list.php

<?php
$dispatcher = JDispatcher::getInstance();
JPluginHelper::importPlugin('community');
$grt_response = $dispatcher->trigger('onBeforeDisplaylike',array());
?>

- Copy this file to path Your_site/templates/your_site_template/html/com_community/layouts/photos/list.php

*Note: Create folders if not already exist.

Open Your_site/templates/your_site_template/html/com_community/layouts/photos/list.php
Go to line number 114, find & comment out following code, put there above mentioned JLike code instead of following

<button class="joms-button--<?php echo $likeLiked ? 'primary' : 'neutral' ?> joms-button--small joms-js--like-album-<?php echo $album->id; ?>"
onclick="joms.api.page<?php echo $likeLiked ? 'Unlike' : 'Like' ?>('album', '<?php echo $album->id ?>');"
data-lang="<?php echo JText::_('COM_COMMUNITY_LIKE'); ?>"
data-lang-like="<?php echo JText::_('COM_COMMUNITY_LIKE'); ?>"
data-lang-liked="<?php echo JText::_('COM_COMMUNITY_LIKED'); ?>"><?php
echo JText::_('COM_COMMUNITY_LIKE'); ?><?php echo $likeCountHTML; ?></button>