XF 2.0 How to test for thread_prefix.0

LPH

Well-known member
This is how I'm pulling thread prefixes externally from XenForo to show in a widget.

Code:
if ( $prefixTitle != '' ) {
   echo "<div class='threadListItem'><span class='{$prefixesCSS}'>{$prefixTitle}</span> ";
}

This is the line I'm concerned about:

Code:
if ( $prefixTitle != '' )

This allows thread_prefix.0 to show up instead of an actual title.

I could change it to

Code:
if ( $prefixTitle != '' || $prefixTitle != 'thread_prefix.0' )

However, is there a better way?

Sometimes I see something like this

Code:
if ( !$prefixTitle ) {
    // 
}

Thank you for the advice.
 
I decided to go with $prefix_id !=0 and moved the echo div start tag into its own line.
 
Back
Top Bottom