Found a second cause of this.. If you like a topic.. Then a spammer comes along and posts in that topic.. That spammer is flagged as a spammer, AND the "Flag as spammer" options are set to unapprove their posts.. It knocks everyone's like_visible to 0 on the topic.
Basically, it seems that once you get into the modLibrary, into toggleApproveMemberContent, if you have both set..
if ( $topicFind )
{
$this->DB->build( array( 'select' => $this->DB->buildDistinct( 'forum_id' ) . ',tid',
'from' => 'topics',
'where' => $topicFind ) );
$this->DB->execute();
while( $row = $this->DB->fetch() )
{
$forumIDs[ $row['forum_id'] ] = $row['forum_id'];
$topicIDs[ $row['tid'] ] = $row['tid'];
}
}
if ( $postFind )
{
$this->DB->build( array( 'select' => $this->DB->buildDistinct( 't.forum_id' ) . ',t.tid',
'from' => array( 'posts' => 'p' ),
'where' => $postFind,
'add_join' => array( array( 'select' => '',
'from' => array( 'topics' => 't' ),
'where' => 'p.topic_id=t.tid' ) ) ) );
$this->DB->execute();
while( $row = $this->DB->fetch() )
{
$forumIDs[ $row['forum_id'] ] = $row['forum_id'];
$topicIDs[ $row['tid'] ] = $row['tid'];
}
}
//-----------------------------------------
// Run...
//-----------------------------------------
if ( $topicFind AND count($topicIDs) )
{
$this->DB->update( 'topics', array( 'approved' => ( $approve === TRUE ) ? 1 : 0 ), $topicFind );
/* Tagging */
$this->registry->tags->updateVisibilityByMetaId( $topicFind, ( $approve === TRUE ? 1 : 0 ) );
/* Likes */
require_once( IPS_ROOT_PATH . 'sources/classes/like/composite.php' );/*noLibHook*/
$_like = classes_like::bootstrap( 'forums', 'topics' );
$_like->toggleVisibility( $topicIDs, $approve );
}
while( $row = $this->DB->fetch() )
{
$forumIDs[ $row['forum_id'] ] = $row['forum_id'];
$topicIDs[ $row['tid'] ] = $row['tid'];
}