Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+3 votes
976 views
in Q2A Core by
reopened by
After clicking the button, he must immediately want to get redirected to the question list page intead of directing him to the actual question page...

Any one please help me with this

1 Answer

+3 votes
by
selected by
 
Best answer

You'll have to create a simple plugin for that:

1. Create a directory qa-plugin/your-plugin. All the following files go inside this directory

2. Create the file metadata.json with the following content:

{  "name": "Your plugin" }

3. Create the file qa-plugin.php with the following content:

<?php
if (!defined('QA_VERSION')) {
   header('Location: ../../');
   exit;
}
qa_register_plugin_module('event', 'qa-your-plugin-event.php', 'YourPluginEvent', 'Your Plugin Event');

3. Create the file qa-your-plugin-event.php with the following content

<?php
class YourPluginEvent {
    public function process_event($event, $userid, $handle, $cookieid, $params)  {
        if ($event === 'q_post') {
            qa_redirect('');
        }
    }
}

4. Navigate to admin/plugins and enable the "Your plugin" (remember to click the Save button below the list) event and try asking a question

by
Thank you @pupi1985, your ideas are really clever.  I like this one:
"...letting the user define the plugin execution order..."
by
Hello pupi,
     with your solution,now after submitting the question,the page gets directed to the homepage.how to navigate it to the ask page itself instead of directing it to the homepage?
by
Try:

qa_redirect('ask');
by
it actually worked pupi
...