Topic-icon Like Button

Active Subscriptions:

None
9 years 10 months ago - 9 years 10 months ago #58837 by Henning222
Like Button was created by Henning222
Hi,
I think that is my last complicated thing that i need:
I need a like Button at every Jomsocial Profile Page. If the owner of the profile set a facebook page in his contact details then the like Button is about his page... If the owner of the profile dont set a facebook site in his contact details, it would be nice if there is the like Button of my site ( www.facebook.com/Wasserfreunde-Bielefeld...47849/?ref=bookmarks)
It would be nice if the like Button is under the Share Button : os-vp.de/index.php/jomsocial/profile

Can we do this `?
Last edit: 9 years 10 months ago by Henning222.
The topic has been locked.
Support Specialist
9 years 10 months ago #58844 by alzander
Replied by alzander on topic Like Button
You'd need to know how to get the Facebook Page out of the user's contact details. If you have the PHP code for that, or can get the JomSocial developers to help you describe how to get the contact field for each user when viewing their page, we can definitely help you make a Like or Share button for that page.

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

None
9 years 10 months ago #58880 by Henning222
Replied by Henning222 on topic Like Button

Henning222 wrote: For the profiles( I made a field that calles Facebook.
Can I have a php script to get the URL from the field? I need this for a plugin in JFBC (the message from alzander

suport wrote: Hi Henning,

Do you want to change the FB URL with FB like? you need hack the jomsocial template (profile.about.php) to achive this, and remember the like button only available for Facebook fan page, the regular user doesnt have like feature.

thank you!

Henning222 wrote: I dont want change the facebook url. i want read out the url because if it set to fanpage then JFBC will make a like Button in there profile- if the user dont set a fanpage url then happen nothing

suport wrote: Hi,

Do you know to get FB like code? if you wanna get FB URL from jomsocial itself you can use CUSer Object, here is the doc documentation.jomsocial.com/wiki/JomSocial_User_Object

thank you!



Does it help us ?
The topic has been locked.
Active Subscriptions:

None
9 years 10 months ago #58881 by Henning222
Replied by Henning222 on topic Like Button
I think this part of doc will help us :
Retrieve Value From Custom Profile Field

If you need to retrieve any value from custom profile fields, you can use:

$cuser->getInfo('FIELD_CODE');

Example

$cuser = CFactory::getUser();
$data = $cuser->getInfo('FIELD_GENDER');
echo $data;

Note: This API will retrieve any custom profile field information regardless of its privacy setting. If you echo the value, it will completely ignore the privacy set by user.


I am right ?
The topic has been locked.
Support Specialist
9 years 10 months ago #58893 by alzander
Replied by alzander on topic Like Button
Great! All you need to do with that is create a Like button tag, like the following and add it to the JomSocial profile page wherever you want:
<?php
$cuser = CFactory::getUser(); 
$data = $cuser->getInfo('FIELD_XXXX'); 
echo "{SCFacebookLike href=" . $data . "}"; ?>
That's PHP code, which will work fine within the JomSocial template file. You just need to insert it within the HTML wherever you want the Like button to display.

I hope that helps,
Alex
The topic has been locked.
Active Subscriptions:

None
9 years 10 months ago #58896 by Henning222
Replied by Henning222 on topic Like Button
Its feeling that its like the link and not the fanpage. I put it to the code, but the activity is that the user like a link not the fanpage that is after the url...
The topic has been locked.
Support Specialist
9 years 10 months ago #58907 by alzander
Replied by alzander on topic Like Button
The code above gets the field from the user's profile, as JomSocial specified. The {SCFacebookLike ...} tag creates a Like button with a link to the page specified in that profile field.

Have you tested that code yet? Did it work or did it actually link to the current page, not the Facebook Page? Any details you can share on your results will help.

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

None
9 years 10 months ago #58915 by Henning222
Replied by Henning222 on topic Like Button
I have a new mistake- I think because i have a new Jomsocial ( i deinstall and install after it ), If i click on the like Button -> the like Button goes away and then there is a fail:

File Attachment:


And i only need a like Button not a share Button...
Sum up :
I put your code in :
quickstart/templates/jf_business/html/com_community/layouts/profile/focus.php
Now in the profile there is a like and share Button
If you click on it, it doesnt like the page but it make a fail where the like Button was.
Before i change my Jomsocial there was no fail but it likes not the fanpage it likes the URL:

File Attachment:


I send you my ftp and backend details (private message)- Maybe you have time to have a look in my code...
The topic has been locked.
Support Specialist
9 years 10 months ago #58918 by alzander
Replied by alzander on topic Like Button
If you click the "Fehlen" text, it should pop up an error message letting you know the problem. Please investigate whatever the error message displays. If you are unable to, please let us know the error and we'll help however we can.

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

None
9 years 10 months ago - 9 years 10 months ago #58919 by Henning222
Replied by Henning222 on topic Like Button
I dont have the fehler message on all profiles : some profiles have this error: Objekt hat ungültigen Wert: Das Objekt unter der URL „http://os-vp.de/index.php/jomsocial/485-demo2/profile“ der Art „article“ ist ungültig, weil der angegebene Wert „/components/com_community/assets/user-Male.png“ für die Eigenschaft „og:image:url“ der Art „url“ nicht geparst werden konnte.

english wrote: Object has invalid values: The object under the URL os-vp.de/index.php/jomsocial/485-demo2/profile fromt art article is invalid. the taken value /components/com_community/assets/user-Male.png for the settings „og:image:url“ from art url not avilable to parse


And the other works good but unfortunely if i click on the like Button it looks good on my site but on facebook there is no activity .
Please help me
Last edit: 9 years 10 months ago by Henning222.
The topic has been locked.