phpBBSEO / usu

Ultimate SEO URL
32 stars 25 forks source link

Seo URL Thanks for posts error #83

Open CristiOprea opened 9 years ago

CristiOprea commented 9 years ago

I have installed ext thanks for posts and Seo URL MOD on phpbb 3.1.x . When giving the thanksgiving redirects me back to the message and I do not appear as I pleased

Leinad4Mind commented 8 years ago

Show me the URL of the thanks posts

wcz-txp commented 8 years ago

The problem with thanks for post is still existing A post link looks like that: /post110010.html?thanks=110010&to_id=1212&from_id=534

That's my rewrite rule in Lighttpd which worked in phpbb 3.0 "^/post([0-9]+)\.html(\?(.*))?" => "/viewtopic.php?p=$1&$3",

The repository of this extension is here: Thanks for posts

cYbercOsmOnauT commented 8 years ago

I don't use Lighttpd but can you maybe use "^/post([0-9]+)\.html(?:\?(.*))?" => "/viewtopic.php?p=$1&$2",

I dislike to create RegEx groups that are not used. ;)

wcz-txp commented 8 years ago

@cYbercOsmOnauT Thank you for your answer. JFYI

? (question) - match zero or one of the previous symbol

Anyway, the problem doesn't lie in the rewrite rule. There is something with parameter handling in the usu-class

cYbercOsmOnauT commented 8 years ago

(?:something) <- machtes a group of characters without creating a groupnumber ;) I just wanted to optimize your RegEx

wcz-txp commented 8 years ago

A for me working variant with phpbb 3.1.8 and Thanks for Posts from 16.01.2016 and usu from 9.08.2015: In /ext/phpbbseo/usu/event/listener.php look for

if ($post_id && !$view && !$this->core->set_do_redir_post())

replace with

// Thanks for Posts extension
                    $to_id = request_var('to_id', 0);
                    $thanks = request_var('thanks', 0);
                    $rthanks = request_var('rthanks', 0);
//                  if ($post_id && !$view && !$this->core->set_do_redir_post())
                        if (($rthanks || $thanks || $post_id)  && !$view && $this->core->set_do_redir_post())
// Thanks for Posts extension

Then look for 'hilit' => array('val' => (($highlight_match) ? $highlight : ''), 'keep' => !empty($highlight_match)),

And add after

// Thanks for Posts extension
                            'rthanks' => array('val' => $rthanks, 'keep' => $rthanks),
                            'to_id' => array('val' => $to_id, 'keep' => $to_id),
                            'thanks' => array('val' => $thanks, 'keep' => $thanks),
// Thanks for Posts extension

then look for $this->core->zero_dupe();

and replace with

// Thanks for Posts extension
//                  $this->core->zero_dupe();
                    if (!$to_id && !$thanks && !$rthanks) {
                        $this->core->zero_dupe();
                        }
// Thanks for Posts extension

Clean your cache and then it should work. Maybe a more talented one prepares a commit for the repository.