Forum links does not keep into account i18n language.

Comments

subcomandante’s picture

To better explain this I coded:

function _phpbbforum_set_globals() {
...
  $_phpbb_embed_mode = array();

  global $language;
  //drupal_set_message($language->prefix);
  //$site_forum_url = $base_url .'/'. $site_phpbb_page;
  $langprepend = '';
  if ($language->prefix){
        $langprepend = $language->prefix.'/';
  }
  $site_forum_url = $base_url .'/'.$langprepend. $site_phpbb_page;

This will work at least if you have language prepend prefix, still need to check what happen when you have other language switch types e.g. domain.

Every forum links will keep the language settings so drupal doesn't switch language to default when you follow one of them.

subcomandante’s picture

uhm, just found this will break deletion and who knows what else.. it seems someting is still wrong in path detection.

EDIT:
btw, this is how it works:
Italian version: http://www.yafaray.org/it/community/forum/index.php
English version: http://www.yafaray.org/community/forum/index.php

It would be perfect with #663942: i18n compatibilty

subcomandante’s picture

The issue with quickmod is when you use actions need confirmation the forum action link is not correct, in the same confirmation page you will find correct form:

<form action="/it/community/forum/mcp.php?f=16&amp;t=2915&amp;start=0&amp;quickmod=1&amp;redirect=http%3A%2F%2Fwww.yafaray.org%2FphpBB3%2Fviewtopic.php%3Ff%3D16%26t%3D2915%26start%3D0&amp;sid=xxx"  accept-charset="UTF-8" method="post" id="search-block-form">

and wrong confirmation form:

<form id="confirm" action="http://www.yafaray.org/it/community/forum/index.php?q=it/community/forum/mcp.php&amp;f=16&amp;t=2915&amp;start=0&amp;quickmod=1&amp;redirect=http://www.yafaray.org/it/community/forum/viewtopic.php?f=16&t=2915&start=0&amp;confirm_key=xxxx" method="post">

notice the difference between
action="/it/community/forum/mcp.php?f=blablabla
and
action="http://www.yafaray.org/it/community/forum/index.php?q=it/community/forum...

subcomandante’s picture

uhm, this seems to work:

diff -Nru /root/phpbbforum/phpbbforum.hooks.inc phpbbforum/phpbbforum.hooks.inc
--- /root/phpbbforum/phpbbforum.hooks.inc       2009-08-31 23:08:03.000000000 +0200
+++ phpbbforum/phpbbforum.hooks.inc     2009-12-27 17:26:36.000000000 +0100
@@ -24,10 +24,15 @@
  */
 function _phpbbforum_replace_urls($output, $decode = false) {
   global $phpbb_config, $site_forum_url, $site_phpbb_page, $phpbb_root_path;
+  global $language;

   $phpbb_url = $phpbb_config['forum_url'];
   //http://vgb.net.ru/phpbbforum/mcp.php?i=reports&mode=reports
-  $q_phpbbforum = 'q='. $site_phpbb_page;
+  if ($language->prefix){
+       $q_phpbbforum = 'q='. $language->prefix . '/' . $site_phpbb_page;
+  }else{
+       $q_phpbbforum = 'q='. $site_phpbb_page;
+  }
   $str = array('../', '/index.php?'. $q_phpbbforum);
   //$str = array('../', 'www/index.php?'. $q_phpbbforum, '/index.php?'. $q_phpbbforum, 'www/index.php');
   $output = str_replace($str, '', $output);
diff -Nru /root/phpbbforum/phpbbforum.module phpbbforum/phpbbforum.module
--- /root/phpbbforum/phpbbforum.module  2009-12-16 17:32:46.000000000 +0100
+++ phpbbforum/phpbbforum.module        2009-12-27 17:26:55.000000000 +0100
@@ -67,9 +67,13 @@
   $_phpbb_acp_integration_mode = variable_get("phpbbforum_page_frame_acp", 0);

   $_phpbb_embed_mode = array();
-
-  $site_forum_url = $base_url .'/'. $site_phpbb_page;
-
+
+  global $language;
+  $langprepend = '';
+  if ($language->prefix){
+       $langprepend = $language->prefix.'/';
+  }
+  $site_forum_url = $base_url .'/'.$langprepend. $site_phpbb_page;
   if (PHPBB_DRUPAL_MODULE_VERSION == 5) {
     $_inc = dirname(__FILE__) .'/phpbbforum.theme.custom.inc';
     if (file_exists($_inc)) {

finally it adds ability to browse the forum without loosing drupal language selection (I tested quickmodtools and it works too) at the moment I'm testing this on yafaray website.

vb’s picture

i have seen this patch
_phpbbforum_replace_urls

We have found the same solution.
Near about what I have done in beta9 but a bit differently.

But in beta9 besides that i have patched
_phpbbforum_set_globals()

in pages.inc
_phpbbforum_comment_render()
_phpbbforum_posting_destination()

without this embedded comments do not work

Please, look at beta9

subcomandante’s picture

Status: Active » Fixed

great, it works.
I'm running beta9 now.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.