function dwqa_question_print_status($question_id, $echo = true) { $status_meta = get_post_meta($question_id, '_dwqa_status', true); if ('open' == $status_meta || 're-open' == $status_meta || !$status_meta) { if (dwqa_is_answered($question_id)) { $status = 'answered'; } elseif (dwqa_is_new($question_id)) { $status = 'new'; } elseif (dwqa_is_overdue($question_id)) { $status = 'open'; if (current_user_can('edit_posts')) { $status .= ' status-overdue'; } } else { $status = 'open'; } } elseif ('resolved' == $status_meta) { $status = 'resolved'; } elseif ('pending' == $status_meta) { $status = 'open'; } else { $status = 'closed'; } if ($echo) { echo '<span data-toggle="tooltip" data-placement="left" title="' . strtoupper($status) . '" class="dwqa-status status-' . $status . '">' . strtoupper($status) . '</span>'; } return '<span data-toggle="tooltip" data-placement="left" class="entry-status title="' . strtoupper($status) . '" status-' . $status . '">' . strtoupper($status) . '</span>'; }
/** * Control all status */ function dwqa_question_print_status($question_id, $echo = true) { $status = get_post_meta($question_id, '_dwqa_status', true); if ($status == 'open' || $status == 're-open') { if (dwqa_is_answered($question_id, $status)) { $status = 'answered'; update_post_meta($question_id, '_dwqa_status', 'answered'); } elseif (dwqa_is_new($question_id, $status)) { $status .= ' status-new'; } elseif (dwqa_current_user_can('edit_question') && dwqa_is_overdue($question_id)) { // Add overdue alert for admin $status .= ' status-overdue'; } } if ($echo) { echo '<span data-toggle="tooltip" data-placement="left" title="' . strtoupper($status) . '" class="dwqa-status status-' . $status . '">' . strtoupper($status) . '</span>'; } return '<span data-toggle="tooltip" data-placement="left" class="entry-status title="' . strtoupper($status) . '" status-' . $status . '">' . strtoupper($status) . '</span>'; }