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

I want to write Automatic text immediately after each question
Does anyone know how to do it

1 Answer

+1 vote
by

You could check out the signatures plugin, since it does basically that, and a lot more:

https://github.com/NoahY/q2a-signatures

Here is the example from that plugin:

        function q_view_content($q_view)
        {
            $this->signatures = array();
            if (qa_opt('signatures_enable') && qa_opt('signatures_q_enable')) {
                $result = qa_db_read_all_assoc(
                    qa_db_query_sub(
                        'SELECT signature,userid,format FROM ^usersignatures'
                    )
                );
                
                foreach($result as $user) {
                    if ($user['signature']) {
                        
                        $informat=$user['format'];                    
                        
                        $viewer=qa_load_viewer($user['signature'], $informat);
                        
                        global $options;
                        
                        $signature=$viewer->get_html($user['signature'], $informat, array(
                            'blockwordspreg' => @$options['blockwordspreg'],
                            'showurllinks' => @$options['showurllinks'],
                            'linksnewwindow' => @$options['linksnewwindow'],
                        ));
                        $this->signatures['user'.$user['userid']] = $signature;
                    }
                }
                if(@$this->signatures['user'.$q_view['raw']['userid']]) {
                     if(!isset($q_view['content'])) $q_view['content'] = '';
                    $q_view['content'].=qa_opt('signatures_header').$this->signatures['user'.$q_view['raw']['userid']].qa_opt('signatures_footer');
                }
            }
            
            qa_html_theme_base::q_view_content($q_view);

        }

This is doing more than you need, it's populating an array of signatures to be used in the answers and comments as well, but it does add to $q_view['content'], which is what I assume you are looking for.

 

...