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

hi

i am trying to make a theme look like my wp site

in wp i use this code to show profile link to members and login lonk to others

<?php
if ( is_user_logged_in() ) {
    echo '
<div class="users-dashboard">
خوش آمدید , <a href="http://supportnotebook.ir/profile">پنل کاربری شما</a>
</div>    
';
} else {
    echo '
<div class="users-dashboard">
<a href="http://supportnotebook.ir/login">ورود - عضویت</a>
</div>    
';
}

how can i use  if ( is_user_logged_in() ) in q2a theme too ?

thanks

Q2A version: 1.7

1 Answer

+1 vote
by
selected by
 
Best answer

You need to require the app/users.php file (Q2A v1.7) and then use the qa_is_logged_in() function.

require_once QA_INCLUDE_DIR.'app/users.php';
if (qa_is_logged_in()) {
    echo 'Logged in!';
} else {
    echo 'Not logged in :(';
}

Welcome to the Q&A site for Question2Answer.

If you have a question about Q2A, please ask here, in English.

To report a bug, please create a new issue on Github or ask a question here with the bug tag.

If you just want to try Q2A, please use the demo site.

Categories

...