BrainCMS | Badge of / Friend of issue

DanishAdam

Member
Jan 28, 2020
68
15
Hello Devbest!

(sorry for creating 2 thread at the same time) How do I fix this issue? The table of friend of looks so disgusting and its duplicated. I've checked home.php and I got no hints to fix that. Can someone please guide me to fix this? I need your help please.

You must be registered for see images attach
 
Solution
In your home.php you should look for

PHP:
<div style="width: 470px;margin-left: 10px;" class="columleft">
        <div class="box">
            <div class="green title">
                <?= $lang["Hbagesof"] ?> <?= userHome('username'); ?>
            </div>

and a little further down for

PHP:
                        else
                        {
                            echo userHome('username').' has no friends yet';
                        }
                    ?>
                </div>
            </div>
        </div>
    </div>

Select all that and replace it with

PHP:
    <div style="width: 470px;margin-left: 10px;" class="columleft">
        <div class="box">
            <div class="green title">
                <?=...

Wieiscool

New Member
Jan 27, 2013
28
11
In your home.php you should look for

PHP:
<div style="width: 470px;margin-left: 10px;" class="columleft">
        <div class="box">
            <div class="green title">
                <?= $lang["Hbagesof"] ?> <?= userHome('username'); ?>
            </div>

and a little further down for

PHP:
                        else
                        {
                            echo userHome('username').' has no friends yet';
                        }
                    ?>
                </div>
            </div>
        </div>
    </div>

Select all that and replace it with

PHP:
    <div style="width: 470px;margin-left: 10px;" class="columleft">
        <div class="box">
            <div class="green title">
                <?= $lang["Hbagesof"] ?> <?= userHome('username'); ?>
            </div>
            <div class="mainBox" style="float;left">
                <?php
                    $userId = userHome('id');
                    $stmt = $dbh->prepare("SELECT*FROM users_badges WHERE user_id = :userid");
                    $stmt->bindParam(':userid', $userId);
                    $stmt->execute();
                    if (!$stmt->RowCount() == 0)
                    {
                        while($badge = $stmt->fetch())
                        {
                            echo"<img src=\"".$config['badgeURL']."".filter($badge["badge_code"]).".GIF\">";
                        }
                    }
                    else
                    {
                        echo userHome('username').' has no badges yet';
                    }
                ?>
            </div>
        </div>
        <div class="box">
            <div class="blue title">
                <?= $lang["Hfrendsof"] ?> <?= userHome('username'); ?>
            </div>
            <div class="mainBox" style="float;left">
                <div style="width: 450px; height: 400px; overflow-y: scroll;">
                    <?php
                        $userId = userHome('id');
                        $sql = $dbh->prepare("SELECT * FROM messenger_friendships WHERE user_one_id=:userid");
                        $sql->bindParam(':userid', $userId);
                        $sql->execute();
                        if (!$sql->RowCount() == 0)
                        {
                            while($news = $sql->fetch())
                            {
                                $id = (userHome('id') == $news['user_two_id'] ? $news['user_one_id'] : $news['user_two_id']);
                                $getUser = $dbh->prepare("SELECT * FROM users WHERE id = :id");
                                $getUser->bindParam(':id', $id);
                                $getUser->execute();
                                $getUserData = $getUser->fetch();
                                echo'
                                <a href="/home/'.filter($getUserData['username']).'"> <img style="float: right;" src="https://habbo.com/habbo-imaging/avatarimage?figure='.filter($getUserData['look']).'&direction=3&head_direction=3&action=wav&gesture=sml&size=s&headonly=0">
                                <b>'.filter($getUserData['username']).'</b>    </a><br>'.filter($getUserData['motto']).'<br><br><br><hr> 
                                '.userlike($getUserData['id']).'';
                            }
                        }
                        else
                        {
                            echo userHome('username').' has no friends yet';
                        }
                    ?>
                </div>
            </div>
        </div>
    </div>

That should fix it
 
Solution

DanishAdam

Member
Jan 28, 2020
68
15
In your home.php you should look for

PHP:
<div style="width: 470px;margin-left: 10px;" class="columleft">
        <div class="box">
            <div class="green title">
                <?= $lang["Hbagesof"] ?> <?= userHome('username'); ?>
            </div>

and a little further down for

PHP:
                        else
                        {
                            echo userHome('username').' has no friends yet';
                        }
                    ?>
                </div>
            </div>
        </div>
    </div>

Select all that and replace it with

PHP:
    <div style="width: 470px;margin-left: 10px;" class="columleft">
        <div class="box">
            <div class="green title">
                <?= $lang["Hbagesof"] ?> <?= userHome('username'); ?>
            </div>
            <div class="mainBox" style="float;left">
                <?php
                    $userId = userHome('id');
                    $stmt = $dbh->prepare("SELECT*FROM users_badges WHERE user_id = :userid");
                    $stmt->bindParam(':userid', $userId);
                    $stmt->execute();
                    if (!$stmt->RowCount() == 0)
                    {
                        while($badge = $stmt->fetch())
                        {
                            echo"<img src=\"".$config['badgeURL']."".filter($badge["badge_code"]).".GIF\">";
                        }
                    }
                    else
                    {
                        echo userHome('username').' has no badges yet';
                    }
                ?>
            </div>
        </div>
        <div class="box">
            <div class="blue title">
                <?= $lang["Hfrendsof"] ?> <?= userHome('username'); ?>
            </div>
            <div class="mainBox" style="float;left">
                <div style="width: 450px; height: 400px; overflow-y: scroll;">
                    <?php
                        $userId = userHome('id');
                        $sql = $dbh->prepare("SELECT * FROM messenger_friendships WHERE user_one_id=:userid");
                        $sql->bindParam(':userid', $userId);
                        $sql->execute();
                        if (!$sql->RowCount() == 0)
                        {
                            while($news = $sql->fetch())
                            {
                                $id = (userHome('id') == $news['user_two_id'] ? $news['user_one_id'] : $news['user_two_id']);
                                $getUser = $dbh->prepare("SELECT * FROM users WHERE id = :id");
                                $getUser->bindParam(':id', $id);
                                $getUser->execute();
                                $getUserData = $getUser->fetch();
                                echo'
                                <a href="/home/'.filter($getUserData['username']).'"> <img style="float: right;" src="https://habbo.com/habbo-imaging/avatarimage?figure='.filter($getUserData['look']).'&direction=3&head_direction=3&action=wav&gesture=sml&size=s&headonly=0">
                                <b>'.filter($getUserData['username']).'</b>    </a><br>'.filter($getUserData['motto']).'<br><br><br><hr>
                                '.userlike($getUserData['id']).'';
                            }
                        }
                        else
                        {
                            echo userHome('username').' has no friends yet';
                        }
                    ?>
                </div>
            </div>
        </div>
    </div>

That should fix it
Ohh I seee. The original one is looking for "user_badges" table which is unexisted. and then you replaced it with table "users_badges". Cool, thank you!
Post automatically merged:

I've fixed this myself, thank you @Wieiscool for your help! you helped me to find the hint on what wrong with the fatal error! :D

Before:
You must be registered for see images attach


After:
You must be registered for see images attach
 
Last edited:

Users who are viewing this thread

Top