Topic-icon Share a Jomsocial Post

Active Subscriptions:

None
9 years 11 months ago - 9 years 11 months ago #58710 by Henning222
How i can make a share button on every post on my Jomsocial ?
Last edit: 9 years 11 months ago by Henning222.
The topic has been locked.
Support Specialist
9 years 11 months ago #58716 by alzander
Replied by alzander on topic Share a Jomsocial Post
You can't, that I know of. A share (or Like) button needs a unique URL to share to Facebook. Each post in JomSocial doesn't get it's own URL that we could create a Like/Share button for, so there's not a way to add it to each post.

I hope that helps make sense, but if you need more details, please let me know.

Thanks,
Alex
The topic has been locked.
Active Subscriptions:

None
9 years 11 months ago #58718 by Henning222
Replied by Henning222 on topic Share a Jomsocial Post
i think every post hast url:
here an example: Click
The topic has been locked.
Active Subscriptions:

None
9 years 11 months ago #58726 by Henning222
Replied by Henning222 on topic Share a Jomsocial Post
There has to be a way to do this... thats why I buy JFBC
The topic has been locked.
Support Specialist
9 years 11 months ago #58732 by mel
Replied by mel on topic Share a Jomsocial Post
I'm looking into it. Now that we know there's a link, you should be able to just put a JFBCLike easy-tag into the proper JomSocial page. I'm trying to narrow down the proper place right now. I will let you know when I have more details.

-Melissa
The topic has been locked.
Active Subscriptions:

None
9 years 11 months ago #58733 by Henning222
Replied by Henning222 on topic Share a Jomsocial Post
Thats good, i only need a share Button for facebook :)
The topic has been locked.
Support Specialist
9 years 11 months ago #58736 by mel
Replied by mel on topic Share a Jomsocial Post
I was looking for an elegant way to hook into the rendering of each stream post, but after looking at the JomSocial code, I don't believe this mechanism exists. If you add the following code to insert the Share easy-tag, I think it should accomplish what you want.

In /components/com_community/templates/jomsocial/layouts/stream/action.php around line 57, add the following few lines of PHP code after the anchor tag for the joms-button-liked link:
<?php /* SourceCoast - Add JFBCShare button */
$link = CRoute::getExternalURL('index.php?option=com_community&view=profile&userid='.$act->actor.'&actid='.$act->id);
echo '{JFBCShare href='.$link.'}';
?>

It should look like this once added:
<?php if ($allowLike) { ?>
        <?php $userLiked = $act->userLiked == COMMUNITY_LIKE; ?>
        <a href="javascript:"
            class="joms-button--liked<?php echo $userLiked ? ' liked' : '' ?>"
            data-lang-like="<?php echo JText::_('COM_COMMUNITY_LIKE'); ?>"
            data-lang-unlike="<?php echo JText::_('COM_COMMUNITY_UNLIKE'); ?>"
            onclick="joms.api.stream<?php echo $userLiked ? 'Unlike' : 'Like' ?>('<?php echo $act->id; ?>');">
            <svg viewBox="0 0 16 16" class="joms-icon">
                <use xlink:href="<?php echo CRoute::getURI(); ?>#joms-icon-thumbs-<?php echo $userLiked ? 'down' : 'up' ?>"></use>
            </svg>
            <span><?php echo JText::_($userLiked ? 'COM_COMMUNITY_UNLIKE' : 'COM_COMMUNITY_LIKE'); ?></span>
        </a>
        <?php /* SourceCoast - Add JFBCShare button */
        $link = CRoute::getExternalURL('index.php?option=com_community&view=profile&userid='.$act->actor.'&actid='.$act->id);
        echo '{JFBCShare href='.$link.'}';
        ?>
    <?php } ?>

You can then modify the options on that JFBCShare easy-tag to customize the look-and-feel. Check out the JFBConnect backend > Social > Examples section for details on the different options available. You can also switch it out to the JFBCLike button easy-tag if you'd prefer to have both the Facebook Like and Share button instead of just Share.

Let me know how this works for you. It's possible that the new block of code may need to be added to other layouts, so please test on your different pages. Once we get it finalized, I would suggest creating your own template for JomSocial so that you don't lose any changes on updating the extension.

-Melissa
The topic has been locked.
Active Subscriptions:

None
9 years 11 months ago #58738 by Henning222
Replied by Henning222 on topic Share a Jomsocial Post
attachment dont work. i reply soon
The topic has been locked.
Support Specialist
9 years 11 months ago #58740 by mel
Replied by mel on topic Share a Jomsocial Post
The changes needed are just pasting a couple of lines above into the PHP file at
In /components/com_community/templates/jomsocial/layouts/stream/action.php around line 57. Since there are numerous versions of JomSocial that have been released, it's not guaranteed to work if I just send you the file that I edited on my test site, if they're from different versions, etc.

Feel free to private message me FTP credentials for your server and I can make the edit for you if you'd prefer. Just click on the envelope icon under my avatar with the credentials.

-Melissa
The topic has been locked.
Active Subscriptions:

None
9 years 11 months ago #58742 by Henning222
Replied by Henning222 on topic Share a Jomsocial Post
Hey I get it now and I am very happy :)
Now I have to customize what will display on Facebook after sharing. Can you prefer me a documentation for that ?
The topic has been locked.