General error: Could not obtain user group information

You'll automatically gain access to this forum when you will post your first post in another forum. That way it will demonstrate how the Auto Group MOD works.
Forum rules
The content in this forum is dated Dec. 21 2005 and can be used as Archive only. This Forum is LOCKED and READ ONLY !

General error: Could not obtain user group information

Postby PeterPaul on Thu 28. Oct, 2004 19:04

I installed auto group on 2.0.10 and it works fine, EXCEPT:

when I now click on a user anywhere in the forum to get his profile I get:

General Error

Could not obtain user group information.

DEBUG MODE

SQL Error : 1054 Unknown column 'g.group_order' in 'order clause'

SELECT ug.group_id FROM plaza_user_group ug, plaza_groups g WHERE ug.user_id = 278 AND g.group_id = ug.group_id AND g.group_single_user = 0 ORDER BY g.group_order ASC

Line : 171
File : /usr/www/cmn/plaza/includes/usercp_viewprofile.php


EXCEPTION: clicking on users who are Mods or Admins works fine.

Please, can anyone help here?

Thank you in advance.

my usercp_viewprofile.php:

Code: Select all
<?php
/***************************************************************************
*                           usercp_viewprofile.php
*                            -------------------
*   begin                : Saturday, Feb 13, 2001
*   copyright            : (C) 2001 The phpBB Group
*   email                : support@phpbb.com
*
*   $Id: usercp_viewprofile.php,v 1.5.2.2 2004/07/11 16:46:20 acydburn Exp $
*
*
***************************************************************************/

/***************************************************************************
*
*   This program is free software; you can redistribute it and/or modify
*   it under the terms of the GNU General Public License as published by
*   the Free Software Foundation; either version 2 of the License, or
*   (at your option) any later version.
*
*
***************************************************************************/

if ( !defined('IN_PHPBB') )
{
   die("Hacking attempt");
   exit;
}

if ( empty($HTTP_GET_VARS[POST_USERS_URL]) || $HTTP_GET_VARS[POST_USERS_URL] == ANONYMOUS )
{
   message_die(GENERAL_MESSAGE, $lang['No_user_id_specified']);
}
$profiledata = get_userdata($HTTP_GET_VARS[POST_USERS_URL]);
//
// Buddylist actions
//
$buddy_id = ( isset($HTTP_GET_VARS['b']) ) ? intval($HTTP_GET_VARS['b']) : 0;
$buddy_action = ( isset($HTTP_GET_VARS['buddy']) ) ? $HTTP_GET_VARS['buddy'] : '';
if( $buddy_id && $buddy_action != '' )
{
   if( $buddy_action == 'add' )
   {
      add_buddy($userdata['user_id'], $buddy_id);
   }
   else if( $buddy_action == 'remove' )
   {
      remove_buddy($userdata['user_id'], $buddy_id);
   }
}
//
// END: Buddylist actions
//
/* COMMENTED BY Group Rank Hack
$sql = "SELECT *
   FROM " . RANKS_TABLE . "
   ORDER BY rank_special, rank_min";
if ( !($result = $db->sql_query($sql)) )
{
   message_die(GENERAL_ERROR, 'Could not obtain ranks information', '', __LINE__, __FILE__, $sql);
}

$ranksrow = array();
while ( $row = $db->sql_fetchrow($result) )
{
   $ranksrow[] = $row;
}
$db->sql_freeresult($result);
*/
//
// Output page header and profile_view template
//
$template->set_filenames(array(
   'body' => 'profile_view_body.tpl')
);
make_jumpbox('viewforum.'.$phpEx);

// Advanced Karma Mod
$sql = "select karma_plus from " . USERS_TABLE . " where user_id='$profiledata[user_id]'";
$result = $db->sql_query($sql);
$array = mysql_fetch_array($result);
$karma_plus = $array[0];
$sql = "select karma_minus from " . USERS_TABLE . " where user_id='$profiledata[user_id]'";
$result = $db->sql_query($sql);
$array = mysql_fetch_array($result);
$karma_minus = $array[0];
// Advanced Karma Mod

//
// Calculate the number of days this user has been a member ($memberdays)
// Then calculate their posts per day
//
$regdate = $profiledata['user_regdate'];
$memberdays = max(1, round( ( time() - $regdate ) / 86400 ));
$posts_per_day = $profiledata['user_posts'] / $memberdays;

// Get the users percentage of total posts
if ( $profiledata['user_posts'] != 0  )
{
   $total_posts = get_db_stat('postcount');
   $percentage = ( $total_posts ) ? min(100, ($profiledata['user_posts'] / $total_posts) * 100) : 0;
}
else
{
   $percentage = 0;
}

$avatar_img = '';
if ( $profiledata['user_avatar_type'] && $profiledata['user_allowavatar'] )
{
   switch( $profiledata['user_avatar_type'] )
   {
      case USER_AVATAR_UPLOAD:
         $avatar_img = ( $board_config['allow_avatar_upload'] ) ? '<img src="' . $board_config['avatar_path'] . '/' . $profiledata['user_avatar'] . '" alt="" border="0" />' : '';
         break;
      case USER_AVATAR_REMOTE:
         $avatar_img = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $profiledata['user_avatar'] . '" alt="" border="0" />' : '';
         break;
      case USER_AVATAR_GALLERY:
         $avatar_img = ( $board_config['allow_avatar_local'] ) ? '<img src="' . $board_config['avatar_gallery_path'] . '/' . $profiledata['user_avatar'] . '" alt="" border="0" />' : '';
         break;
   }
}

$poster_rank = '';
$rank_image = '';
// BEGIN Group Rank Hack
if ( $profiledata['user_rank'] )
{
   $sql = "SELECT *
      FROM " . RANKS_TABLE . "
      WHERE rank_id = " . $profiledata['user_rank'];
   if ( !($result = $db->sql_query($sql)) )
   {
      message_die(GENERAL_ERROR, 'Could not obtain user speical rank ', '', __LINE__, __FILE__, $sql);
   }
   if ( $row = $db->sql_fetchrow($result) )
   {
      $poster_rank = $row['rank_title'];
      $rank_image = ( $row['rank_image'] ) ? '<img src="' . $row['rank_image'] . '" alt="' . $poster_rank . '" title="' . $poster_rank . '" border="0" /><br />' : '';
   }
   $db->sql_freeresult($result);
}
else
{
   $sql = "SELECT *
   FROM " . RANKS_TABLE . "
   WHERE rank_special = 0
   ORDER BY rank_min DESC";
   if ( !($result = $db->sql_query($sql)) )
   {
      message_die(GENERAL_ERROR, 'Could not obtain ranks information', '', __LINE__, __FILE__, $sql);
   }

   $ranksrow = array();
   while ( $row = $db->sql_fetchrow($result) )
   {
      $ranksrow[$row['rank_group']][] = $row;
      $ranksrow[$row['rank_group']]['count']++;
   }
   $db->sql_freeresult($result);

   $sql = "SELECT ug.group_id
      FROM " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE . " g
      WHERE ug.user_id = " . $profiledata['user_id'] . "
         AND g.group_id = ug.group_id
         AND g.group_single_user = 0
      ORDER BY g.group_order ASC";
   if ( !($result = $db->sql_query($sql)) )
   {
      message_die(GENERAL_ERROR, "Could not obtain user group information.", '', __LINE__, __FILE__, $sql);
   }
   $rank_group_id = 0;
   while ( $row = $db->sql_fetchrow($result) )
   {
      if ( isset($ranksrow[$row['group_id']]) )
      {
         $rank_group_id = $row['group_id'];
         break;
      }
   }
   $db->sql_freeresult($result);

   for($i = 0; $i < $ranksrow[$rank_group_id]['count']; $i++)
   {
      if ( $profiledata['user_posts'] >= $ranksrow[$rank_group_id][$i]['rank_min'] )
      {
         $poster_rank = $ranksrow[$rank_group_id][$i]['rank_title'];
         $rank_image = ( $ranksrow[$rank_group_id][$i]['rank_image'] ) ? '<img src="' . $ranksrow[$rank_group_id][$i]['rank_image'] . '" alt="' . $poster_rank . '" title="' . $poster_rank . '" border="0" /><br />' : '';
         break;
      }
   }
}
// END Group Rank Hack
/* COMMENTED BY Group Rank Hack
if ( $profiledata['user_rank'] )
{
   for($i = 0; $i < count($ranksrow); $i++)
   {
      if ( $profiledata['user_rank'] == $ranksrow[$i]['rank_id'] && $ranksrow[$i]['rank_special'] )
      {
         $poster_rank = $ranksrow[$i]['rank_title'];
         $rank_image = ( $ranksrow[$i]['rank_image'] ) ? '<img src="' . $ranksrow[$i]['rank_image'] . '" alt="' . $poster_rank . '" title="' . $poster_rank . '" border="0" /><br />' : '';
      }
   }
}
else
{
   for($i = 0; $i < count($ranksrow); $i++)
   {
      if ( $profiledata['user_posts'] >= $ranksrow[$i]['rank_min'] && !$ranksrow[$i]['rank_special'] )
      {
         $poster_rank = $ranksrow[$i]['rank_title'];
         $rank_image = ( $ranksrow[$i]['rank_image'] ) ? '<img src="' . $ranksrow[$i]['rank_image'] . '" alt="' . $poster_rank . '" title="' . $poster_rank . '" border="0" /><br />' : '';
      }
   }
}
*/
$temp_url = append_sid("privmsg.$phpEx?mode=post&amp;" . POST_USERS_URL . "=" . $profiledata['user_id']);
$pm_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_pm'] . '" alt="' . $lang['Send_private_message'] . '" title="' . $lang['Send_private_message'] . '" border="0" /></a>';
$pm = '<a href="' . $temp_url . '">' . $lang['Send_private_message'] . '</a>';

if ( !empty($profiledata['user_viewemail']) || $userdata['user_level'] == ADMIN )
{
   $email_uri = ( $board_config['board_email_form'] ) ? append_sid("profile.$phpEx?mode=email&amp;" . POST_USERS_URL .'=' . $profiledata['user_id']) : 'mailto:' . $profiledata['user_email'];

   $email_img = '<a href="' . $email_uri . '"><img src="' . $images['icon_email'] . '" alt="' . $lang['Send_email'] . '" title="' . $lang['Send_email'] . '" border="0" /></a>';
   $email = '<a href="' . $email_uri . '">' . $lang['Send_email'] . '</a>';
}
else
{
   $email_img = '&nbsp;';
   $email = '&nbsp;';
}

$www_img = ( $profiledata['user_website'] ) ? '<a href="' . $profiledata['user_website'] . '" target="_userwww"><img src="' . $images['icon_www'] . '" alt="' . $lang['Visit_website'] . '" title="' . $lang['Visit_website'] . '" border="0" /></a>' : '&nbsp;';
$www = ( $profiledata['user_website'] ) ? '<a href="' . $profiledata['user_website'] . '" target="_userwww">' . $profiledata['user_website'] . '</a>' : '&nbsp;';

if ( !empty($profiledata['user_icq']) )
{
   $icq_status_img = '<a href="http://wwp.icq.com/' . $profiledata['user_icq'] . '#pager"><img src="http://web.icq.com/whitepages/online?icq=' . $profiledata['user_icq'] . '&img=5" width="18" height="18" border="0" /></a>';
   $icq_img = '<a href="http://wwp.icq.com/scripts/search.dll?to=' . $profiledata['user_icq'] . '"><img src="' . $images['icon_icq'] . '" alt="' . $lang['ICQ'] . '" title="' . $lang['ICQ'] . '" border="0" /></a>';
   $icq =  '<a href="http://wwp.icq.com/scripts/search.dll?to=' . $profiledata['user_icq'] . '">' . $lang['ICQ'] . '</a>';
}
else
{
   $icq_status_img = '&nbsp;';
   $icq_img = '&nbsp;';
   $icq = '&nbsp;';
}

$aim_img = ( $profiledata['user_aim'] ) ? '<a href="aim:goim?screenname=' . $profiledata['user_aim'] . '&amp;message=Hello+Are+you+there?"><img src="' . $images['icon_aim'] . '" alt="' . $lang['AIM'] . '" title="' . $lang['AIM'] . '" border="0" /></a>' : '&nbsp;';
$aim = ( $profiledata['user_aim'] ) ? '<a href="aim:goim?screenname=' . $profiledata['user_aim'] . '&amp;message=Hello+Are+you+there?">' . $lang['AIM'] . '</a>' : '&nbsp;';

$msn_img = ( $profiledata['user_msnm'] ) ? $profiledata['user_msnm'] : '&nbsp;';
$msn = $msn_img;

$yim_img = ( $profiledata['user_yim'] ) ? '<a href="http://edit.yahoo.com/config/send_webmesg?.target=' . $profiledata['user_yim'] . '&amp;.src=pg"><img src="' . $images['icon_yim'] . '" alt="' . $lang['YIM'] . '" title="' . $lang['YIM'] . '" border="0" /></a>' : '';
$yim = ( $profiledata['user_yim'] ) ? '<a href="http://edit.yahoo.com/config/send_webmesg?.target=' . $profiledata['user_yim'] . '&amp;.src=pg">' . $lang['YIM'] . '</a>' : '';

$temp_url = append_sid("search.$phpEx?search_author=" . urlencode($profiledata['username']) . "&amp;showresults=posts");
$search_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_search'] . '" alt="' . $lang['Search_user_posts'] . '" title="' . $lang['Search_user_posts'] . '" border="0" /></a>';
$search = '<a href="' . $temp_url . '">' . $lang['Search_user_posts'] . '</a>';
if ( $board_config['vault_display_profile'] )
{
   $template->assign_block_vars('display_shares',array());

   $sql = " SELECT e.* , eu .* FROM " . VAULT_EXCHANGE_TABLE . " e
      LEFT JOIN " . VAULT_EXCHANGE_USERS_TABLE . " eu ON ( eu.user_id =  " . $profiledata['user_id'] . " AND e.stock_id = eu.stock_id ) ";
   if( !($result = $db->sql_query($sql)))
   {
      message_die(GENERAL_ERROR, 'Could not obtain accounts information', "", __LINE__, __FILE__, $sql);
   }
   $shares = $db->sql_fetchrowset($result);

   for ( $i = 0 ; $i < count($shares) ; $i ++ )
   {
      $row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];

      $template->assign_block_vars('display_shares.shares' , array(
         'SHARE_ROW' => $row_class,
         'SHARE_NAME' => vault_get_lang($shares[$i]['stock_name']),
         'SHARE_SUM' => intval($shares[$i]['stock_amount']),
      ));
   }

   $sql = " SELECT * FROM " . VAULT_USERS_TABLE . "
      WHERE owner_id = " . $profiledata['user_id'];
   if( !($result = $db->sql_query($sql)))
   {
      message_die(GENERAL_ERROR, 'Could not obtain accounts information', "", __LINE__, __FILE__, $sql);
   }
   $accounts = $db->sql_fetchrow($result);

   $on_account = ( $accounts['account_protect'] && $userdata['user_level'] != ADMIN && $accounts['owner_id'] != $userdata['user_id'] ) ? $lang['Vault_confidential'] : intval($accounts['account_sum']).'&nbsp;'.$board_config['points_name'];
   $loan = ( $accounts['loan_protect'] && $userdata['user_level'] != ADMIN && $accounts['owner_id'] != $userdata['user_id'] ) ? $lang['Vault_confidential'] : intval($accounts['loan_sum']).'&nbsp;'.$board_config['points_name'];
}
list($buddy_img, $buddy) = get_buddy_img($userdata['user_id'], $profiledata['user_id']);

if ($board_config['viewprofile'] == "images")
{
   $itempurge = str_replace("Þ", "", $profiledata['user_items']);
   $itemarray = explode('ß',$itempurge);
   $itemcount = count ($itemarray);
   $user_items = "<br>";
   for ($xe = 0;$xe < $itemcount;$xe++)
   {
      if ($itemarray[$xe] != NULL)
      {
         if (file_exists('shop/images/'.$itemarray[$xe].'.jpg'))
         {
            $user_items .= ' <img src="shop/images/'.$itemarray[$xe].'.jpg" title="'.$itemarray[$xe].'" alt="'.$itemaray[$xe].'">';
         }
         elseif (file_exists('shop/images/'.$itemarray[$xe].'.gif'))
         {
            $user_items .= ' <img src="shop/images/'.$itemarray[$xe].'.gif" title="'.$itemarray[$xe].'" alt="'.$itemaray[$xe].'">';
         }
      }
   }
   $usernameurl = '<a href="'.append_sid('shop.'.$phpEx.'?action=inventory&searchid='.$profiledata['user_id'], true).'" class="nav">Items</a>: ';
}
elseif ($board_config['viewprofile'] == "link")
{
   $usernameurl = '<a href="'.append_sid('shop.'.$phpEx.'?action=inventory&searchid='.$profiledata['user_id'], true).'" class="nav">Items</a>';
}

//start of effects store checks
$shoparray = explode("ß", $board_config['specialshop']);
$shoparraycount = count ($shoparray);
$shopstatarray = array();
for ($x = 0; $x < $shoparraycount; $x++)
{
   $temparray = explode("Þ", $shoparray[$x]);
   $shopstatarray[] = $temparray[0];
   $shopstatarray[] = $temparray[1];
}
//end of effects store checks

$usereffects = explode("ß", $profiledata['user_effects']);
$userprivs = explode("ß", $profiledata['user_privs']);
$usercustitle = explode("ß", $profiledata['user_custitle']);
$userbs = array();
$usercount = count($userprivs);
for ($x = 0; $x < $usercount; $x++) { $temppriv = explode("Þ", $userprivs[$x]); $userbs[] = $temppriv[0]; $userbs[] = $temppriv[1]; }
$usercount = count($usereffects);
for ($x = 0; $x < $usercount; $x++) { $temppriv = explode("Þ", $usereffects[$x]); $userbs[] = $temppriv[0]; $userbs[] = $temppriv[1]; }
$usercount = count($usercustitle);
for ($x = 0; $x < $usercount; $x++) { $temppriv = explode("Þ", $usercustitle[$x]); $userbs[] = $temppriv[0]; $userbs[] = $temppriv[1]; }

//
// Generate page
//
$page_title = $lang['Viewing_profile'];
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
display_upload_attach_box_limits($profiledata['user_id']);
$template->assign_vars(array(
   'USERNAME' => $profiledata['username'],
   'JOINED' => create_date($lang['DATE_FORMAT'], $profiledata['user_regdate'], $board_config['board_timezone']),
   'KARMA_PLUS' => $karma_plus,
   'KARMA_MINUS' => $karma_minus,
   'POSTER_RANK' => $poster_rank,
   'RANK_IMAGE' => $rank_image,
   'INVENTORYLINK' => $usernameurl,
   'INVENTORYPICS' => $user_items,
   'POSTS_PER_DAY' => $posts_per_day,
   'POSTS' => $profiledata['user_posts'],
   'PERCENTAGE' => $percentage . '%',
   'POST_DAY_STATS' => sprintf($lang['User_post_day_stats'], $posts_per_day),
   'POST_PERCENT_STATS' => sprintf($lang['User_post_pct_stats'], $percentage),

   'SEARCH_IMG' => $search_img,
   'SEARCH' => $search,
   'L_ON_ACCOUNT' => $lang['Vault_on_account'],
   'L_LOAN' => $lang['Vault_loan_account'],
   'ON_ACCOUNT' => $on_account,
   'LOAN' => $loan,
   'PM_IMG' => $pm_img,
   'PM' => $pm,
   'EMAIL_IMG' => $email_img,
   'EMAIL' => $email,
   'WWW_IMG' => $www_img,
   'WWW' => $www,
   'BUDDY_IMG' => $buddy_img,
   'BUDDY' => $buddy,
   'ICQ_STATUS_IMG' => $icq_status_img,
   'ICQ_IMG' => $icq_img,
   'ICQ' => $icq,
   'AIM_IMG' => $aim_img,
   'AIM' => $aim,
   'MSN_IMG' => $msn_img,
   'MSN' => $msn,
   'YIM_IMG' => $yim_img,
   'YIM' => $yim,

   'LOCATION' => ( $profiledata['user_from'] ) ? $profiledata['user_from'] : '&nbsp;',
   'OCCUPATION' => ( $profiledata['user_occ'] ) ? $profiledata['user_occ'] : '&nbsp;',
   'INTERESTS' => ( $profiledata['user_interests'] ) ? $profiledata['user_interests'] : '&nbsp;',
   'AVATAR_IMG' => $avatar_img,

   'L_VIEWING_PROFILE' => sprintf($lang['Viewing_user_profile'], $profiledata['username']),
   'L_ABOUT_USER' => sprintf($lang['About_user'], $profiledata['username']),
   'L_AVATAR' => $lang['Avatar'],
   'L_POSTER_RANK' => $lang['Poster_rank'],
   'L_JOINED' => $lang['Joined'],
   'L_TOTAL_POSTS' => $lang['Total_posts'],
   'L_SEARCH_USER_POSTS' => sprintf($lang['Search_user_posts'], $profiledata['username']),
   'L_CONTACT' => $lang['Contact'],
   'L_EMAIL_ADDRESS' => $lang['Email_address'],
   'L_EMAIL' => $lang['Email'],
   'L_KARMA' => $lang['Karma'],
   'L_PM' => $lang['Private_Message'],
   'L_ICQ_NUMBER' => $lang['ICQ'],
   'L_YAHOO' => $lang['YIM'],
   'L_AIM' => $lang['AIM'],
   'L_MESSENGER' => $lang['MSNM'],
   'L_WEBSITE' => $lang['Website'],
   'L_BUDDY' => $lang['Buddy'],
   'L_LOCATION' => $lang['Location'],
   'L_OCCUPATION' => $lang['Occupation'],
   'L_INTERESTS' => $lang['Interests'],

   'U_SEARCH_USER' => append_sid("search.$phpEx?search_author=" . urlencode($profiledata['username'])),

   //
      // Photo Album Addon v2.x.x by Smartor
      //
      'U_PERSONAL_GALLERY' => append_sid("album_personal.$phpEx?user_id=" . $profiledata['user_id']),
      'L_PERSONAL_GALLERY' => sprintf($lang['Personal_Gallery_Of_User'], $profiledata['username']),


   'S_PROFILE_ACTION' => append_sid("profile.$phpEx"))
);

//$cm_viewprofile->post_vars($template,$profiledata,$userdata);
include($phpbb_root_path . 'mods/bb_usage_stats/includes/bb_usage_stats.'.$phpEx);
$template->pparse('body');

include($phpbb_root_path . 'includes/page_tail.'.$phpEx);

?>
PeterPaul
Poster
Poster
 
Posts: 5
Joined: Mon 04. Oct, 2004 10:17

Return to Auto group [2.0.8/EM]

Who is online

Users browsing this forum: No registered users and 1 guest

cron