Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
634 views
in Q2A Core by
1st how can I restrict my whole website accept the first page(home page) to unregistered users?

 

2nd Iam trying to implement chatroom into g2a where would I put php code? I do realize that costume pages only take html code. When I do ridirect to index.php it opens new page outside q2a theme.

1 Answer

+1 vote
by
For the chat room, you'll need to create a page plugin. Check the docs on the main site, they are pretty thorough.
by
I looked at them and honestly I dont understand it. Where do I modifie the code? I added costume page via admin console. Where do I find it?
by
You can duplicate one of the current page plugins (in qa-plugins folder) and work from there.

However I do actually have a chat room plugin I made for my site. So I could clean up that and release it for Q2A if you like.
by
ok so I got to this point I cleaned up one of the plugins heres the code..
<?php

/*
    Question2Answer 1.4 (c) 2011, Gideon Greenspan

    http://www.question2answer.org/

   
    File: qa-plugin/chat/qa-chat-page.php
    Version: 1.4
    Date: 2011-06-13 06:42:43 GMT
    Description: Page module class for example page plugin


    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License
    as published by the Free Software Foundation; either version 2
    of the License, or (at your option) any later version.
   
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    More about this license: http://www.question2answer.org/license.php
*/

    class qa_chat_page {
       
        var $directory;
        var $urltoroot;
       
        function load_module($directory, $urltoroot)
        {
            $this->directory=$directory;
            $this->urltoroot=$urltoroot;
        }
       
        function suggest_requests() // for display in admin interface
        {   
            return array(
                array(
                    'title' => 'Live Chat',
                    'request' => 'chat-plugin-page',
                    'nav' => 'M', // 'M'=main, 'F'=footer, 'B'=before main, 'O'=opposite main, null=none
                ),
            );
        }
       
        function match_request($request)
        {
            if ($request=='chat-plugin-page')
                return true;

            return false;
        }
       
        function process_request($request)
        {
            $qa_content=qa_content_prepare();

            $qa_content['title']='Live Chat';
            $qa_content['custom']='Some <B>custom html</B>';

           
           
            return $qa_content;
        }
   
    };
       

   

/*
    Omit PHP closing tag to help avoid accidental output
*/

This shows the empty page with title Live Chat
...