From d0fd6945d5121ca0d25af310a6d790093f711b32 Mon Sep 17 00:00:00 2001 From: Anthony Calandra Date: Thu, 24 Jul 2014 18:18:14 -0400 Subject: [PATCH] Changed postbit layout of badges to a 3xN border-less layout. --- Sources/Load.php | 45 ++++++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/Sources/Load.php b/Sources/Load.php index f10b529..34c34fe 100644 --- a/Sources/Load.php +++ b/Sources/Load.php @@ -1129,33 +1129,36 @@ function loadMemberContext($user, $display_custom_fields = false) $profile['signature'] = parse_bbc($profile['signature'], true, 'sig' . $profile['id_member']); $profile['is_online'] = (!empty($profile['show_online']) || allowedTo('moderate_forum')) && $profile['is_online'] > 0; - + // xxx changed for awards // orig: // $profile['stars'] = empty($profile['stars']) ? array('', '') : explode('#', $profile['stars']); - if(empty($profile['stars'])){ + if (empty($profile['stars'])) { $group_stars = ''; - }else{ - $stars = array(); - $count = 0; - foreach (explode(';', $profile['stars']) as $star){ - $star = explode('#', $star); - if($count == 0){ // original stars - $group_stars = str_repeat('*', empty($star[0]) || empty($star[1]) ? 0 : $star[0]); - }else{ // awards - // # $star[0] is number of images - // but in this case, it specifies whether the award is to be shown - // on mitb.com, mscp.org, or both - // 1 = both, 2 = mscp, 3 = mitb - // otherwise it will be equal to $award_id - //if( ($star[0] == 1) || ($star[0] == 2 && defined('MSCP')) || ($star[0] == 3 && !defined('MSCP')) || $star[0] == $award_id) - $group_stars .= "\n\t\t\t\t\t\t".'
  • *'; - } - ++$count; + } else { + $stars = explode(';', $profile['stars']); + $star = explode('#', $stars[0]); + $group_stars = str_repeat('*', empty($star[0]) || empty($star[1]) ? 0 : $star[0]); + $badges = array_shift($stars); + if (count($stars) > 0) { + $group_stars .= '
  • '; + $count = 0; + foreach ($stars as $badge) { + $badge = explode('#', $badge); + if ($count % 3 == 0) + $group_stars .= ''; + + $group_stars .= ''; + $count++; + if ($count % 3 == 0) + $group_stars .= ''; + } + + $group_stars .= '
    *
  • '; } } // xxx end changed for awards - + // Setup the buddy status here (One whole in_array call saved :P) $profile['buddy'] = in_array($profile['id_member'], $user_info['buddies']); $buddy_list = !empty($profile['buddy_list']) ? explode(',', $profile['buddy_list']) : array(); @@ -2817,4 +2820,4 @@ function get_memcached_server($level = 3) get_memcached_server($level - 1); } -?> \ No newline at end of file +?>