Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
1.8k views
in Q2A Core by
I would like to make a login widget or add this code to sidebar to show login inf NOT LOGGED IN user

 

        function nav_user_search() // outputs login form if user not logged in
        {
            if (!qa_is_logged_in()) {
                $login=@$this->content['navigation']['user']['login'];
                
                if (isset($login) && !QA_FINAL_EXTERNAL_USERS) {
                    $this->output(
                        '<!--[Begin: login form]-->',                
                        '<form id="qa-loginform" action="'.$login['url'].'" method="post">',
                            '<input type="text" id="qa-userid" name="emailhandle" placeholder="'.trim(qa_lang_html(qa_opt('allow_login_email_only') ? 'users/email_label' : 'users/email_handle_label'), ':').'" />',
                            '<input type="password" id="qa-password" name="password" placeholder="'.trim(qa_lang_html('users/password_label'), ':').'" />',
                            '<div id="qa-rememberbox"><input type="checkbox" name="remember" id="qa-rememberme" value="1"/>',
                            '<label for="qa-rememberme" id="qa-remember">'.qa_lang_html('users/remember').'</label></div>',
                            '<input type="hidden" name="code" value="'.qa_html(qa_get_form_security_code('login')).'"/>',
                            '<input type="submit" value="'.$login['label'].'" id="qa-login" name="dologin" />',
                        '</form>',                
                        '<!--[End: login form]-->'
                    );
                    
                    unset($this->content['navigation']['user']['login']); // removes regular navigation link to log in page
                }
            }
            
            qa_html_theme_base::nav_user_search();
        }

1 Answer

0 votes
by

I'm not exactly sure what your question is, but the code you posted is from a theme (or layer plugin). So you can put that function in your theme's qa-theme.php file.

Alternatively, take a look at the plugin documentation and look at making a widget module or a layer plugin

by
Yes I know... My question is how can I make a sidepanel login form from that code???? I am not good at making stuff can anyone help on this?
Thanks
by
You can put the code inside that function into another function like sidepanel().
Or in the sidepanel function, call the nav_user_search() function, although that will add the other stuff too.
...