I am making a shadow banning module, where shadow banned users can see their own unpublished posts, inside the advanced forum. However, as soon as a node is unpublished, it's taxonomy term is removed, thus now showing up anymore in the topics list (which relies on the term). So I made a quick fix:

function taxonomy_build_node_index($node) {
// We maintain a denormalized table of term/node relationships, containing
  // only data for current, published nodes.
$status = NULL;
  if (
variable_get('taxonomy_maintain_index_table', TRUE)) {
// If a node property is not set in the node object when node_save() is
    // called, the old value from $node->original is used.
if (!empty($node->original)) {
$status = (int)(!empty($node->status) || (!isset($node->status) && !empty($node->original->status)));
$sticky = (int)(!empty($node->sticky) || (!isset($node->sticky) && !empty($node->original->sticky)));
    else {
$status = (int)(!empty($node->status));
$sticky = (int)(!empty($node->sticky));
// We only maintain the taxonomy index for published nodes.
if ($status !== NULL) { // this is the fix!

But I am wondering, why unpublised nodes are not indexed? If there is not a good reason for that, maybe commit this?

Best regards,



GBurg created an issue.