Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+4 votes
835 views
in Q2A Core by

In page plugins we have the match_request function which returns true when the request matches a particular string. However, that means when you add a link in the admin section, you have to use what the plugin author decides.

The option "URL of link (absolute or relative to QA root)" is essentially useless because if you put something different you get a "page not found" error.

If you just return true from match_request this overrides all other pages so example.com/blahblahblah will return that page.

Is there a solution to this problem, without having to edit the plugins manually?

2 Answers

+2 votes
by
selected by
 
Best answer

For Q2A 1.4 or later, try using $QA_CONST_PATH_MAP in qa-config.php. That lets you map any internal Q2A request to a different URL request shown externally. For example if the page plugin registered plugin-page and you wanted to change that to extra-page, you would use this in qa-config.php:

$QA_CONST_PATH_MAP=array(
  'plugin-page' => 'extra-page',
);

0 votes
by
Looks like a bug... I can't see anything in the ^pages table that would allow for this kind of check... here's the array retrieved if the badges url is changed to "awards":

[05-Sep-2011 03:57:57] array(8) {
  ["title"]=>
  string(6) "Badges"
  ["tags"]=>
  string(9) "awards"
  ["position"]=>
  string(1) "1"
  ["pageid"]=>
  string(1) "2"
  ["flags"]=>
  string(1) "1"
  ["nav"]=>
  string(1) "M"
  ["heading"]=>
  NULL
  ["content"]=>
  NULL
}

When "awards" is passed to the badges plugin, it returns false, and there's no way for it to check that "awards" means "badges"

The only real solution seems to be adding the information to the core; unless I'm just missing something...
by
I think it would be possible using the translation files. You can add a new line for the request, then check if $request matches that in the match_request function.
...