Firefox PHP

post URL links in facebook

Posted by tborosak 
Re: post URL links in facebook
November 06, 2012 09:27AM
hi there, thanks very much for posting these fixes..
they do seem to work, the facebook_url_fixer.php and the og: facebook meta tags..

however, i have noticed something..

when viewing the linked article on my Facebook page, sometimes facebook adds some tracking parameters to the link on my facebook page
eg [www.vetclick.com]

when these are added, the facebook_url_fixer.php does not work, and instead one goes back to the index page of the forum.

when facebook leaves these out, it works fine. it's random when FB attach this to the links on my Facebook page it seems.

is there a way around it?

PS i've attached a text file with the full link as it's sanitised in my post
Attachments:
open | download - full_fb_link.php (284 bytes)
Re: post URL links in facebook
November 07, 2012 02:49PM
What's happening is that the extra arguments Facebook is adding (in your attachment, the stuff in the URL starting at the &fb_action_ids=10151337719510579.....) is not being handled by Phorum's core. There is logic in the core that looks for an ampersand, and if it is found, then Phorum switches to use that to delimit query string arguments instead of commas. The Facebook constructed URL has your original Phorum IDs delimited by commas, but the ampersand has Phorum looking for its IDs using the wrong delimiter. Not finding any, Phorum will default to your list of forums.

It would technically be possible to modify Facebook URL Fixer to strip off the stuff after the ampersand, but the module runs on every single request your Phorum receives, not just the ones that come from Facebook. We wouldn't want it to blindly muck up a perfectly good URL just because there is a & symbol in it somewhere. It would also technically be possible to manipulate the query string data that Phorum reads from to include message IDs, but that is a real hacky way to fix a problem.

So, after that quickie analysis, I have to say I don't really have a satisfactory solution (just two unsatisfactory ones - well, three if I suggest just hacking the core in common.php around line 367). Maybe someone else has an idea I missed :)
Re: post URL links in facebook
November 12, 2012 02:57PM
Thanks Phil, I appreciate you taking the time to answer.. I'll have a think about how to approach this.
Re: post URL links in facebook
June 15, 2016 08:26AM
Maybe someone somewhere has come up with another solution, however I have solved this for myself using a .htaccess file in the phorum directory with the following rule...

RewriteEngine on

RewriteCond %{QUERY_STRING} ^(.*)\%2C(.*)$ [NC]
RewriteRule ^read.php$ read.php$1?%1,%2 [L]

Its case insensitive [NC] so covers both %2C and %2c
hope that helps...



Edited 2 time(s). Last edit at 06/15/2016 08:28AM by Phil.
Sorry, only registered users may post in this forum.

Click here to login