News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

PHP code help

Started by Mick., December 25, 2009, 11:57:49 PM

Previous topic - Next topic

Mick.

I used to use this team page script when i ran smf 1.1.x ,  Now i use RC2.

The database changed somehow,  how can this be fixed to work for RC2?

I get this error:
QuoteFatal error: Call to undefined function db_query() on line 29

<?php   global $txt, $scripturl, $user_info;
  global
$context, $modSettings, $ID_MEMBER;
  global
$board_info, $settings, $db_prefix;

/////////////////////////////////////////////////////////////////  Enter the desired groups
 
$groups_list = array(1,2);
/////////////////////////////////////////////////////////////////
 
$groups_query1 = 'mem.ID_GROUP IN (' . implode(', ', $groups_list) . ')';
 
$groups_query2 = '';
//   $groups_query2 = ' OR FIND_IN_SET(' . implode(', mem.additionalGroups) OR FIND_IN_SET(', $groups_list) . ', mem.additionalGroups)';


         
echo '<table align="center" width="95%" cellpadding="0" cellspacing="0"><tr>
               <td style="border-bottom: 2px solid #282828; padding-bottom: 2px; "><h2>Our Team</h2>
     <span class="middletext">These are the people you will run into while visiting ChevyAvalancheClub.com</span><br /><br />
     </td></tr></table>'
;


 
$loaded_ids = array();
   
$user_profile=array();
   
$memberContext=array();
   
$profile=array();
   
$context['team']=array();

 
// Load the member's data.
 
$request = db_query("
        SELECT IFNULL(lo.logTime, 0) AS isOnline, IFNULL(a.ID_ATTACH, 0) AS ID_ATTACH, a.filename, a.attachmentType,
           mem.personalText, mem.avatar, mem.ID_MEMBER, mem.memberName, mem.realName , mem.lastLogin, mem.websiteTitle,
           mem.websiteUrl, mem.location, mem.posts, them.value AS teamtext, g.groupName
        FROM (
{$db_prefix}members AS mem, {$db_prefix}membergroups AS g)
           LEFT JOIN
{$db_prefix}log_online AS lo ON (lo.ID_MEMBER = mem.ID_MEMBER)
           LEFT JOIN
{$db_prefix}attachments AS a ON (a.ID_MEMBER = mem.ID_MEMBER)
           LEFT JOIN
{$db_prefix}themes AS them ON (mem.ID_MEMBER = them.ID_MEMBER AND them.variable = 'teamtext' AND them.ID_THEME=1)
        WHERE mem.ID_GROUP = g.ID_GROUP
        AND (
$groups_query1 $groups_query2)
        ORDER BY mem.posts DESC"
, __FILE__, __LINE__);
 
$new_loaded_ids = array();
  while (
$row = mysql_fetch_assoc($request))
  {

       
$avatar_width = '';
       
$avatar_height = '';

     
$context['team'][] = array(
     
'username' => $row['memberName'],
     
'name' => $row['realName'],
     
'groupname' => $row['groupName'],
     
'posts' => $row['posts'],
     
'location' => $row['location'],
     
'href' => $scripturl . '?action=profile;u=' . $row['ID_MEMBER'],
     
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '" title="' . $txt[92] . ' ' . $row['realName'] . '">' . $row['realName'] . '</a>',
     
'blurb' => $row['personalText'],
     
'avatar' => array(
       
'name' => $row['avatar'],
       
'image' => $row['avatar'] == '' ? ($row['ID_ATTACH'] > 0 ? '<img  src="' . (empty($row['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $row['ID_ATTACH'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) . '" alt="" class="avatar2" border="0" />' : '') : (stristr($row['avatar'], 'http://') ? '<img src="' . $row['avatar'] . '"' . $avatar_width . $avatar_height . ' alt="" class="avatar2" border="0" />' : '<img src="' . $modSettings['avatar_url'] . '/' . htmlspecialchars($row['avatar']) . '" alt="" class="avatar2" border="0" />'),
       
'href' => $row['avatar'] == '' ? ($row['ID_ATTACH'] > 0 ? (empty($row['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $row['ID_ATTACH'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) : '') : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . $row['avatar']),
       
'url' => $row['avatar'] == '' ? '' : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . $row['avatar'])
     ),
     
'last_login' => empty($row['lastLogin']) ? $txt['never'] : timeformat($row['lastLogin']),
     
'last_login_timestamp' => empty($row['lastLogin']) ? 0 : forum_time(0, $row['lastLogin']),
     
'website' => array(
       
'title' => $row['websiteTitle'],
       
'url' => $row['websiteUrl']),
     
'online' => array(
       
'is_online' => $row['isOnline'],
       
'text' => &$txt[$row['isOnline'] ? 'online2' : 'online3'],
       
'image_href' => $settings['images_url'] . '/' . ($row['isOnline'] ? 'useron' : 'useroff') . '.gif',
     ),
     
'teamtext' => $row['teamtext'],
  );


  }
 
mysql_free_result($request);

  echo
'<table align="center" width="95%" cellpadding="5" cellspacing="5" style="margin-top: 10px;"><tr>';

   
$newrow=0;
  foreach(
$context['team'] as $team)
       {
           echo
'
<td valign="top" align="right" width="5%">'
.$team['avatar']['image'].'</td>
<td valign="top" width="45%" class="windowbg3 team" style="padding: 5px;">
<h2 style="margin-top: 0; margin-bottom: 6px;">'
.$team['link'].'</h2>
<b>Position</b>: '
.$team['groupname'].'<br />
<b>Last seen</b>: '
.$team['last_login'].'<br />
<b>Posts</b>: '
.$team['posts'].'<br />
'
, !empty($team['location']) ? '<b>Location</b>: '.$team['location'].'<br />' : '' , '
'
, !empty($team['website']['title']) ? '<b>Website</b>: <a href="'.$team['website']['url'].'" target="_blank">'.$team['website']['title'].'</a><br />' : '' , '
'
,  $team['online']['is_online'] ? '<img src="'.$team['online']['image_href'].'" alt="" /> '.$team['online']['text'].'<br />' : $team['online']['text'].'<br />' , '

'
, !empty($team['blurb']) ? '<i>- '.$team['blurb'].'</i><br />' : '' , '

'
,  !empty($team['teamtext']) ? $team['teamtext'].'<br />' : '' , '

   </div></td>'
;
           
$newrow++;
           if(
$newrow>1){
             
$newrow=0;
              echo
'</tr><tr><td colspan="4"><br /><br /> </td></tr><tr>';
           }
       }
  echo
'</tr></table>';
 
 
?>

Arantor

In 2.0, all of the database stuff was redone using $smcFunc instead of db_query, most columns got renamed as well. Plus language strings changed, too.

I have NOT tested this.

<?php   global $txt, $scripturl, $user_info;
  global
$context, $modSettings, $id_member;
  global
$board_info, $settings, $db_prefix;

/////////////////////////////////////////////////////////////////  Enter the desired groups
 
$groups_list = array(1,2);
/////////////////////////////////////////////////////////////////
 
$groups_query1 = 'mem.id_group IN ({array_int:groups1})';
 
$groups_query2 = '';
//   $groups_query2 = ' OR FIND_IN_SET(' . implode(', mem.additionalGroups) OR FIND_IN_SET(', $groups_list) . ', mem.additionalGroups)';
// ^^ haven't touched the above, can do if necessary - Arantor


         
echo '<table align="center" width="95%" cellpadding="0" cellspacing="0"><tr>
               <td style="border-bottom: 2px solid #282828; padding-bottom: 2px; "><h2>Our Team</h2>
     <span class="middletext">These are the people you will run into while visiting ChevyAvalancheClub.com</span><br /><br />
     </td></tr></table>'
;


 
$loaded_ids = array();
   
$user_profile=array();
   
$memberContext=array();
   
$profile=array();
   
$context['team']=array();

 
// Load the member's data.
 
$request = $smcFunc['db_query']('', '
        SELECT IFNULL(lo.logTime, 0) AS is_online, IFNULL(a.id_attach, 0) AS id_attach, a.filename, a.attachment_type,
           mem.personal_text, mem.avatar, mem.id_member, mem.member_name, mem.real_name , mem.last_login, mem.website_title,
           mem.website_url, mem.location, mem.posts, them.value AS teamtext, g.group_name
        FROM {db_prefix}members AS mem
           INNER JOIN {db_prefix}membergroups AS g ON (mem.id_group = g.id_group)
           LEFT JOIN {db_prefix}log_online AS lo ON (lo.id_member = mem.id_member)
           LEFT JOIN {db_prefix}attachments AS a ON (a.id_member = mem.id_member)
           LEFT JOIN {db_prefix}themes AS them ON (mem.id_member = them.id_member AND them.variable = '
teamtext' AND them.ID_THEME=1)
        WHERE ('
. $groups_query1 . $groups_query2 . ')
        ORDER BY mem.posts DESC'
,
        array(
           
'groups1' => $groups_list,
        )
  );
 
$new_loaded_ids = array();
  while (
$row = mysql_fetch_assoc($request))
  {

       
$avatar_width = '';
       
$avatar_height = '';

     
$context['team'][] = array(
     
'username' => $row['member_name'],
     
'name' => $row['real_name'],
     
'groupname' => $row['group_name'],
     
'posts' => $row['posts'],
     
'location' => $row['location'],
     
'href' => $scripturl . '?action=profile;u=' . $row['id_member'],
     
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '" title="' . $txt['profile_of'] . ' ' . $row['real_name'] . '">' . $row['real_name'] . '</a>',
     
'blurb' => $row['personal_text'],
     
'avatar' => array(
       
'name' => $row['avatar'],
       
'image' => $row['avatar'] == '' ? ($row['id_attach'] > 0 ? '<img  src="' . (empty($row['attachment_type']) ? $scripturl . '?action=dlattach;attach=' . $row['id_attach'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) . '" alt="" class="avatar2" border="0" />' : '') : (stristr($row['avatar'], 'http://') ? '<img src="' . $row['avatar'] . '"' . $avatar_width . $avatar_height . ' alt="" class="avatar2" border="0" />' : '<img src="' . $modSettings['avatar_url'] . '/' . htmlspecialchars($row['avatar']) . '" alt="" class="avatar2" border="0" />'),
       
'href' => $row['avatar'] == '' ? ($row['id_attach'] > 0 ? (empty($row['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $row['id_attach'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) : '') : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . $row['avatar']),
       
'url' => $row['avatar'] == '' ? '' : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . $row['avatar'])
     ),
     
'last_login' => empty($row['last_login']) ? $txt['never'] : timeformat($row['last_login']),
     
'last_login_timestamp' => empty($row['last_login']) ? 0 : forum_time(0, $row['last_login']),
     
'website' => array(
       
'title' => $row['website_title'],
       
'url' => $row['website_url']),
     
'online' => array(
       
'is_online' => $row['is_online'],
       
'text' => &$txt[$row['is_online'] ? 'online' : 'offline'],
       
'image_href' => $settings['images_url'] . '/' . ($row['is_online'] ? 'useron' : 'useroff') . '.gif',
     ),
     
'teamtext' => $row['teamtext'],
  );


  }
 
mysql_free_result($request);

  echo
'<table align="center" width="95%" cellpadding="5" cellspacing="5" style="margin-top: 10px;"><tr>';

   
$newrow=0;
  foreach(
$context['team'] as $team)
       {
           echo
'
<td valign="top" align="right" width="5%">'
.$team['avatar']['image'].'</td>
<td valign="top" width="45%" class="windowbg3 team" style="padding: 5px;">
<h2 style="margin-top: 0; margin-bottom: 6px;">'
.$team['link'].'</h2>
<b>Position</b>: '
.$team['groupname'].'<br />
<b>Last seen</b>: '
.$team['last_login'].'<br />
<b>Posts</b>: '
.$team['posts'].'<br />
'
, !empty($team['location']) ? '<b>Location</b>: '.$team['location'].'<br />' : '' , '
'
, !empty($team['website']['title']) ? '<b>Website</b>: <a href="'.$team['website']['url'].'" target="_blank">'.$team['website']['title'].'</a><br />' : '' , '
'
,  $team['online']['is_online'] ? '<img src="'.$team['online']['image_href'].'" alt="" /> '.$team['online']['text'].'<br />' : $team['online']['text'].'<br />' , '

'
, !empty($team['blurb']) ? '<i>- '.$team['blurb'].'</i><br />' : '' , '

'
,  !empty($team['teamtext']) ? $team['teamtext'].'<br />' : '' , '

   </div></td>'
;
           
$newrow++;
           if(
$newrow>1){
             
$newrow=0;
              echo
'</tr><tr><td colspan="4"><br /><br /> </td></tr><tr>';
           }
       }
  echo
'</tr></table>';
 
 
?>
Holder of controversial views, all of which my own.


Mick.

There you are! ;)

I tested it but comes back with an error:

QuoteParse error: syntax error, unexpected T_STRING  on line 38

Arantor

* Arantor did say clearly he hadn't tested it...

Ahhh.

The DB query should have been:
   $request = $smcFunc['db_query']('', '
         SELECT IFNULL(lo.logTime, 0) AS is_online, IFNULL(a.id_attach, 0) AS id_attach, a.filename, a.attachment_type,
            mem.personal_text, mem.avatar, mem.id_member, mem.member_name, mem.real_name , mem.last_login, mem.website_title,
            mem.website_url, mem.location, mem.posts, them.value AS teamtext, g.group_name
         FROM {db_prefix}members AS mem
            INNER JOIN {db_prefix}membergroups AS g ON (mem.id_group = g.id_group)
            LEFT JOIN {db_prefix}log_online AS lo ON (lo.id_member = mem.id_member)
            LEFT JOIN {db_prefix}attachments AS a ON (a.id_member = mem.id_member)
            LEFT JOIN {db_prefix}themes AS them ON (mem.id_member = them.id_member AND them.variable = {string:theme_var} AND them.ID_THEME=1)
         WHERE (' . $groups_query1 . $groups_query2 . ')
         ORDER BY mem.posts DESC',
         array(
             'groups1' => $groups_list,
             'theme_var' => 'teamtext',
         )
   );
Holder of controversial views, all of which my own.


Mick.

This is line 38

// Load the member's data.
   $request = $smcFunc['db_query']('', '
         SELECT IFNULL(lo.logTime, 0) AS is_online, IFNULL(a.id_attach, 0) AS id_attach, a.filename, a.attachment_type,
            mem.personal_text, mem.avatar, mem.id_member, mem.member_name, mem.real_name , mem.last_login, mem.website_title,
            mem.website_url, mem.location, mem.posts, them.value AS teamtext, g.group_name
         FROM {db_prefix}members AS mem
            INNER JOIN {db_prefix}membergroups AS g ON (mem.id_group = g.id_group)
            LEFT JOIN {db_prefix}log_online AS lo ON (lo.id_member = mem.id_member)
            LEFT JOIN {db_prefix}attachments AS a ON (a.id_member = mem.id_member)
            [b]LEFT JOIN {db_prefix}themes AS them ON (mem.id_member = them.id_member AND them.variable = 'teamtext' AND them.ID_THEME=1)[/b]
         WHERE (' . $groups_query1 . $groups_query2 . ')
         ORDER BY mem.posts DESC',
         array(
             'groups1' => $groups_list,
         )
   );

Mick.

Quote from: Arantor on December 26, 2009, 09:05:41 AM
* Arantor did say clearly he hadn't tested it...

Ahhh.

The DB query should have been:
   $request = $smcFunc['db_query']('', '
         SELECT IFNULL(lo.logTime, 0) AS is_online, IFNULL(a.id_attach, 0) AS id_attach, a.filename, a.attachment_type,
            mem.personal_text, mem.avatar, mem.id_member, mem.member_name, mem.real_name , mem.last_login, mem.website_title,
            mem.website_url, mem.location, mem.posts, them.value AS teamtext, g.group_name
         FROM {db_prefix}members AS mem
            INNER JOIN {db_prefix}membergroups AS g ON (mem.id_group = g.id_group)
            LEFT JOIN {db_prefix}log_online AS lo ON (lo.id_member = mem.id_member)
            LEFT JOIN {db_prefix}attachments AS a ON (a.id_member = mem.id_member)
            LEFT JOIN {db_prefix}themes AS them ON (mem.id_member = them.id_member AND them.variable = {string:theme_var} AND them.ID_THEME=1)
         WHERE (' . $groups_query1 . $groups_query2 . ')
         ORDER BY mem.posts DESC',
         array(
             'groups1' => $groups_list,
             'theme_var' => 'teamtext',
         )
   );


Boy! youre quick!   Ill try it.

Arantor

Quote from: BlueDevil on December 26, 2009, 09:07:04 AM
Boy! youre quick!   Ill try it.

That's how I managed 25k posts in 8 and a bit months...
Holder of controversial views, all of which my own.


Mick.

Heres another.... ???


Unknown column 'lo.logTime' in 'field list' Line: 45


Arantor

Meh, I missed one, it seems - try lo.log_time.

Holder of controversial views, all of which my own.


Mick.

It didnt work   lol let me rephrase that, i dont want to get hit by your signature  lol


I get same error:

QuoteParse error: syntax error, unexpected T_STRING on line 35

   global $txt, $scripturl, $user_info;
   global $context, $modSettings, $id_member;
   global $board_info, $settings, $db_prefix;

/////////////////////////////////////////////////////////////////  Enter the desired groups
   $groups_list = array(1,2,9,11,12);
/////////////////////////////////////////////////////////////////
   $groups_query1 = 'mem.id_group IN ({array_int:groups1})';
   $groups_query2 = '';
//   $groups_query2 = ' OR FIND_IN_SET(' . implode(', mem.additionalGroups) OR FIND_IN_SET(', $groups_list) . ', mem.additionalGroups)';
// ^^ haven't touched the above, can do if necessary - Arantor


          echo '<table align="center" width="95%" cellpadding="0" cellspacing="0"><tr>
                <td style="border-bottom: 2px solid #282828; padding-bottom: 2px; "><h2>Our Team</h2>
      <span class="middletext">These are the people you will run into while visiting ChevyAvalancheClub.com</span><br /><br />
      </td></tr></table>';


   $loaded_ids = array();
    $user_profile=array();
    $memberContext=array();
    $profile=array();
    $context['team']=array();

   // Load the member's data.
   $request = $smcFunc['db_query']('', '
         SELECT IFNULL(lo.log_time, 0) AS is_online, IFNULL(a.id_attach, 0) AS id_attach, a.filename, a.attachment_type,
            mem.personal_text, mem.avatar, mem.id_member, mem.member_name, mem.real_name , mem.last_login, mem.website_title,
            mem.website_url, mem.location, mem.posts, them.value AS teamtext, g.group_name
         FROM {db_prefix}members AS mem
            INNER JOIN {db_prefix}membergroups AS g ON (mem.id_group = g.id_group)
            LEFT JOIN {db_prefix}log_online AS lo ON (lo.id_member = mem.id_member)
            LEFT JOIN {db_prefix}attachments AS a ON (a.id_member = mem.id_member)
            LEFT JOIN {db_prefix}themes AS them ON (mem.id_member = them.id_member AND them.variable = 'teamtext' AND them.ID_THEME=1)
         WHERE (' . $groups_query1 . $groups_query2 . ')
         ORDER BY mem.posts DESC',
         array(
             'groups1' => $groups_list,
         )
   );
   $new_loaded_ids = array();
   while ($row = mysql_fetch_assoc($request))
   {

         $avatar_width = '';
         $avatar_height = '';

      $context['team'][] = array(
      'username' => $row['member_name'],
      'name' => $row['real_name'],
      'groupname' => $row['group_name'],
      'posts' => $row['posts'],
      'location' => $row['location'],
      'href' => $scripturl . '?action=profile;u=' . $row['id_member'],
      'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '" title="' . $txt['profile_of'] . ' ' . $row['real_name'] . '">' . $row['real_name'] . '</a>',
      'blurb' => $row['personal_text'],
      'avatar' => array(
         'name' => $row['avatar'],
         'image' => $row['avatar'] == '' ? ($row['id_attach'] > 0 ? '<img  src="' . (empty($row['attachment_type']) ? $scripturl . '?action=dlattach;attach=' . $row['id_attach'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) . '" alt="" class="avatar2" border="0" />' : '') : (stristr($row['avatar'], 'http://') ? '<img src="' . $row['avatar'] . '"' . $avatar_width . $avatar_height . ' alt="" class="avatar2" border="0" />' : '<img src="' . $modSettings['avatar_url'] . '/' . htmlspecialchars($row['avatar']) . '" alt="" class="avatar2" border="0" />'),
         'href' => $row['avatar'] == '' ? ($row['id_attach'] > 0 ? (empty($row['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $row['id_attach'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) : '') : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . $row['avatar']),
         'url' => $row['avatar'] == '' ? '' : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . $row['avatar'])
      ),
      'last_login' => empty($row['last_login']) ? $txt['never'] : timeformat($row['last_login']),
      'last_login_timestamp' => empty($row['last_login']) ? 0 : forum_time(0, $row['last_login']),
      'website' => array(
         'title' => $row['website_title'],
         'url' => $row['website_url']),
      'online' => array(
         'is_online' => $row['is_online'],
         'text' => &$txt[$row['is_online'] ? 'online' : 'offline'],
         'image_href' => $settings['images_url'] . '/' . ($row['is_online'] ? 'useron' : 'useroff') . '.gif',
      ),
      'teamtext' => $row['teamtext'],
   );


   }
   mysql_free_result($request);

   echo '<table align="center" width="95%" cellpadding="5" cellspacing="5" style="margin-top: 10px;"><tr>';

    $newrow=0;
   foreach($context['team'] as $team)
        {
            echo '
<td valign="top" align="right" width="5%">'.$team['avatar']['image'].'</td>
<td valign="top" width="45%" class="windowbg3 team" style="padding: 5px;">
<h2 style="margin-top: 0; margin-bottom: 6px;">'.$team['link'].'</h2>
<b>Position</b>: '.$team['groupname'].'<br />
<b>Last seen</b>: '.$team['last_login'].'<br />
<b>Posts</b>: '.$team['posts'].'<br />
' , !empty($team['location']) ? '<b>Location</b>: '.$team['location'].'<br />' : '' , '
' , !empty($team['website']['title']) ? '<b>Website</b>: <a href="'.$team['website']['url'].'" target="_blank">'.$team['website']['title'].'</a><br />' : '' , '
' ,  $team['online']['is_online'] ? '<img src="'.$team['online']['image_href'].'" alt="" /> '.$team['online']['text'].'<br />' : $team['online']['text'].'<br />' , '

' , !empty($team['blurb']) ? '<i>- '.$team['blurb'].'</i><br />' : '' , '

' ,  !empty($team['teamtext']) ? $team['teamtext'].'<br />' : '' , '

    </div></td>';
            $newrow++;
            if($newrow>1){
               $newrow=0;
               echo '</tr><tr><td colspan="4"><br /><br /> </td></tr><tr>';
            }
        }
   echo '</tr></table>';
   
   

Arantor

Fix the DB query as per reply 5, then change lo.logTime to lo.log_time.
Holder of controversial views, all of which my own.


Mick.

Hmmmm i got another one error....

QuoteFatal error: Function name must be a string on line 27
   global $txt, $scripturl, $user_info;
   global $context, $modSettings, $id_member;
   global $board_info, $settings, $db_prefix;

/////////////////////////////////////////////////////////////////  Enter the desired groups
   $groups_list = array(1,2,9,11,12);
/////////////////////////////////////////////////////////////////
   $groups_query1 = 'mem.id_group IN ({array_int:groups1})';
   $groups_query2 = '';
//   $groups_query2 = ' OR FIND_IN_SET(' . implode(', mem.additionalGroups) OR FIND_IN_SET(', $groups_list) . ', mem.additionalGroups)';
// ^^ haven't touched the above, can do if necessary - Arantor


          echo '<table align="center" width="95%" cellpadding="0" cellspacing="0"><tr>
                <td style="border-bottom: 2px solid #282828; padding-bottom: 2px; "><h2>Our Team</h2>
      <span class="middletext">These are the people you will run into while visiting ChevyAvalancheClub.com</span><br /><br />
      </td></tr></table>';


   $loaded_ids = array();
    $user_profile=array();
    $memberContext=array();
    $profile=array();
    $context['team']=array();

   // Load the member's data.
   $request = $smcFunc['db_query']('', '
         SELECT IFNULL(lo.log_time, 0) AS is_online, IFNULL(a.id_attach, 0) AS id_attach, a.filename, a.attachment_type,
            mem.personal_text, mem.avatar, mem.id_member, mem.member_name, mem.real_name , mem.last_login, mem.website_title,
            mem.website_url, mem.location, mem.posts, them.value AS teamtext, g.group_name
         FROM {db_prefix}members AS mem
            INNER JOIN {db_prefix}membergroups AS g ON (mem.id_group = g.id_group)
            LEFT JOIN {db_prefix}log_online AS lo ON (lo.id_member = mem.id_member)
            LEFT JOIN {db_prefix}attachments AS a ON (a.id_member = mem.id_member)
            LEFT JOIN {db_prefix}themes AS them ON (mem.id_member = them.id_member AND them.variable = {string:theme_var} AND them.ID_THEME=1)
         WHERE (' . $groups_query1 . $groups_query2 . ')
         ORDER BY mem.posts DESC',
         array(
             'groups1' => $groups_list,
             'theme_var' => 'teamtext',
         )
   );
   $new_loaded_ids = array();
   while ($row = mysql_fetch_assoc($request))
   {

         $avatar_width = '';
         $avatar_height = '';

      $context['team'][] = array(
      'username' => $row['member_name'],
      'name' => $row['real_name'],
      'groupname' => $row['group_name'],
      'posts' => $row['posts'],
      'location' => $row['location'],
      'href' => $scripturl . '?action=profile;u=' . $row['id_member'],
      'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '" title="' . $txt['profile_of'] . ' ' . $row['real_name'] . '">' . $row['real_name'] . '</a>',
      'blurb' => $row['personal_text'],
      'avatar' => array(
         'name' => $row['avatar'],
         'image' => $row['avatar'] == '' ? ($row['id_attach'] > 0 ? '<img  src="' . (empty($row['attachment_type']) ? $scripturl . '?action=dlattach;attach=' . $row['id_attach'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) . '" alt="" class="avatar2" border="0" />' : '') : (stristr($row['avatar'], 'http://') ? '<img src="' . $row['avatar'] . '"' . $avatar_width . $avatar_height . ' alt="" class="avatar2" border="0" />' : '<img src="' . $modSettings['avatar_url'] . '/' . htmlspecialchars($row['avatar']) . '" alt="" class="avatar2" border="0" />'),
         'href' => $row['avatar'] == '' ? ($row['id_attach'] > 0 ? (empty($row['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $row['id_attach'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) : '') : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . $row['avatar']),
         'url' => $row['avatar'] == '' ? '' : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . $row['avatar'])
      ),
      'last_login' => empty($row['last_login']) ? $txt['never'] : timeformat($row['last_login']),
      'last_login_timestamp' => empty($row['last_login']) ? 0 : forum_time(0, $row['last_login']),
      'website' => array(
         'title' => $row['website_title'],
         'url' => $row['website_url']),
      'online' => array(
         'is_online' => $row['is_online'],
         'text' => &$txt[$row['is_online'] ? 'online' : 'offline'],
         'image_href' => $settings['images_url'] . '/' . ($row['is_online'] ? 'useron' : 'useroff') . '.gif',
      ),
      'teamtext' => $row['teamtext'],
   );


   }
   mysql_free_result($request);

   echo '<table align="center" width="95%" cellpadding="5" cellspacing="5" style="margin-top: 10px;"><tr>';

    $newrow=0;
   foreach($context['team'] as $team)
        {
            echo '
<td valign="top" align="right" width="5%">'.$team['avatar']['image'].'</td>
<td valign="top" width="45%" class="windowbg3 team" style="padding: 5px;">
<h2 style="margin-top: 0; margin-bottom: 6px;">'.$team['link'].'</h2>
<b>Position</b>: '.$team['groupname'].'<br />
<b>Last seen</b>: '.$team['last_login'].'<br />
<b>Posts</b>: '.$team['posts'].'<br />
' , !empty($team['location']) ? '<b>Location</b>: '.$team['location'].'<br />' : '' , '
' , !empty($team['website']['title']) ? '<b>Website</b>: <a href="'.$team['website']['url'].'" target="_blank">'.$team['website']['title'].'</a><br />' : '' , '
' ,  $team['online']['is_online'] ? '<img src="'.$team['online']['image_href'].'" alt="" /> '.$team['online']['text'].'<br />' : $team['online']['text'].'<br />' , '

' , !empty($team['blurb']) ? '<i>- '.$team['blurb'].'</i><br />' : '' , '

' ,  !empty($team['teamtext']) ? $team['teamtext'].'<br />' : '' , '

    </div></td>';
            $newrow++;
            if($newrow>1){
               $newrow=0;
               echo '</tr><tr><td colspan="4"><br /><br /> </td></tr><tr>';
            }
        }
   echo '</tr></table>';
   
   

Arantor

Add $smcFunc to the list of globals at the start.
Holder of controversial views, all of which my own.


Mick.

Like this?

$smcFunc;
global $txt, $scripturl, $user_info;
   global $context, $modSettings, $id_member;
   global $board_info, $settings, $db_prefix;

Arantor

No, more like:
global $txt, $scripturl, $user_info;
   global $context, $modSettings, $id_member;
   global $board_info, $settings, $db_prefix, $smcFunc;
Holder of controversial views, all of which my own.


Mick.


Advertisement: