Topic-icon Like / Share Button on everything in Jomsocial

Active Subscriptions:

None
12 years 4 weeks ago #25938 by uriel
Hi Alex,

Now that I am up and running and importing Facebook Data on my site, it brings me to the next question :
I want to add a Like / Share button below everything users post in Jomsocial - How do I do that ?
I recall you saying something in a pre-sales post about a Specific URL but cant find that post...
Please will you be so kind to refresh my memory ?
The topic has been locked.
Active Subscriptions:

None
12 years 3 weeks ago #25990 by uriel
any news on this ?
The topic has been locked.
Support Specialist
12 years 3 weeks ago #26000 by alzander
Uriel,
Sorry for the delay on getting back to this. It took a little digging, but I found a post from back in June that explains pretty well how to do what you're looking for. We never received any feedback from that user, but hopefully, that's a good thing. Check it out (you may want to read the entire thread) and let us know if that's what you're looking for:
Adding a Facebook Like button to the JomSocial Activity Stream

Good luck!
Alex
The topic has been locked.
Active Subscriptions:

None
12 years 3 weeks ago #26016 by uriel
Hi Alex,
I followed theses Steps :
Don,
Completely new question for us, so thanks for your patience. We've determined how to add the Like and Comment box. I'm going to give directions for the Like only right now, though the commenting is similar. The code below will add a unique Like button to each activity stream update posted. When "Liked", the link that would appear in a users FB wall will link to the original user's profile that posted the stream update in JomSocial. Unfortunately, there's no way to link directly to the activity stream update, so hopefully the link to the user's profile is good enough for now. If you have suggestions on where you'd prefer the link in FB to go, let me know.

Hopefully, the steps below are pretty clear, but if not, let us know.
* Copy /components/com_community/templates/default/activities.index.php to /templates/<YOUR_TEMPLATE>/html/com_community/activities.index.php (creating any directories as necessary)
** This creates a 'template override' so that any changes you make to that file won't be overridden if you update JomSocial
* Edit the file you just created in the /templates/ folder
* Search for the following code (at line 201 in my file):
Code:

<!-- <?php if($act->userLiked!=COMMUNITY_LIKE) { ?>

&#x2022; <a id="like_id<?php echo $act->id?>" href="#like" onclick="jax.call('community','system,ajaxStreamAddLike', '<?php echo $act->id; ?>');return false;"><?php echo JText::_('COM_COMMUNITY_LIKE');?></a>

<?php } else { ?>

&#x2022; <a id="like_id<?php echo $act->id?>" href="#unlike" onclick="jax.call('community','system,ajaxStreamUnlike', '<?php echo $act->id; ?>');return false;"><?php echo JText::_('COM_COMMUNITY_UNLIKE');?></a>

<?php } ?>-->

Update that to as below, adding the {JFBCLogin..} tag on the second line, the <!-- on the next and the --> at the end :
Code:

<!-- <?php if($act->userLiked!=COMMUNITY_LIKE) { ?>

{JFBCLike href=<?php echo CRoute::_('index.php?option=com_community&view=profile&userid='.$act->actor.'&act='.$act->id); ?>}

<!--

&#x2022; <a id="like_id<?php echo $act->id?>" href="#like" onclick="jax.call('community','system,ajaxStreamAddLike', '<?php echo $act->id; ?>');return false;"><?php echo JText::_('COM_COMMUNITY_LIKE');?></a>

<?php } else { ?>

&#x2022; <a id="like_id<?php echo $act->id?>" href="#unlike" onclick="jax.call('community','system,ajaxStreamUnlike', '<?php echo $act->id; ?>');return false;"><?php echo JText::_('COM_COMMUNITY_UNLIKE');?></a>

<?php } ?>-->

-->

I'm going to skip the code for the comments now to focus on one thing at a time. Also, with Comments, there's not an easy way I can think of to 'drop-down' the comment box like it's done in JomSocial. Therefore, the comment box for FB will be there for every post, and that may be a little overwhelming.

So, start with the Likes and see if that works for you and we can go from there.

Thanks,
Alex

That didn't work at all.
I have noticed this is under the Joomla 1.5 Support - maybe that is the Problem ?
Perhaps there is a plugin or module I need to install ?
The topic has been locked.
Support Specialist
12 years 3 weeks ago #26026 by alzander
There's no difference in JomSocial's templating system from Joomla 1.5 to 2.5, so that shouldn't be the problem.

Not sure why it's in there, but at the very beginning of the block, there's a < !-- Remove that and see if it helps. We did test that code, so it should work. If that still doesn't work for you though, can you post (or PM) a link to your activity stream?

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

None
12 years 3 weeks ago #26029 by uriel
Hi Alex,
Thank you for your reply - it now looks like : www.blahbadoo.com/index.php/your-community
Is there not a plugin / module I am supposed to install and publish somewhere ?
The topic has been locked.
Active Subscriptions:

None
12 years 3 weeks ago #26030 by uriel
aha! but when I log in it shows the FB Like button but with a bit of weird code like : --> • Comment
and only on some posts ... strange indeed and where the Like Button is shown it doesn't work to send to FB
The topic has been locked.
Support Specialist
12 years 3 weeks ago #26033 by alzander
There is no plugin or module to automatically add the Likes to each Activity Stream item. It's only been asked for one other time, so not a common request. It also changes the layout of the stream a bit, and that could cause issues for some users.

I'm going to re-post the code here below for what it should look like. The <! -- and --> tags (which are HTML comments) seem messed up in that other post for some reason:
<?php if($act->userLiked!=COMMUNITY_LIKE) { ?> 
                    {JFBCLike href=<?php echo CRoute::_('index.php?option=com_community&view=profile&userid='.$act->actor.'&act='.$act->id); ?>} 
<!--              <a id="like_id<?php echo $act->id?>" href="#like" onclick="jax.call('community','system,ajaxStreamAddLike', '<?php echo $act->id; ?>');return false;"><?php echo JText::_('COM_COMMUNITY_LIKE');?></a> -->
                    <?php } else { ?> 
<!--                        <a id="like_id<?php echo $act->id?>" href="#unlike" onclick="jax.call('community','system,ajaxStreamUnlike', '<?php echo $act->id; ?>');return false;"><?php echo JText::_('COM_COMMUNITY_UNLIKE');?></a>         -->               
                    <?php } ?>
Try making sure those comments are in the right place as above and see if that helps. We basically want to add our {JFBCLike} tag in the first section, and then comment out the both of the 'a' tags from JomSocial.

Keep us posted on how that goes,
Alex
The topic has been locked.
Active Subscriptions:

None
12 years 3 weeks ago #26072 by uriel
Hi Alex,
That worked for the weird looking code but the Buttons still only display on some posts and if you click Send the box that comes up only displays a portion of it.
Then the Like button also only shows that it is Liked after Refreshing the page...
Please will you log in with Facebook and have a look ? : www.blahbadoo.com/index.php/your-community
The topic has been locked.
Support Specialist
12 years 3 weeks ago #26097 by alzander
Uriel,
Thanks for all the feedback on this. I've looked a bit more into it and have some more answers for you. We're almost there, I think.

First, let's sort of start over. The initial block in JomSocial looks like:
<?php if($allowLike) { ?>
					<?php if($act->userLiked!=COMMUNITY_LIKE) { ?>
						&#x2022; <a id="like_id<?php echo $act->id?>" href="#like" onclick="jax.call('community','system,ajaxStreamAddLike', '<?php echo $act->id; ?>');return false;"><?php echo JText::_('COM_COMMUNITY_LIKE');?></a>
					<?php } else { ?>
						&#x2022; <a id="like_id<?php echo $act->id?>" href="#unlike" onclick="jax.call('community','system,ajaxStreamUnlike', '<?php echo $act->id; ?>');return false;"><?php echo JText::_('COM_COMMUNITY_UNLIKE');?></a>						
					<?php } ?>
				<?php } ?>
The first line there is something I missed when I initially looked into this. The "if ($allowLike)" statement is making it so the Like button will only show if the user is logged in. I'm assuming you want it to show all the time, so I would say to move the {JFBCLike ..} above that line and outside of the block I've been mentioning the whole time. So, it should look like this:
{JFBCLike href=<?php echo CRoute::_('index.php?option=com_community&view=profile&userid='.$act->actor.'&act='.$act->id); ?>} 
				<?php if($allowLike) { ?>
I'd remove that tag from the section I told you to put it in. You're free to revert all the changes in that block and then, in JomSocial, you can enable/disable their internal Like system on the activity stream if you'd like that to also show for logged in users.

To fix the overflow issues, you'll need to edit the following file: /components/com_community/templates/jf_corporate_2.6/css/style.stream.css. In the following block:
#community-wrap #cProfileWrapper .cFeed-item, #community-wrap #cFrontpageWrapper .cFeed-item, .cFeed-item
Remove the overflow:hidden property.

Last, but not least, if you want to use the Send button, you should use it's own {JFBCSend} tag and use the href of CRoute::_('index.php?option=com_community&view=profile&userid='.$act->actor
For the Like's, we're adding an actid query parameter. That's not needed for the Send button, and probably causing other issues.

Hope that all helps!
Alex
The topic has been locked.