Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions qa-include/db/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,21 @@ function qa_db_get_user_visible_postids($userid)
));
}

/**
* Checks if $userid has any visible posts
* @param $userid
* @return boolen
*/
function qa_db_has_user_visible_postids($userid)
{
return qa_db_read_one_value(qa_db_query_sub(
'SELECT 1
FROM ^posts
WHERE userid = $ AND type IN ('Q', 'A', 'C', 'Q_QUEUED', 'A_QUEUED', 'C_QUEUED')
LIMIT 1',
$userid
), true);
}

/**
* Return list of postids of visible or queued posts from $ip address
Expand Down
11 changes: 7 additions & 4 deletions qa-include/pages/user-profile.php
Original file line number Diff line number Diff line change
Expand Up @@ -699,10 +699,13 @@
);

if (!qa_user_permit_error('permit_hide_show')) {
$qa_content['form_profile']['buttons']['hideall'] = array(
'tags' => 'name="dohideall" onclick="qa_show_waiting_after(this, false);"',
'label' => qa_lang_html('users/hide_all_user_button'),
);
$has_vpost = qa_db_has_user_visible_postids($useraccount['userid']);
if( $has_vpost ){
$qa_content['form_profile']['buttons']['hideall'] = array(
'tags' => 'name="dohideall" onclick="qa_show_waiting_after(this, false);"',
'label' => qa_lang_html('users/hide_all_user_button'),
);
}
}

if ($loginlevel >= QA_USER_LEVEL_ADMIN) {
Expand Down