Firefox PHP

post URL links in facebook

Posted by tborosak 
post URL links in facebook
July 08, 2010 03:11PM
Hi...
whenever i take a link from the post and put it on Facebook to share....once i click on it (while on facebook) it gets me to the forum page with all the topics listed - list.php (not particular post)...

forum links look like this:
[www.mydomain.com]

post links look like this:

[www.mydomaint.com]

is there a fix to my problem?

thank you.....
Re: post URL links in facebook
July 08, 2010 03:26PM
It looks like Facebook mangles the Phorum url. The link for your post here on Phorum is:
http://www.phorum.org/phorum5/read.php?61,145041,145041#msg-145041
which Facebook then turns into:
http://www.facebook.com/l.php?u=http%3A%2F%2Fwww.phorum.org%2Fphorum5%2Fread.php%3F61%252C145041%252C145041%23msg-145041&h=4f00dFWZuTbDx84c17e--5tVjZg
After Facebook redirects the browser it has stripped out everything after the first comma, that is:
http://www.phorum.org/phorum5/read.php?61

Unfortunately, I don't know that there is a solution for this other than to report it to Facebook. You could try using the SEF URLs module as a workaround. No guarantees though.


Joe Curia (aka Azumandias)
Modules: l0Admin Mass Email00000000l000000Automatic Time Zones000ll.l00000Enhanced Custom Profiles0.00Google Calendar0000l.l000000Post Previews
000000000Admin Security Suite000000000000Check Modules for Upgrades0000External Authentication000000Group Auto-Email00000.00000Private Message Alerts
000000000Attachment Download Counter0000Custom Attachment Icons000ll.ll00Favorite Forums000000.00000Highlighted Search Terms0000Self-Delete Posts Option
000000000Attachment Watermarks0l00000000Custom Language Database00l.l.0Forum Lockdown00000.00000Ignore Forums0000000000000Threaded Tree View
000000000Automatic Message Pruning00.llll.00Easy Color Scheme Manager0l.l00Forum Subscriptions0000lll000Moderated User Group
Templates:lGeneric Integration000000000 0000Simple Rounded000000 00000000Tabbed Emerald
Re: post URL links in facebook
July 08, 2010 05:35PM
%2C remains in the URL after the decoding that Facebook does. Looks like an issue for facebook to solve.

As a work around, you might give it a try to modify common.php like this:
Language: PHP
// explode it on comma $Q_STR = str_replace(';%2C';, ';,';, $Q_STR); $PHORUM["args"] = $Q_STR == ';'; ? array() : explode( ",", $Q_STR );
(so add the second line). Untested, but it might work. I'm not 100% sure that this won't bite back at some other point (e.g. when doing redirects via redirect.php). If it does, then you could try to only modify the $Q_STR when the HTTP_REFERER contains the string "facebook" or so. All in all, quite hacky and no way near a solid solution. That seems up to facebook.

Another work around could be to use a URL shortening service to pack your URLs. That might work too.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: post URL links in facebook
July 08, 2010 05:46PM
thank you guys
Re: post URL links in facebook
November 16, 2010 11:23AM
Yeah I've been using a url shortner but besides being tedious for users, it doesn't help with the 'like' button.

I'll give this a go!
Re: post URL links in facebook
November 16, 2010 11:28AM
ok so I added that and it does solve links on facebook, so that they are directed to the correct thread.


The other issue is with 'Like'.

It now likes the correct thread, however the 'title' of the page is incorrect. Facebook uses the section the thread was in as the title rather than the title of the thread.

If you have a facebook account, you can test this by visiting a thread here

[www.iloveqatar.net]

and then clicking on the like button on the bottom of the page on the toolbar.
Re: post URL links in facebook
November 18, 2010 08:45AM
I have submitted a bug to Facebook about this. [bugs.developers.facebook.net]

Brian - Cowboy Ninja Coder - Personal Blog - Twitter
Re: post URL links in facebook
November 22, 2010 12:15PM
I tried the common.php hack works, it works. I noticed there is a parse_request hook that makes it possible to do this without a hack ;-) so here is a simple module to work around facebook's bug [www.phorum.org] until they fix it on their end.

-phil.
Re: post URL links in facebook
November 22, 2010 12:40PM
Facebook looks for information about your pages using the open graph protocol, and here is their implementation of it: [developers.facebook.com]

Try placing their meta tags on your pages and see if that works. You should test on a fresh thread, one that facebook hasn't seen yet, they seem to cache their results for a time. You can use this tool at Facebook [developers.facebook.com] to verify your tags are working.

-phil.

Added a little later: ... and I can also say that facebook doesn't parse their own meta tags consistently it seems. I have some pages that work, and some that don't, but can't tell why.

And added more a little later: I just did some tests to check that the URL facebook's parser is actually reaching the correct page. Looking at my logs, they are (with the %2C instead of commas, of course), and I can see my code to fix the commas is working. So even when facebook is parsing the wrong title (i.e., the forum title instead of the thread title), they are reading the correct URL. They seem to have an issue in their parsing... I am starting to hate facebook...

And one more addition: Arrrrgggggghhhhhhh! Sorry Facebook, you seem to be working right after all. I was testing with several forums and most worked. But one has read permissions (which I forgot). And of course facebook's parser can't read those threads, so Phorum sends back the generic content.



Edited 3 time(s). Last edit at 11/22/2010 03:19PM by Phil Connolly.
Re: post URL links in facebook
November 25, 2010 05:13PM
anyone did any looking into the 'title' issue that I mentioned above? Or have any ideas how to solve this.
Re: post URL links in facebook
November 25, 2010 05:32PM
Did you try adding the OG meta tags to your pages?

They look something like this:
Language: HTML
<meta property="og:title" content="Title of my page" /> <meta property="og:type" content="article" /> <meta property="og:url" content="URL of my page" /> <meta property="og:image" content="Image you want facebook to display" />

In Phorum templates you could just make it automatic for any page, put this in your header.tpl:
Language: HTML
<meta property="og:title" content="{HTML_TITLE}" /> <meta property="og:type" content="article" /> <meta property="og:url" content="<?php print phorum_get_current_url(); ?>" /> <meta property="og:image" content="Image you want facebook to display" />


This works for me.

-phil.



Edited 1 time(s). Last edit at 11/25/2010 05:47PM by Phil Connolly.
Re: post URL links in facebook
January 14, 2011 08:05AM
Quote
Brian Moon
I have submitted a bug to Facebook about this. [bugs.developers.facebook.net]
Well it seems this problem has been forgotten there. At least one can add their vote to it.

Perhaps in the future phorum could provide an alternate URL syntax containing no commas, they all being replaced with &xxx=...&yyy=... etc. That way there will be a workaround already ready the next time it happens with some other website.
Re: post URL links in facebook
January 14, 2011 08:32AM
The administrators that use our software will love it when all of a sudden all their URLs are modified into something different.

Surely, some rewrite rules on Apache servers or possibly a module could handle the redirection to the new location, but as long as it's only Facebook not respecting the standards, we rather stick to the (valid) URL format to ensure that no migration issues can occur.

Thanks for voting for the bug at Facebook's bugtracker.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: post URL links in facebook
January 14, 2011 08:43AM
No, I merely suggested always providing alternative ways to reach the
same page in an emergency, just as
[en.wikipedia.org]
[en.wikipedia.org]
[en.wikipedia.org]
all reach the same page.
Re: post URL links in facebook
January 14, 2011 08:59AM
Some SEO people are really nervous about having multiple URLs for the same content (not that I think that it really matters for engines like Google.)

Providing alternative URLs wouldn't really work well either, would they? As long as Phorum uses the comma-driven URLs, users would cut and paste that URL to Facebook, not being aware that they should replace all commas with ampersands.

For Phorum, there's already a perfect emergency band aid available: the Facebook URL Fixer module, which works wonders, without having to change anything drastically basic.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: post URL links in facebook
January 14, 2011 09:15AM
Quote
Maurice Makaay
there's already a perfect emergency band aid available
for administrators to install. Us regular users must use [turl.ca] etc. shortener services.
Re: post URL links in facebook
January 14, 2011 10:21AM
Or ask the admin to install the mod.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: post URL links in facebook
July 26, 2011 01:53AM
What do people use for the "og:description" tag? I'm wanting to display the content of each post- if that is possible. I've tried using
Language: HTML
<meta property="og:description" content="{DESCRIPTION}" />
But that hasn't worked...don't know why?

Also, what code would you use in order to display a user's uploaded photo in "og:image" tag?

Essentially I'm wanting to display a mini version of a user's post when someone click's 'like'. Does anyone know if this is even possible?
Re: post URL links in facebook
July 26, 2011 12:51PM
What exactly isn't working? The og:description property is parsed by facebook, so if you have it populated, it should work. The og:image question is kinda outside of the scope of this thread, so maybe it would be better to start another one where you ask how to get a reference to a user's uploaded images into Phorum variables that you can use in your header templates.
Re: post URL links in facebook
July 26, 2011 08:35PM
Thanks Phil for your reply.

At the moment I am using the following code (in full) in the header template:

Language: HTML
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="{LOCALE}" lang="{LOCALE}" xmlns:og="http://ogp.me/ns#" xmlns:fb="https://www.facebook.com/2008/fbml"> <head> <title>{HTML_TITLE}</title> <meta property="og:title" content="{HTML_TITLE}" /> <meta property="og:type" content="article" /> <meta property="og:url" content="<?php print phorum_get_current_url(); ?>" /> <meta property="og:image" content="http://perfectpetfinder.com.au/images/PPF_Logo1_Colour_190x38.jpg" /> <meta property="og:site_name" content="Perfect Pet Finder: Lost and Found Pets" /> <meta property="og:description" content="{DESCRIPTION}" />

Using this code, all that appears on Facebook, after I have clicked 'like', is the title of the forum (rather than the subject of the individual post), the base URL (i.e. perfectpetfinder.com.au) and my logo. The message body from the post, where the 'like' button is located, does not appear in the Facebook post.

I really would like each 'like' button to take the content from a particular post and have that appear on Facebook, rather than just a generic information about my site as a whole.

I suppose what I'm really asking is if anyone knows what {tags} to use (e.g. {HTML TITLE}) in order to have the subject of each post appear in title, and the message body appear in the description meta for each post.

I hope this makes sense :-)

Thanks for your help!

Aaron
Re: post URL links in facebook
July 26, 2011 09:13PM
Hi Aaron,

If you have confirmed that the generated HTML returned by Phorum contains what you are expecting, i.e., you can see it, then the problem is on the Facebook side. They are not reading the same page as the one with your like button. There is discussion about this at the beginning of this thread where people report Facebook is mangling Phorum URLs, which based on your description of the problem seems to be what is happening to you. Have you tried the Facebook URL Fixer module?

-phil.
Re: post URL links in facebook
July 26, 2011 11:11PM
Hi Phil,

As you may have already guessed, but I'm a noob so I'm not too sure that I'm using the right HTML code. I'm just using my best educated guess and experimentation to try and achieve what I want. For example, instead of using the {DESCRIPTION} tag I was previously trying to use the {MESSAGES->body} tag from the read.tpl in order to display the message content on Facebook (with no success). I figured that trying to use a tag that is referenced in another template just doesn't work.

In relation to Facebook mangling Phorum URLs, I have previously installed the Facebook URL Fixer module. Is that all I need to worry about, or is there still an issue?

Your help is much appreciated.

Cheers

Aaron
Re: post URL links in facebook
July 28, 2011 03:08PM
I've had success using the OG properties, as well as having Facebook just read the content in my pages (which it does in the absence of relevant OG properties). But in all cases within Phorum, for me it requires the Facebook URL Fixer module, and public permissions for the message read page. That second requirement has got me a few times... a page that is behind any security will not work with Facebook's robots because obviously they have no way to log in. So at the moment, that is all I have for help. If you post a link to your phorum page having your like button I can look. You can also analyze your URL using This tool which has a Facebook tab in the results which will tell you any specific problems Facebook might have. And Facebook has there own tool here: URL Linter

-phil.
Re: post URL links in facebook
July 29, 2011 02:06AM
Thanks again for your reply Phil. It would be great if you can take a look. My website is http://perfectpetfinder.com.au/lostandfound/. The Phorum is not properly integrated into the rest of my site, so if you navigate away from the Phorum installation you will manually have to enter the URL again.

I decided to remove the code I quoted above from the header.tpl and instead installed your group of Facebook modules. They are really good - thanks for sharing!

However, I still have the same issue that the body of the message (or at least some of it) doesn't make it over to the Facebook wall. For example, you would expect this post to have at least included some of the "Just Lorem ipsum dolor sit amet..." when it appears on Facebook, but it doesn't. If I make a comment, that appears, but none of the text from the Phorum post.

Any advice would be greatly appreciated.

Cheers

Aaron
Re: post URL links in facebook
July 30, 2011 12:50AM
Well, your test post just confirms that Facebook is not reaching the post properly via its URL. Their URL Linter reports a title "Cats lost in South Australia" instead of "This is just a test", meaning Facebook is parsing your forum list page (http://perfectpetfinder.com.au/lostandfound/list.php?5) because, no surprise if you followed this whole thread, Facebook can't handle Phorum's commas in the URL. Your OG properties are fine. Phorum is fine. Facebook for some reason after all this time still can't properly encode and decode a comma.

The question is, how come Facebook URL Fixer module is not doing its job? If you have that installed, and activated, your site should be working, so I am not sure what more to advise.

-phil.
Re: post URL links in facebook
August 06, 2011 03:58AM
Thanks Phil for your efforts. I'll try reinstalling the Facebook URL fixer, otherwise I'll have to make do ;)

Cheers
Aaron
Re: post URL links in facebook
December 22, 2011 03:50PM
Thank you, I've bumped the Facebook bug report, maybe one of these months someone will fix it

___
Skye Nott
Corvus Digital
Re: post URL links in facebook
May 17, 2012 02:24AM
I have experienced something different.
Up to a couple of weeks ago links worked fine on FB. Then for some unknown reason stopped working and although the URL fix module is active still it shows the link page. :-(((

I can understand someone who has issues to make it work but honestly can't possibly understand why in my case it stopped working.
Re: post URL links in facebook
May 17, 2012 04:01AM
You can use the Facebook URL debugger to see how it's being translated (incorrectly)

--> [developers.facebook.com]

___
Skye Nott
Corvus Digital
Re: post URL links in facebook
May 17, 2012 04:09AM
I have solved the issue by applying one of the suggestions Phil gave on this thread:

Language: HTML
<meta property="og:title" content="Title of my page" /> <meta property="og:type" content="article" /> <meta property="og:url" content="URL of my page" />
Sorry, only registered users may post in this forum.

Click here to login