Topic-icon Like Button

Support Specialist
7 years 9 months ago #58923 by alzander
Replied by alzander on topic Like Button
This is a known issue with JomSocial and how it sets some Open Graph tags incorrectly. We've reported it to them and I think they have fixed this is a newer release. Not sure if you're on the latest.

Either way, you can read about the problem and how to fix it in this thread .

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

None
7 years 9 months ago #58928 by Henning222
Replied by Henning222 on topic Like Button
I did the edits that mel explain in other post.
But the error is still there on profiles that dont have a URL in contact details...
At the profiles that have URL in contact details- its looks good on my website but there is no activity on Facebook. All in all I would say it completly doesnt work...
The topic has been locked.
Support Specialist
7 years 9 months ago #58944 by alzander
Replied by alzander on topic Like Button

But the error is still there on profiles that dont have a URL in contact details...

Ahh.. You didn't mention before that it's the users without the URL set. Update the code like:
$cuser = CFactory::getUser(); 
$data = $cuser->getInfo('FIELD_XXXX'); 
if ($data != "")
  echo "{SCFacebookLike href=" . $data . "}"; 
else
  echo "{SCFacebookLike href=https://facebook.com/sourcecoast}";
?>
That first 'if' statement will check if the field is blank. If not, it will use the profile field. If it is blank, whatever URL you put will be used. You can leave the else and 2nd echo off if you only want the Like button to display if the user has set the URL field.

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

None
7 years 9 months ago #59025 by Henning222
Replied by Henning222 on topic Like Button
If the field does not blank sourcecoast like Button will display too unfortunelly ;(

File Attachment:
The topic has been locked.
Active Subscriptions:

None
7 years 9 months ago #59027 by Henning222
Replied by Henning222 on topic Like Button
Oh it ´was my mistake... It works perfectly too. Sourcecoast has the best support that i worked with ! Every euro I invest in your product was a good euro !
The topic has been locked.
Active Subscriptions:

None
7 years 9 months ago - 7 years 9 months ago #59032 by Henning222
Replied by Henning222 on topic Like Button
There i was to early to say it works perfectly...
Its only work if the user is logged in. I dont know why :/
If the user is not logged in so its a guest, he gets the sourcecast like Button
Last edit: 7 years 9 months ago by Henning222.
The topic has been locked.
Support Specialist
7 years 9 months ago - 7 years 9 months ago #59034 by mel
Replied by mel on topic Like Button
I just noticed that you're calling:
CFactory::getUser();

This returns the currently logged in user. I believe that you should be able to pass in the ID of the user whose profile you're looking at, such as the following:
CFactory::getUser($id);

However, you'll have to figure out how to get the ID of the user you're viewing.
Last edit: 7 years 9 months ago by mel.
The topic has been locked.
Active Subscriptions:

None
7 years 9 months ago #59076 by Henning222
Replied by Henning222 on topic Like Button

mel wrote: I just noticed that you're calling:

CFactory::getUser();

This returns the currently logged in user. I believe that you should be able to pass in the ID of the user whose profile you're looking at, such as the following:
CFactory::getUser($id);

However, you'll have to figure out how to get the ID of the user you're viewing.

nothing change... Should I ask Jomsocial support ?
The topic has been locked.
Support Specialist
7 years 9 months ago #59082 by alzander
Replied by alzander on topic Like Button
They are the ones that supplied the original code above for getting the user information. Yes, I'd recommend asking them how to get the user ID of the profile being viewed, not the ID of the viewer.

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

None
7 years 9 months ago - 7 years 9 months ago #59084 by Henning222
Replied by Henning222 on topic Like Button
i checked the documentation and saw that:

$cuser = CFactory::getRequestUser();
and it works :) thank you for the well support!
Last edit: 7 years 9 months ago by Henning222.
The topic has been locked.