Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
1.9k views
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:

index.php/post/"postid"

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

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

1 Answer

+2 votes
by
 
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.

by
As I said, that doesn't work. With the exactily same code you gave me, it produces the following URL:
question2answer/index.php/89/index.php/admin/lists

The most strange is that even if I put the full addresss in the code, like:
qa_redirect('http://localhost/question2answer/index.php/report/2');

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
by
maybe it's a problem with .htaccess?
by
Maybe. But I didn't change the .htaccess, so it's exactly the same that comes with Q2A.
by
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.
...