Page 1 of 1

Phoca FB comment ID problem?

Posted: 12 Apr 2011, 12:50
by bokiromanista
Hello everyone and thx for grate module, Im install 1.0.1 version on My joomla 1.5 version and Im thrilled when I saw is option REPLAY to comment is included and every comment on fb add to my page but I have one problem when someone replay to my post and I got notification on FB when I click on notification link go to my web page but there no any comments beacouse link have some additional strings for example

http://romabalkan.com/home/glasine/936- ... bb3588dc98

but there no comments should I change some settings on module or my FB app?

Re: Phoca FB comment ID problem?

Posted: 14 Apr 2011, 21:57
by drux
i have exactily the same problem.

i can fix it put a php code in the index.php (template) and if "fb_comment_id" exist redirect to the same page but without the "fb_comment_id"

if exist another way plz say it!

I dont speak english ajjaja

Re: Phoca FB comment ID problem?

Posted: 14 Apr 2011, 22:48
by drux
put this code in the top of the index.php in the template dir.
***before the first <?php

it´s a very bad solution but works until i get a good response

Code: Select all

<?php
if ($_GET['fb_comment_id'] != '') {
	if(!function_exists("remove_var_from_url")){
		function remove_var_from_url($variable_name,$url_string){
			if(strpos($url_string,"?")){
				$start_pos = strpos($url_string,"?");
				$url_vars_strings = substr($url_string,$start_pos+1);
				$names_and_values = explode("&",$url_vars_strings);
				$url_string = substr($url_string,0,$start_pos);
				foreach($names_and_values as $value){
					list($var_name,$var_value)=explode("=",$value);
					if($var_name != $variable_name){
						if(strpos($url_string,"?")===false){
							$url_string.= "?";
						} else {
							$url_string.= "&";
						}
						$url_string.= $var_name."=".$var_value;
					}
				}
			} 
			return $url_string;
		}
	}

	$no_fbid= remove_var_from_url("fb_comment_id",$_SERVER['PHP_SELF']);

	Header("Location: $no_fbid"); 
}
?>

again, i dont speak english sorry if you don't understand

Re: Phoca FB comment ID problem?

Posted: 15 Apr 2011, 02:25
by drux
i forgot.

you link is blabla.html?fb_comment_id=fbc_10150153355343720_15860864_10150153375863720&ref=notif&notif_t=open_graph_comment#f53bb3588dc98

you must add all variables in bold (after "&" and before "=") for the link in the comments

in your case

Reemplace

Code: Select all

    if ($_GET['fb_comment_id'] != '') {
for

Code: Select all

    if (($_GET['fb_comment_id'] != '') OR ($_GET['ref'] != '') OR ($_GET['notif_t'] != '')) {


and

Code: Select all

$no_fbid= remove_var_from_url("fb_comment_id",$_SERVER['PHP_SELF']);
for

Code: Select all

$no_fbid= remove_var_from_url("fb_comment_id",$_SERVER['PHP_SELF']);
$no_fbid= remove_var_from_url("ref",$no_fbid);
$no_fbid= remove_var_from_url("notif_t",$no_fbid);
it shoud be:

Code: Select all

    <?php
   if (($_GET['fb_comment_id'] != '') OR ($_GET['ref'] != '') OR ($_GET['notif_t'] != '')) {
       if(!function_exists("remove_var_from_url")){
          function remove_var_from_url($variable_name,$url_string){
             if(strpos($url_string,"?")){
                $start_pos = strpos($url_string,"?");
                $url_vars_strings = substr($url_string,$start_pos+1);
                $names_and_values = explode("&",$url_vars_strings);
                $url_string = substr($url_string,0,$start_pos);
                foreach($names_and_values as $value){
                   list($var_name,$var_value)=explode("=",$value);
                   if($var_name != $variable_name){
                      if(strpos($url_string,"?")===false){
                         $url_string.= "?";
                      } else {
                         $url_string.= "&";
                      }
                      $url_string.= $var_name."=".$var_value;
                   }
                }
             }
             return $url_string;
          }
       }

       $no_fbid= remove_var_from_url("fb_comment_id",$_SERVER['PHP_SELF']);
       $no_fbid= remove_var_from_url("ref",$no_fbid);
       $no_fbid= remove_var_from_url("notif_t",$no_fbid);

       Header("Location: $no_fbid");
    }
    ?>
good luck :D

PD3: sorry for the english

Re: Phoca FB comment ID problem?

Posted: 24 Apr 2011, 20:02
by bokiromanista
is there some easiest way to resolve this problem, I have one more question, when some peoples write comment and publish them, in the text of comment some words automaticaly replace with noun "the"

Re: Phoca FB comment ID problem?

Posted: 04 May 2011, 10:24
by chmod
Hello,

I think the fix would be in the phoca facebook module inside default.php. Just modify the code to ignore everything after your real URL.

Regards,
Salvador