Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
467 views
in Plugins by
Is there a plugin, or some code that shows ads only for inactive users (users that never voted or posted) & non-registered visitors?
Q2A version: 1.6.2

1 Answer

+1 vote
by

In snow theme there is a function which gives You most of the info you need for that task:

if (qa_is_logged_in()) {
//no ads
}else{
//ads
}
 

and

if (qa_is_logged_in()) { 
$userpoints=qa_get_logged_in_points();
}

 

 

See the original function here:

 

 

function logged_in() 
{
if (qa_is_logged_in()) // output user avatar to login bar
$this->output(
'<div class="qa-logged-in-avatar">',
QA_FINAL_EXTERNAL_USERS
? qa_get_external_avatar_html(qa_get_logged_in_userid(), 24, true)
: qa_get_user_avatar_html(qa_get_logged_in_flags(), qa_get_logged_in_email(), qa_get_logged_in_handle(),
qa_get_logged_in_user_field('avatarblobid'), qa_get_logged_in_user_field('avatarwidth'), qa_get_logged_in_user_field('avatarheight'),
24, true),
            '</div>'
            );
 
qa_html_theme_base::logged_in();
 
if (qa_is_logged_in()) { // adds points count after logged in username
$userpoints=qa_get_logged_in_points();
 
$pointshtml=($userpoints==1)
? qa_lang_html_sub('main/1_point', '1', '1')
: qa_lang_html_sub('main/x_points', qa_html(number_format($userpoints)));
 
$this->output(
'<span class="qa-logged-in-points">',
'('.$pointshtml.')',
'</span>'
);
}
}
...