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

I want to add a new button near: hide, edit, etc... i questions, comments and answers. The problem is that I've already been looking in the file qa-theme-base.php and haven't found anything. I've seen the function q_view_main which calls q_view_buttons. From there on, I'm lost.

I've read the buttons HTML and thei're real HTML inputs, but I would like to make just a simple link with the same style. Is that possible?

EDIT: I already know hot to show the button. But I would like to know how to redirect each button to a specific page. Ex:


And replace "postid" by the ID of the post.

I'd like to know how to add a new button.

1 Answer

+2 votes
Best answer

In your qa-plugin.php file, you can check the appropriate POST variable (from your button name), and then perform a redirect if appropriate. The functions in qa-base.php will help you. For compatibility make sure you use a button name which will be unique to your plugin.

As I said, that doesn't work. With the exactily same code you gave me, it produces the following URL:

The most strange is that even if I put the full addresss in the code, like:

It add's it to the end of the current address. :S
If it matters, I'm using the latest version of Q2A and FF6.0
It's the first time something like this happens to me. Usually, the full address works. :S
maybe it's a problem with .htaccess?
Maybe. But I didn't change the .htaccess, so it's exactly the same that comes with Q2A.
That's weird. How about:

qa_redirect('admin/lists', null, qa_opt('site_url'));

That will create an HTTP Location: redirection header with an absolute instead of relative URL, which perhaps Firefox 6 prefers.