Resoled: How can I show part of my PHP search results just to logged in members?

liv4spd

Member
Enclosed is a PHP file that I linked to my webpage inside XenForo. It queries a SQL database and rendered the results in a table. My question is how could I make the last three rows of the rendered table show up only to logged in members?

I found these on the internet, but do not seem to work:
<xen:if is="{$visitor.user_id}">
This content will show to logged in members
</xen:if>"


Your help is greatly appreciated!
 

Attachments

You could check to see if there is a xf_user cookie set.

PHP:
<?php

$bbuserid = $_COOKIE["xf_user"];
$pos = strpos($bbuserid, ',');
$bbuserid = substr($bbuserid,0,$pos);

if ($bbuserid != '') {
    echo '<tr>';
    echo '<td style="width:63px; text-align:right; font-weight:bold; background-color:#FF9;">English: </td>';

    etc...

}
?>
 
Thank you for the reply. I just tried it out.

Unfortunately, it does not seem to work, and now I got the below extra thing in the search results.

if ( != '') { echo ''; echo ''; echo ''; echo ''; }







You could check to see if there is a xf_user cookie set.

PHP:
<?php

$bbuserid = $_COOKIE["xf_user"];
$pos = strpos($bbuserid, ',');
$bbuserid = substr($bbuserid,0,$pos);

if ($bbuserid != '') {
    echo '<tr>';
    echo '<td style="width:63px; text-align:right; font-weight:bold; background-color:#FF9;">English: </td>';

    etc...

}
?>
 
Coding is tricky, one character out of place and it won't work.

In post #1 you wrote "Enclosed is a PHP file that I linked to my webpage inside XenForo.". Could you elaborate a bit on this.
 
I created a new node within XenForo, then use PHP call back to link to the PHP file that are stored in a sub folder of the library folder.

Coding is tricky, one character out of place and it won't work.

In post #1 you wrote "Enclosed is a PHP file that I linked to my webpage inside XenForo.". Could you elaborate a bit on this.
 
Top Bottom