Best of joomla gives you news, joomla templates, tutorials and websites about Joomla , FireBoard and FireMessage official page.
| No account yet?   |
The FireBoard forum component development is still going on. In order to get better, FireBoard will be moved from the Best of Joomla website.
During this transition period, the forum in Best of Joomla will be closed to new posts.
Welcome, Guest
Please Login or Register.    Lost Password?
FireBoard Manual Latest release discussions Download FireBoard
[SOLVED] FB redirects to the wrong profile with CB (1 viewing) (1) Guest
TOPIC: [SOLVED] FB redirects to the wrong profile with CB
#53947
Re:[SOLVED] FB redirects to the wrong profile with 5 Months, 3 Weeks ago  
I get this

Parse error: syntax error, unexpected '&' in /home/anned/public_html/components/com_fireboard/template/default/view.php on line 333

no matter how carefully I try your unsubscribe trick
ryank (User)
Fresh Boarder
Posts: 7
graphgraph
User Offline Click here to see the profile of this user
Logged Logged
 
 
#53948
Re:[SOLVED] FB redirects to the wrong profile with 5 Months, 3 Weeks ago  
Also you posted a solution which would redirect you to the topic instead of the profile for favorite and subscribe. Currently my fireboard already redirects to a pages asking you if you with to return to the topic or the parent forum when you favorite or subscribe. Could you write a link or tell me how to modify the html link to do exactly the same for unsubscribe? I am using cb 1.1 stable, fb 1.0.4 and very carefully installed the cb fb plugin (simple board plugin mod) that you have referred to.
ryank (User)
Fresh Boarder
Posts: 7
graphgraph
User Offline Click here to see the profile of this user
Logged Logged
 
 
#54167
Re:[SOLVED] FB redirects to the wrong profile with 5 Months, 3 Weeks ago  
hello, anybody, anybody at all?
ryank (User)
Fresh Boarder
Posts: 7
graphgraph
User Offline Click here to see the profile of this user
Logged Logged
 
 
#54176
Re:[SOLVED] FB redirects to the wrong profile with 5 Months, 3 Weeks ago  
First of all, sorry to the people who have been asking questions. I have been away for a while and have not had time to check these forums, let alone reply.
Anyway, I'm back now so lets see what we can do...

@ emstalk:
I have another Joomla site with this same problem. Subscribe and Favorite still go to FB profile but Unsubscribe and Unfavorite are working great.

The setup is similar to my other Joomla site that I had (Joomla 1.0.15, CB 1.1, FB 1.0.4) but the problem is that I got rid of my old site and don't have my files that worked.

So I went through this thread and tried the exact same fix thinking it would work like my old site but sure enough it does not.

I have applied the updated files to simpleboard and I am using your view.php file that you attached here. I can't remember if there was any additional steps that I did to get this working.

Did you also make the changes to post.php as detailed in the very first post of this thread? All the other changes that you have made seem to be correct but you didn't mention this one.



@ ryank:
I get this

Parse error: syntax error, unexpected '&' in /home/anned/public_html/components/com_fireboard/template/default/view.php on line 333

no matter how carefully I try your unsubscribe trick

Can you post the relevant bit of code from your view.php or attach the whole file? Without seeing the code it is almost impossible to know why it is not working.
omin (User)
Fresh Boarder
Posts: 10
graphgraph
User Offline Click here to see the profile of this user
Logged Logged
 
Last Edit: 2008/07/19 14:20 By omin.
 
 
#54220
Re:[SOLVED] FB redirects to the wrong profile with 5 Months, 3 Weeks ago  
HA! It works now that I do the same copy and paste with a different editor. i think it is because the one editor I used automatically replaces all " with "" or ''. One problem still though, I cannot actually unsubscribe any more, I click unsubscribe and it takes me to my profile then I go back and I am still subscribed to the same topic (tried this many times and unsubscribe is always there). Also I know you did this for subscribing and favoriting but is there some code I could put in that would take me back to the topic instead? I am trying to implement this for subscription as we speak. here is the current view.php I am using (without the added subscription code).

Code:

<?php
/**
* @version $Id: view.php 523 2007-12-19 23:33:53Z miro_dietiker $
* Fireboard Component
* @package Fireboard
* @Copyright (C) 2006 - 2007 Best Of Joomla All rights reserved
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
* @link http://www.bestofjoomla.com
*
* Based on Joomlaboard Component
* @copyright (C) 2000 - 2004 TSMF / Jan de Graaff / All Rights Reserved
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
* @author TSMF & Jan de Graaff
**/

// Dont allow direct linking
defined ('_VALID_MOS') or die('Direct Access to this location is not allowed.');

$mainframe->addCustomHeadTag('
<script type="text/javascript" src="'.JB_DIRECTURL . '/template/default/plugin/chili/jquery.chili.pack.js"></script>
<script id="setup" type="text/javascript">
ChiliBook.recipeFolder     = "'.JB_DIRECTURL . '/template/default/plugin/chili/";
ChiliBook.stylesheetFolder     = "'.JB_DIRECTURL . '/template/default/plugin/chili/";
</script>
');

global $fbConfig;
// For joomla mambot support
if ($fbConfig['jmambot']) { class t{ var $text = ""; }    }
//

global $acl;
//securing form elements
$catid = (int)$catid;
$id = (int)$id;

$smileyList = smile::getEmoticons(0);

//ob_start();
$showedEdit = 0;
require_once (JB_ABSSOURCESPATH . 'fb_auth.php');
require_once (JB_ABSSOURCESPATH . 'fb_statsbar.php');

// Check if need to include class and if it exists at all, for bad word filtering
if ($fbConfig['badwords']) {
    if (is_file($mosConfig_absolute_path.'/components/com_badword/class.badword.php')) {
        require_once ($mosConfig_absolute_path.'/components/com_badword/class.badword.php');
    }
}

$is_Mod = 0;

if (!$is_admin)
{
    $database->setQuery("SELECT userid FROM #__fb_moderation WHERE catid='$catid' and userid='$my->id'");

    if ($database->loadResult()) {
        $is_Mod = 1;
    }
}
else {
    $is_Mod = 1;
} //superadmins always are

if (!$is_Mod)
{
    //check Access Level Restrictions but don't bother for Moderators
    unset ($allow_forum);

    $allow_forum = array ();

    //get all the info on this forum:
    $database->setQuery("SELECT id,pub_access,pub_recurse,admin_access,admin_recurse FROM #__fb_categories where id=$catid");
    $row = $database->loadObjectList();

    if ($fbSession->allowed != "na" && !$new_fb_user) {
        $allow_forum = explode(',', $fbSession->allowed);
    }
    else {
        $allow_forum = array ();
    }

    //Do user identification based upon the ACL
    $letPass = 0;
    $letPass = fb_auth::validate_user($row[0], $allow_forum, $aro_group->group_id, $acl);
}

if ($letPass || $is_Mod)
{
    $view = $view == "" ? $settings[current_view] : $view;
    setcookie("fboard_settings[current_view]", $view, time() + 31536000, '/');

    $id = (int)$id;

    $database->setQuery("SELECT * FROM #__fb_messages AS a LEFT JOIN #__fb_messages_text AS b ON a.id=b.mesid WHERE a.id={$id} and a.hold=0");
    unset($this_message);
    $database->loadObject($this_message);

    if (count($this_message) < 1) {
        echo '<p align="center">' . _MODERATION_INVALID_ID . '</p>n';
    }
    else
    {
        unset($this_message);
        $database->loadObject($this_message);

        $thread = $this_message->parent == 0 ? $this_message->id : $this_message->thread;

        if ($my->id)
        {
            //mark this topic as read
            $database->setQuery("SELECT readtopics FROM #__fb_sessions WHERE userid={$my->id}");
            $readTopics = $database->loadResult();

            if ($readTopics == "")
            {
                $readTopics = $thread;
            }
            else
            {
                //get all readTopics in an array
                $_read_topics = @explode(',', $readTopics);

                if (!@in_array($thread, $_read_topics)) {
                    $readTopics .= "," . $thread;
                }
            }

            $database->setQuery("UPDATE #__fb_sessions set readtopics='{$readTopics}' WHERE userid={$my->id}");
            $database->query();
        }

        //update the hits counter for this topic & exclude the owner
        if ($this_message->userid != $my->id) {
            $database->setQuery("UPDATE #__fb_messages SET hits=hits+1 WHERE id=$thread AND parent=0");
            $database->query();
        }
        // changed to 0 to fix the missing post when the thread splits over multiple pages
        $i = 0;

        if ($fbConfig['cb_profile'] && $my->id != 0)
        {
            $database->setQuery("SELECT fbordering from #__comprofiler where user_id=$my->id");
            $fbordering = $database->loadResult();

            if ($fbordering == "_UE_FB_ORDERING_OLDEST") {
                $orderingNum = 0;
            }
            else {
                $orderingNum = 1;
            }
        }
        else
        {
            $database->setQuery("SELECT ordering from #__fb_users where userid=$my->id");
            $orderingNum = $database->loadResult();
        }

        $ordering = $orderingNum ? 'DESC' : 'ASC';
        $database->setQuery("SELECT * FROM #__fb_messages AS a "
        ."n LEFT JOIN #__fb_messages_text AS b ON a.id=b.mesid WHERE (a.thread='$thread' OR a.id='$thread') AND a.hold=0 AND a.catid='$catid' ORDER BY a.time $ordering");

        if ($view != "flat")
        $flat_messages[] = $this_message;

        foreach ($database->loadObjectList()as $message)
        {
            if ($view == "flat")
            {
                $flat_messages[] = $message;

                if ($id == $message->id) {
                    $idmatch = $i;
                }

                $i++;
            }
            else {
                $messages[$message->parent][] = $message;
            }
        }

        if ($view == "flat")
        {
            //prepare threading
            $limit = $fbConfig['messages_per_page'];

            if ($idmatch > $limit) {
                $limitstart = (floor($idmatch / $limit)) * $limit;
            }
            else {
                $limitstart = 0;
            }

            $limitstart = intval(mosGetParam($_REQUEST, 'limitstart', $limitstart));
            $total = count($flat_messages);

            if ($total > $limit)
            {
                require_once (JB_JABSPATH . '/includes/pageNavigation.php');
                $pageNav = new mosPageNav($total, $limitstart, $limit);
                // slice out elements based on limits
                $flat_messages = array_slice($flat_messages, $pageNav->limitstart, $pageNav->limit);
            }
            else {
                $total = 0;
            }
        }

        //Get the category name for breadcrumb
        unset($objCatInfo, $objCatParentInfo);
        $database->setQuery("SELECT * from #__fb_categories where id='$catid'");
        $database->loadObject($objCatInfo);
        //Get Parent's cat.name for breadcrumb
        $database->setQuery("SELECT name,id from #__fb_categories WHERE id='$objCatInfo->parent'");
        $database->loadObject($objCatParentInfo);
        //data ready display now
?>

        <script type = "text/javascript">
        jQuery(function()
        {
            jQuery(".fb_qr_fire").click(function()
            {
                jQuery("#sc" + (jQuery(this).attr("id").split("__")[1])).toggle();
            });
            jQuery(".fb_qm_cncl_btn").click(function()
            {
                jQuery("#sc" + (jQuery(this).attr("id").split("__")[1])).toggle();
            });

        });
        </script>

        <div>
            <?php
            if (file_exists(JB_ABSTMPLTPATH . '/fb_pathway.php')) {
                require_once (JB_ABSTMPLTPATH . '/fb_pathway.php');
            }
            else {
                require_once (JB_ABSPATH . '/template/default/fb_pathway.php');
            }
            ?>
        <!--                     <a href="<?php echo sefRelToAbs(JB_LIVEURLREL);?>">
              <?php echo $fbIcons['forumlist'] ? '<img src="' . JB_URLICONSPATH . ''.$fbIcons['forumlist'].'" border="0" alt="'._GEN_FORUMLIST.'" title="'._GEN_FORUMLIST.'" />' : _GEN_FORUMLIST; ?>
           </a>
           <?php
            if (file_exists($mosConfig_absolute_path.'/templates/'.$mainframe->getTemplate().'/images/arrow.png')) {
                echo ' <img src="'.JB_JLIVEURL.'/templates/'.$mainframe->getTemplate().'/images/arrow.png" alt="" /> ';
            } else {
                echo ' <img src="'.JB_JLIVEURL.'/images/M_images/arrow.png" alt="" /> ';
              } ?>
           <a href="<?php echo sefRelToAbs(JB_LIVEURLREL.'&amp;func=listcat&amp;catid='.$objCatParentInfo->id);?>">
              <?php echo $objCatParentInfo->name;?>
           </a>
           <?php
              if (file_exists($mosConfig_absolute_path.'/templates/'.$mainframe->getTemplate().'/images/arrow.png')) {
                  echo ' <img src="'.JB_JLIVEURL.'/templates/'.$mainframe->getTemplate().'/images/arrow.png" alt="" /> ';
              } else {
                  echo ' <img src="'.JB_JLIVEURL.'/images/M_images/arrow.png" alt="" /> ';
              } ?>
           <a href="<?php echo sefRelToAbs(JB_LIVEURLREL.'&amp;func=showcat&amp;catid='.$catid);?>">
              <?php echo $objCatInfo->name;?>
            </a>
            -->
        </div>
        <?php if($objCatInfo->headerdesc) { ?>
        <div class="headerdesc"><br/><?php echo $objCatInfo->headerdesc; ?></div>
        <?php } ?>
        <!-- top nav -->
        <table border = "0" cellspacing = "0" class = "jr-topnav" cellpadding = "0" width="100%">
            <tr>
                <td class = "jr-topnav-left">
                   
                    <?php /* DISABLE
                    //post new topic
                    //echo "</td></tr><tr><td>";
                    if ((($fbConfig['pubwrite'] == 0 && $my_id != 0) || $fbConfig['pubwrite'] == 1) && ($topicLock == 0
                    || ($topicLock
                    == 1
                    && $is_moderator)))
                    {
                    if ($fbIcons['new_topic'])
                    {
                    echo '<a href="' . sefRelToAbs(
                    'index.php?option=com_fireboard&amp;Itemid=' . $Itemid . '&amp;func=post&amp;do=reply&amp;catid=' . $catid) . '"><img src="' . JB_URLICONSPATH . '' . $fbIcons['new_topic'] . '" alt="' . _GEN_POST_NEW_TOPIC . '" title="' . _GEN_POST_NEW_TOPIC . '" border="0" /></a>';
                    }
                    else
                    {
                    echo '<a href="' . sefRelToAbs(
                    'index.php?option=com_fireboard&amp;Itemid=' . $Itemid . '&amp;func=post&amp;do=reply&amp;catid=' . $catid) . '">' . _GEN_POST_NEW_TOPIC . '</a>';
                    }
                    }

                    */
                    ?>

                    <?php
                    //reply topic
                    echo '<br/><a href="' . sefRelToAbs(JB_LIVEURLREL . '&amp;func=post&amp;do=reply&amp;replyto=' . $thread . '&amp;catid=' . $catid) . '" >';
                    echo $fbIcons['topicreply'] ? '<img src="' . JB_URLICONSPATH . '' . $fbIcons['topicreply'] . '" border="0" alt="' . _GEN_POST_REPLY . '" title="' . _GEN_POST_REPLY . '"/>' : _GEN_POST_REPLY;
                    echo '</a>  <b>Reply</b>          ';
                    ?>

                    <?php
                    if ($fbConfig['allowsubscriptions'] == 1 && ("" != $my_id || 0 != $my_id))
                    {
                        //$fb_thread==0 ? $check_thread=$catid : $check_thread=$fb_thread;
                        $database->setQuery("SELECT thread from #__fb_subscriptions where userid=$my_id and thread='$thread'");
                        $fb_subscribed = $database->loadResult();

                        if ($fb_subscribed == "") {
                            $fb_cansubscribe = 1;
                        }
                        else {
                            $fb_cansubscribe = 0;
                        }
                    }

                    if ($my_id != 0 && $fbConfig['allowsubscriptions'] == 1 && $fb_cansubscribe == 1)
                    {
                    ?>
                        <a href = "<?php echo sefRelToAbs(JB_LIVEURLREL.'&amp;func=post&amp;do=subscribe&amp;catid='.$catid.'&amp;id='.$id.'&amp;fb_thread='.$thread);?>">
    <?php echo $fbIcons['subscribe'] ? '<img src="' . JB_URLICONSPATH . '' . $fbIcons['subscribe'] . '" border="0" title="' . _VIEW_SUBSCRIBETXT . '" alt="' . _VIEW_SUBSCRIBETXT . '" />' : _VIEW_SUBSCRIBE; ?></a>   <b>Subscribe</b>      

                    <?php
                    }

                    if ($my_id != 0 && $fbConfig['allowsubscriptions'] == 1 && $fb_cansubscribe == 0)
                    {
                    ?>

 <a href = "<?php echo $fbConfig['cb_profile'] ? sefRelToAbs('index.php?option=com_comprofiler&task=userProfile&Itemid=' . $cbitemid . '&tab=getforumtab&fbunsubthread='.$thread) : sefRelToAbs(JB_LIVEURLREL . '&amp;func=myprofile&amp;do=unsubscribeitem&amp;thread='.$thread);?>">
<?php echo $fbIcons['unsubscribe'] ? '<img src="' . JB_URLICONSPATH . '' . $fbIcons['unsubscribe'] . '" border="0" title="' . _VIEW_UNSUBSCRIBETXT . '" alt="' . _VIEW_UNSUBSCRIBETXT . '" />' : _VIEW_UNSUBSCRIBE; ?></a> <b>Unsubscribe</b> 

                    <?php
                    }
                    ?>
<br/>
      

                    <?php // BEGIN: FAVORITES
                    if ($fbConfig['allowfavorites'] == 1 && ("" != $my_id || 0 != $my_id))
                    {
                        $database->setQuery("SELECT thread from #__fb_favorites where userid=$my_id and thread='$thread'");
                        $fb_favorited = $database->loadResult();

                        if ($fb_favorited == "") {
                            $fb_canfavorite = 1;
                        }
                        else {
                            $fb_canfavorite = 0;
                        }
                    }

                    if ($my_id != 0 && $fbConfig['allowfavorites'] == 1 && $fb_canfavorite == 1)
                    {
                    ?>

                        <a href = "<?php echo sefRelToAbs(JB_LIVEURLREL.'&amp;func=post&amp;do=favorite&amp;catid='.$catid.'&amp;id='.$id.'&amp;fb_thread='.$thread);?>">
    <?php echo $fbIcons['favorite'] ? '<img src="' . JB_URLICONSPATH . '' . $fbIcons['favorite'] . '" border="0" title="' . _VIEW_FAVORITETXT . '" alt="' . _VIEW_FAVORITETXT . '" />' : _VIEW_FAVORITE; ?></a>

                    <?php
                    }

                    if ($my_id != 0 && $fbConfig['allowfavorites'] == 1 && $fb_canfavorite == 0)
                    {
                    ?>

                        <a href = "<?php echo sefRelToAbs(JB_LIVEURLREL.'&amp;func=myprofile&amp;do=unfavoriteitem&amp;thread='.$thread);?>">
    <?php echo $fbIcons['unfavorite'] ? '<img src="' . JB_URLICONSPATH . '' . $fbIcons['unfavorite'] . '" border="0" title="' . _VIEW_UNFAVORITETXT . '" alt="' . _VIEW_UNFAVORITETXT . '" />' : _VIEW_UNFAVORITE; ?></a>

                    <?php
                    }
                    // FINISH: FAVORITES
                    ?>
                    <!-- Begin: Total Favorite -->
                    <?php
                    $database->setQuery("SELECT COUNT(*) FROM #__fb_favorites where thread='$thread'");
                    $fb_totalfavorited = $database->loadResult();

                    echo '<span class="fb_totalfavorite">';
                    echo _FB_TOTALFAVORITE;
                    echo $fb_totalfavorited;
                    echo '</span>';
                    ?>

                    <?php
                    //go to bottom
                    echo '<br/><br/><a name="forumtop" /> <a href="'.htmlspecialchars(sefRelToAbs("index.php?".$_SERVER["QUERY_STRING"])).'#forumbottom" >';
                    echo $fbIcons['bottomarrow'] ? '<img src="' . JB_URLICONSPATH . '' . $fbIcons['bottomarrow'] . '" border="0" alt="' . _GEN_GOTOBOTTOM . '" title="' . _GEN_GOTOBOTTOM . '"/>' : _GEN_GOTOBOTTOM;
                    echo '</a> Move to Page Bottom';
                    ?>
<!-- Finish: Total Favorite -->
                </td>

                <td class = "jr-topnav-right">
                    <?php
                    if ($total != 0)
                    {
                    ?>

                        <div class = "jr-pagenav">
                            <ul>
                                <li class = "jr-pagenav-text"><?php echo _PAGE ?></li>

                                <li class = "jr-pagenav-nb">

                                <?php
                                echo $pageNav->writePagesLinks( JB_LIVEURLREL."&amp;func=view&amp;id=$id&amp;catid=$catid");
                                ?>

                                </li>
                            </ul>
                        </div>

                    <?php
                    }
                    ?>
                </td>
    </tr>
        </table>
        <!-- /top nav -->
        <!-- <table border = "0" cellspacing = "0" cellpadding = "0" width = "100%" align = "center"> -->
        
            <table class = "fb_blocktable<?php echo $objCatInfo->class_sfx; ?>"  id="fb_views" cellpadding = "0" cellspacing = "0" border = "0" width = "100%">
                <thead>
                    <tr>
                        <th align="left">
                             <div class = "fb_title_cover  fbm">
                                <span class = "fb_title fbxl"><b><?php echo _FB_TOPIC; ?></b> <?php echo $jr_topic_title; ?></span>
                            </div>
                            <!-- FORUM TOOLS -->

                            <?php

                            //(JJ) BEGIN: RECENT POSTS
                            if (file_exists(JB_ABSTMPLTPATH . '/plugin/forumtools/forumtools.php')) {
                                include (JB_ABSTMPLTPATH . '/plugin/forumtools/forumtools.php');
                            }
                            else {
                                include (JB_ABSPATH . '/template/default/plugin/forumtools/forumtools.php');
                            }

                            //(JJ) FINISH: RECENT POSTS

                            ?>
                        <!-- /FORUM TOOLS -->
                        </th>
                    </tr>
                </thead>

                <tr>
                    <td>
                        <?php
                        $tabclass = array
                        (
                        "sectiontableentry1",
                        "sectiontableentry2"
                        );

                        $mmm = 0;
                        $k = 0;
                        // Set up a list of moderators for this category (limits amount of queries)
                        $database->setQuery("SELECT a.userid FROM #__fb_users AS a" . "n LEFT JOIN #__fb_moderation AS b" . "n ON b.userid=a.userid" . "n WHERE b.catid='$catid'");
                        $catModerators = $database->loadResultArray();


                        /**
                        * note: please check if this routine is fine. there is no need to see for all messages if they are locked or not, either the thread or cat can be locked anyway
                        */

                        //check if topic is locked
                        $_lockTopicID = $this_message->thread;
                        $topicLock = $this_message->locked;

                        if ($_lockTopicID) // prev UNDEFINED $topicID!!
                        {
                            $lockedWhat = _TOPIC_NOT_ALLOWED; // UNUSED
                        }

                        else
                        { //topic not locked; check if forum is locked
                            $database->setQuery("select locked from #__fb_categories where id={$this_message->catid}");
                            $topicLock = $database->loadResult();
                            $lockedWhat = _FORUM_NOT_ALLOWED; // UNUSED
                        }
                        // END TOPIC LOCK

                        if (count($flat_messages) > 0)
                        {
                            foreach ($flat_messages as $fmessage)
                            {

                                $k = 1 - $k;
                                $mmm++;

                                if ($fmessage->parent == 0) {
                                    $fb_thread = $fmessage->id;
                                }
                                else {
                                    $fb_thread = $fmessage->thread;
                                }
                                //Joomla Mambot Support , Thanks hacksider
                                if ($fbConfig['jmambot'])
                                {
                                    global $_MAMBOTS;
                                    $row = new t();
                                    $row->text = $sb_message_txt;
                                    $_MAMBOTS->loadBotGroup( 'content' );
                                    $params =& new mosParameters( '' );
                                    $results = $_MAMBOTS->trigger( 'onPrepareContent', array( &$row, &$params, 0 ), true );
                                    $msg_text = $row->text;
                                }
                                /* Fininsh Joomla Mambot Support */

                                //set page title if on Mambo 4.5.2+
                                if ($leaf->parent == 0) {
                                    $mainframe->setPageTitle($fmessage->subject . ' - ' . $fbConfig['board_title']);
                                }

                                //filter out clear html
                                $fmessage->name = htmlspecialchars($fmessage->name);
                                $fmessage->email = htmlspecialchars($fmessage->email);
                                $fmessage->subject = htmlspecialchars($fmessage->subject);

                                //Get userinfo needed later on, this limits the amount of queries
                                unset($userinfo);
                                $database->setQuery("SELECT  a.*,b.name,b.username,b.gid FROM #__fb_users as a LEFT JOIN #__users as b on b.id=a.userid where a.userid='$fmessage->userid'");
                                $database->loadObject($userinfo);
                                //get the username:
                                $fb_username = "";

                                if ($fbConfig['username']) {
                                    $fb_queryName = "username";
                                }
                                else {
                                    $fb_queryName = "name";
                                }

                                $fb_username = $userinfo->$fb_queryName;

                                if ($fb_username == "" || $fbConfig['changename']) {
                                    $fb_username = $fmessage->name;
                                }

                                $msg_id = $fmessage->id;
                                $lists["userid"] = $fmessage->userid;
                                $msg_username = $fmessage->email != "" && $my_id > 0 && $fbConfig['showemail'] == '1' ? "<a href="mailto:" . stripslashes($fmessage->email) . "">" . stripslashes($fb_username) . "</a>" : stripslashes($fb_username);

                                if ($fbConfig['allowAvatar'])
                                {
                                    $Avatarname = $userinfo->username;

                                    if ($fbConfig['avatar_src'] == "clexuspm") {
                                        $msg_avatar = '<span class="fb_avatar"><img src="' . MyPMSTools::getAvatarLinkWithID($fmessage->userid) . '" /></span>';
                                    }
                                    elseif ($fbConfig['avatar_src'] == "cb")
                                    {
                                        $database->setQuery("SELECT avatar FROM #__comprofiler WHERE user_id='$fmessage->userid' AND avatarapproved='1'");
                                        $avatar = $database->loadResult();

                                        if ($avatar != '')
                                        {
                                            //added or modified by mambojoe
                                            //This now  has the right path to the upload directory and also handles the thumbnail and gallery photos.
                                            $imgpath = JB_JLIVEURL . '/images/comprofiler/';

                                            if (eregi("gallery/", $avatar) == false)
                                            $imgpath .= "tn" . $avatar;
                                            else
                                            $imgpath .= $avatar;

                                            $msg_avatar = '<span class="fb_avatar"><img src="' . $imgpath . '" alt="" /></span>';
                                            //added or modified by mambojoe
                                        }
                                        else {
                                            $imgpath = JB_JLIVEURL."/components/com_comprofiler/plugin/language/default_language/images/tnnophoto.jpg";
                                            $msg_avatar = '<span class="fb_avatar"><img src="' . $imgpath . '" alt="" /></span>';
                                        }
                                    }
                                    else
                                    {
                                        $avatar = $userinfo->avatar;

                                        if ($avatar != '') {
                                            $msg_avatar = '<span class="fb_avatar"><img border="0" src="' . FB_LIVEUPLOADEDPATH . '/avatars/' . $avatar . '" alt="" /></span>';
                                        }

                                        else {$msg_avatar = '<span class="fb_avatar"><img  border="0" src="' . FB_LIVEUPLOADEDPATH . '/avatars/s_nophoto.jpg" alt="" /></span>'; }
                                    }
                                }

                                if ($fbConfig['showstats'])
                                {
                                    //user type determination
                                    $ugid = $userinfo->gid;