MyBB Hacks

Full Version: how to make limit showing
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
hy please help me..

i want to make a limit to show buddy list in usercp

so in usercp will show like this

- you have 20 friend (this is all the buddy)
- show result 1-10 from 20
then the buddy avatars will show only 10 avatars

i have already make this one,but still showing all buddy avatars

PHP Code:
$query = $db->simple_select("users", "buddylist", "uid = '".intval($mybb->input['uid'])."'");
$forum = $db->fetch_array($query);
$count_friend = 0;
if($forum['buddylist'] != "")
    {
        $timecut = TIME_NOW - $mybb->settings['wolcutoff'];
        
        $query = $db->simple_select("users", "*", "uid IN ({$forum['buddylist']})", array('order_by' => 'lastactive'));

        while($friend = $db->fetch_array($query))
        {
            $friend_name = format_name($friend['username'], $friend['usergroup'], $friend['displaygroup']);
            $profile_link = build_profile_link($friend_name, $friend['uid'], '_blank', 'if(window.opener) { window.opener.location = this.href; return false; }');

            if($friend['avatar'])
            {
                $friend['avatar'] = htmlspecialchars_uni($friend['avatar']);
                if($friend['avatardimensions'])
                {
                    require_once MYBB_ROOT."inc/functions_image.php";
                    list($width, $height) = explode("|", $friend['avatardimensions']);
                    $scaled_dimensions = scale_image($width, $height, 44, 44);
                }
                else
                {
                    $scaled_dimensions = array(
                        "width" => 44,
                        "height" => 44
                    );
                }
            }
            else
            {
                $friend['avatar'] = $theme['imgdir'] . "/default_avatar.gif";
                $scaled_dimensions = array(
                    "width" => 44,
                    "height" => 44
                );
            }
            $margin_top = ceil((50-$scaled_dimensions['height'])/2);
            eval("\$friendlist .= \"".$templates->get("member_profile_custom_friend")."\";");
           ++$count_friend;
        }
    }
    else
    {
        $friendlist = 'Buddie list is empty';
    } 
$lang->count_buddies = $lang->sprintf($lang->count_buddies, $count_friend);



that code show me like this
- you have 20 friend (this is all the buddy)
- show result 1-20 from 20

here is the question, i want to make limit when it's show avatar friends to 10

just like this

Quote:- you have 20 friend (this is all the buddy)
- show result 1-10 from 20
(then the buddy avatars will show only 10 avatars)

sorry for my bad english
Look at how the rest of MyBB makes paging (in general, limits in select queries, take current page as an input variable).  Expect the complexity to go up a fair bit.
(10-04-2012 01:06 PM)ZiNgA BuRgA Wrote: [ -> ]Look at how the rest of MyBB makes paging (in general, limits in select queries, take current page as an input variable).  Expect the complexity to go up a fair bit.

i not want to make a page...i want to make this..

for example i have 6 friends...then i just want to show 5 friends in member user, the other 1 is not showing..

just want to make limit like this

Code:
$post['message'] = my_substr($post['message'], 0, 250) . "...";


but limit to show friends...can you help me?

hello bekti

You have a problem at your forum

so did me Biggrin
[/quote]
Reference URL's