TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,966
  • Latest: safir45
Stats
  • Total Posts: 195,993
  • Total Topics: 21,324
  • Online today: 388
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 286
  • Total: 286

Recent topics for SMF2

Started by IchBin, February 22, 2010, 07:53:26 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

IchBin

Let me know if there are any errors as I haven't tested any of this. :)

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

//////////////////////////////////////////// ---------- Unconditional Exclude
//   
   $exclude_boards = array();   // KEEP (to preserve variable declaration)
//   $exclude_boards = array(5);   //  Exclude single board
//     $exclude_boards = array(55,69);   //  Exclude multiple boards
   $ex_board_clause = !empty($exclude_boards) ? ' AND b.id_board NOT IN (' . implode(', ', $exclude_boards) . ')' : '';
//   
//   

//////////////////////////////////////////// ---------- Use in TP PHP Article (no title or frame from theme)
//   This will give most recent XX posted to topics -OR-
//   most recent XX unreplied to topics -OR-
//   topics posted to in last XX hours -OR-
//   most recent XX topics on topic notify list
//   
//   Sorts by most recent reply (descending; most recent first) -OR-
//            creation order (descending; most recent first)
//   
//   All in the detailed topic format
//   
//   
//   Default
//   index.php?page=##
//   most recent posted to topics - will list
//   number equal to  $settings['number_recent_posts']
//   
//   index.php?page=##;count=50 or index.php?page=##;type=last;count=50
//   50 most recently posted to topics
//   
//   index.php?page=##;type=unreplied or index.php?page=##;type=unreplied;count=50
//   Most recent unreplied to topics - will
//   list number specified in 'count' or default to
//   number equal to  $settings['number_recent_posts']
//   
//   index.php?page=##;type=hours or index.php?page=##;type=hours;count=12
//   Topics posted to in last number of hours
//   specified in 'count' or default to 24.
//   
//   index.php?page=##;type=notify or index.php?page=##;type=notify;count=50
//   Topics in topic notifcation list up to number
//   specified in 'count' or a maximum of 100 topics.
//   
//   *** Admins Only ***
//   index.php?page=##;type=notify;user=XXX or index.php?page=##;type=notify;user=XXX;count=50
//   Topics in topic notifcation list of specified user up to number
//   specified in 'count' or a maximum of 100 topics.
//   
//   index.php?page=##;type=started or index.php?page=##;type=started;count=50
//   Topics started by current user list up to number
//   specified in 'count' or a maximum of 100 topics.
//   
//   *** Admins Only ***
//   index.php?page=##;type=notify;user=XXX or index.php?page=##;type=started;user=XXX;count=50
//   Topics started by specified user up to number
//   specified in 'count' or a maximum of 100 topics.
//   
//   Add argument order=create to sort by topic creation sequence (most recent first)
//   rather than by last reply sequence

   $do_query = 1;

//////////////////////////////////////////// ---------- Poor Man's Global Announcements Block (center block - no Title/Frame)
//   Delete documentation comments above and marked section below
//
//   $announce_topics = array(254, 568, 675, 678); // Topic ID's to be 'Announced'
//
//   $heading = '<center>Announcements<center>';
//   $where_clause = 't.ID_TOPIC IN (' . implode(', ', $announce_topics) . ')';
//   $limit_clause = '';
//   $order_clause = 't.ID_LAST_MSG DESC';
////////////////////////////////////////////   

//////////////////////////////////////////// ---------- Last 5 Topics Started by User Block (center block - no Title/Frame)
//   Delete documentation comments above and marked section below
//
//   $heading = 'Most Recent Topics You Started';
//   $where_clause = 'ms.ID_MEMBER = '.$ID_MEMBER;
//   $limit_clause = 'LIMIT 5';
//   $order_clause = 't.ID_FIRST_MSG DESC';
////////////////////////////////////////////   

//////////////////////////////////////////// ---------- Boardindex Most Recent Topics Arguments
//
//   Comment out the Info Center's Most Recent Posts Code and Insert this
//   to show Most Recent Topics in full detail style instead
//
//   $list_count = $settings['number_recent_posts'];
//   $heading = 'Most Recently Posted To Topics';
//   $where_clause = 't.ID_LAST_MSG >= ' . ($modSettings['maxMsgID'] - 50 * min($list_count, 5));
//   $limit_clause = 'LIMIT ' . $list_count;
//   $order_clause = 't.ID_LAST_MSG DESC';
////////////////////////////////////////////   

////////////////////////////////////////////  ------ Remove down to next mark to use in block/boardindex ------
//
   if (empty($settings['number_recent_posts']))
      $number_recent_posts = 20;
   else
      $number_recent_posts = $settings['number_recent_posts'];

        if( isset($_GET['type']) )
      $list_type = $_GET['type'];
   else
      $list_type = 'last';

        if( isset($_GET['count']) )
      $list_count = $_GET['count'];
   else
   {
      $list_count = $number_recent_posts;
      if ($list_type == 'notify')
         $list_count = 100;
      elseif ($list_type == 'hours')
         $list_count = 24;
   }

   if ($list_count <= 0)
   {
      $list_count = $number_recent_posts;
      if ($list_type == 'hours')
         $list_count = 24;
   }

   if ($list_count > 100)
      $list_count = 100;

        if( isset($_GET['order']) )
      $list_order = $_GET['order'];
   else
      $list_order = 'lastpost';

        if( $list_order == 'create' )
      $order_clause = 't.id_first_msg DESC';
   else
      $order_clause = 't.id_last_msg DESC';

   if ($list_type == 'hours')
   {
      $list_from = strtotime($list_count.' hours ago');
      $where_clause = 'ml.poster_time >= ' . $list_from;
      $limit_clause = ' ';
      $heading = 'Topics Posted To In Last '. $list_count . ' Hours';
   }
   elseif ($list_type == 'unreplied')
   {
      $where_clause = 't.num_replies = 0';
      if ($list_count == 0)
      {
         $limit_clause = ' ';
         $heading = 'Unreplied To Topics';
      }
      else
      {
      $limit_clause = 'LIMIT ' . $list_count;
      $heading = $list_count . ' Most Recent Unreplied To Topics';
      }
   }
   elseif ($list_type == 'notify')
   {
      if (isset($_GET['user']) && $user_info['is_admin'])
      {
         $watched_topics = array();
         $request = $smcFunc['db_query']("", "SELECT id_topic FROM ".$db_prefix."log_notify
                                 WHERE id_member = {int:user_id}
                                 AND id_board = 0",
                                 array('user_id' => $_GET['user']));
         while ($row = $smcFunc['db_fetch_assoc']($request))
            $watched_topics[] = $row['id_topic'];
         $smcFunc['db_free_result']($request);
         $heading = $list_count . ' Most Recent Topics Being Watched by User # '.$_GET['user'];
         $where_clause = 't.id_topic IN (' . implode(', ', $watched_topics) . ')';
         $limit_clause = 'LIMIT ' . $list_count;
         if (empty($watched_topics))
            $do_query = 0;
      }
      else
      {
         $watched_topics = array();
         $request = $smcFunc['db_query']("", "SELECT id_topic FROM ".$db_prefix."log_notify
                                 WHERE id_member = {int:id_member}
                                 AND id_board = 0",
                                 array('id_member' => $user_info['id']));
         while ($row = $smcFunc['db_fetch_assoc']($request))
            $watched_topics[] = $row['id_topic'];
         $smcFunc['db_free_result']($request);
         $heading = $list_count . ' Most Recent Topics Being Watched';
         $where_clause = 't.id_topic IN (' . implode(', ', $watched_topics) . ')';
         $limit_clause = 'LIMIT ' . $list_count;
         if (empty($watched_topics))
            $do_query = 0;
      }
   }
   elseif ($list_type == 'started')
   {
      if (isset($_GET['user']) && $user_info['is_admin'])
      {
         $where_clause = 'ms.id_member = '.$_GET['user'];
         $limit_clause = 'LIMIT ' . $list_count;
              if( $list_order == 'create' )
         {
            $order_clause = 't.id_first_msg DESC';
            $heading = 'Most Recent Topics Started by User '.$_GET['user'];
         }
         else
         {
            $order_clause = 't.id_last_msg DESC';
            $heading = 'Most Recently Posted To Topics Started by User '.$_GET['user'];
         }
      }
      else
      {
         $where_clause = 'ms.id_member = '.$user_info['id'];
         $limit_clause = 'LIMIT ' . $list_count;
              if( $list_order == 'create' )
         {
            $order_clause = 't.id_first_msg DESC';
            $heading = 'Most Recent Topics You Started';
         }
         else
         {
            $order_clause = 't.id_last_msg DESC';
            $heading = 'Most Recently Posted To Topics You Started';
         }
      }
   }
   else
   {
      $where_clause = 't.id_last_msg >= ' . ($modSettings['maxMsgID'] - 90 * min($list_count, 5));
      $limit_clause = 'LIMIT ' . $list_count;
      $heading = $list_count . ' Most Recently Posted To Topics';
   }
//
////////////////////////////////////////////  ------ Remove up to first mark to use in block/boardindex ------

   $stable_icons = array('xx', 'thumbup', 'thumbdown', 'exclamation', 'question', 'lamp', 'smiley', 'angry', 'cheesy', 'grin', 'sad', 'wink', 'moved', 'recycled', 'wireless');
   $icon_sources = array();
   foreach ($stable_icons as $icon)
      $icon_sources[$icon] = 'images_url';

   $groupcolors = array();
   $request = $smcFunc['db_query']("", "SELECT id_group, online_color FROM ".$db_prefix."membergroups",array());
   while ($row = $smcFunc['db_fetch_assoc']($request))
      $groupcolors[$row['id_group']] = $row['online_color'];
   $smcFunc['db_free_result']($request);

   $topics = array();

   if ($do_query == 1)
   {
      $request = $smcFunc['db_query']("", "
      SELECT
            ms.subject AS firstSubject, ms.poster_time AS firstPosterTime, ms.id_topic, t.id_last_msg, t.id_board, b.name AS bname,
            t.num_replies, t.num_views, ms.id_member AS ID_FIRST_MEMBER, ml.id_member AS ID_LAST_MEMBER,
            ml.poster_time AS lastPosterTime, IFNULL(mems.real_name, ms.poster_name) AS firstPosterName,
            IFNULL(meml.real_name, ml.poster_name) AS lastPosterName,
            mems.id_group as mems_group, meml.id_group as meml_group,
            ml.subject AS lastSubject, b.member_groups,
            ml.icon AS lastIcon, ms.icon AS firstIcon, t.id_poll, t.is_sticky, t.locked, ml.modified_time AS lastModifiedTime,
            LEFT(ml.body, 384) AS lastBody, LEFT(ms.body, 384) AS firstBody,
            ml.smileys_enabled AS lastSmileys, ms.smileys_enabled AS firstSmileys, t.id_first_msg,"
            . ($user_info['is_guest'] ? '1 AS isRead, 0 AS new_from' : '
            IFNULL(lt.id_msg, IFNULL(lmr.id_msg, 0)) >= ml.id_msg_modified AS isRead,
            IFNULL(lt.id_msg, IFNULL(lmr.id_msg, -1)) + 1 AS new_from') . "
         FROM (".$db_prefix."messages AS ms, ".$db_prefix."messages AS ml, ".$db_prefix."topics AS t, ".$db_prefix."boards AS b)
            LEFT JOIN ".$db_prefix."members AS mems ON (mems.id_member = ms.id_member)
            LEFT JOIN ".$db_prefix."members AS meml ON (meml.id_member = ml.id_member)
            LEFT JOIN ".$db_prefix."log_topics AS lt ON (lt.id_topic = t.id_topic AND lt.id_member = ".$user_info['id'].")
            LEFT JOIN ".$db_prefix."log_mark_read AS lmr ON (lmr.id_board = t.id_board AND lmr.id_member = ".$user_info['id'].")
         WHERE " . $where_clause . $ex_board_clause . "
            AND t.id_topic = ms.id_topic
            AND b.id_board = t.id_board" . (!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ? " AND b.id_board != ".$modSettings['recycle_board'] : "") . "
            AND ms.id_msg = t.id_first_msg
            AND ml.id_msg = t.id_last_msg
            AND " . $user_info['query_see_board'] . "
         ORDER BY " . $order_clause . " " . $limit_clause,
       array());


   $topic_ids = array();
   while ($row = $smcFunc['db_fetch_assoc']($request))
   {
      if ($row['id_poll'] > 0 && $modSettings['pollMode'] == '0')
         continue;

      $topic_ids[] = $row['id_topic'];

      // Clip the strings first because censoring is slow :/. (for some reason?)
      $row['firstBody'] = strip_tags(strtr(parse_bbc($row['firstBody'], $row['firstSmileys'], $row['id_first_msg']), array('<br />' => '
')));
      if (strlen($row['firstBody']) > 128)
         $row['firstBody'] = substr($row['firstBody'], 0, 128) . '...';
      $row['lastBody'] = strip_tags(strtr(parse_bbc($row['lastBody'], $row['lastSmileys'], $row['id_last_msg']), array('<br />' => '
')));
      if (strlen($row['lastBody']) > 128)
         $row['lastBody'] = substr($row['lastBody'], 0, 128) . '...';

         $row['lastSubject'] = $row['firstSubject'];
         $row['lastBody'] = $row['firstBody'];

      // Decide how many pages the topic should have.
      $topic_length = $row['num_replies'] + 1;
      if ($topic_length > $modSettings['defaultMaxMessages'])
      {
         $tmppages = array();
         $tmpa = 1;
         for ($tmpb = 0; $tmpb < $topic_length; $tmpb += $modSettings['defaultMaxMessages'])
         {
            $tmppages[] = '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.' . $tmpb . ';topicseen">' . $tmpa . '</a>';
            $tmpa++;
         }
         // Show links to all the pages?
         if (count($tmppages) <= 5)
            $pages = 'Ã,« ' . implode(' ', $tmppages);
         // Or skip a few?
         else
            $pages = 'Ã,« ' . $tmppages[0] . ' ' . $tmppages[1] . ' ... ' . $tmppages[count($tmppages) - 2] . ' ' . $tmppages[count($tmppages) - 1];

         if (!empty($modSettings['enableAllMessages']) && $topic_length < $modSettings['enableAllMessages'])
            $pages .= '  <a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.0;all">' . $txt['all'] . '</a>';
         $pages .= ' Ã,»';
      }
      else
         $pages = '';

      // We need to check the topic icons exist... you can never be too sure!
      if (empty($modSettings['messageIconChecks_disable']))
      {
         // First icon first... as you'd expect.
         if (!isset($icon_sources[$row['firstIcon']]))
            $icon_sources[$row['firstIcon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['firstIcon'] . '.gif') ? 'images_url' : 'default_images_url';
         // Last icon... last... duh.
         if (!isset($icon_sources[$row['lastIcon']]))
            $icon_sources[$row['lastIcon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['lastIcon'] . '.gif') ? 'images_url' : 'default_images_url';
      }

      $color_start = !empty($groupcolors[$row['mems_group']]) ? $groupcolors[$row['mems_group']] : '';
      $color_last = !empty($groupcolors[$row['meml_group']]) ? $groupcolors[$row['meml_group']] : '';

      // And build the array.
      $topics[$row['id_topic']] = array(
         'id' => $row['id_topic'],
         'first_post' => array(
            'id' => $row['id_first_msg'],
            'member' => array(
               'name' => $row['firstPosterName'],
               'id' => $row['ID_FIRST_MEMBER'],
               'href' => $scripturl . '?action=profile;u=' . $row['ID_FIRST_MEMBER'],
               'link' => !empty($row['ID_FIRST_MEMBER']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_FIRST_MEMBER'] . '" title="' . $txt['profile_of'] . ' ' . $row['firstPosterName'] . '">' . '<font color="' . $color_start . '">' . $row['firstPosterName'] . '</font>' . '</a>' : $row['firstPosterName']
            ),
            'time' => timeformat($row['firstPosterTime']),
            'timestamp' => forum_time(true, $row['firstPosterTime']),
            'subject' => $row['firstSubject'],
            'preview' => $row['firstBody'],
            'icon' => $row['firstIcon'],
            'icon_url' => $settings[$icon_sources[$row['firstIcon']]] . '/post/' . $row['firstIcon'] . '.gif',
            'href' => $scripturl . '?topic=' . $row['id_topic'] . '.0;topicseen',
            'link' => '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.0;topicseen">' . $row['firstSubject'] . '</a>'
         ),
         'last_post' => array(
            'id' => $row['id_last_msg'],
            'member' => array(
               'name' => $row['lastPosterName'],
               'id' => $row['ID_LAST_MEMBER'],
               'href' => $scripturl . '?action=profile;u=' . $row['ID_LAST_MEMBER'],
               'link' => !empty($row['ID_LAST_MEMBER']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_LAST_MEMBER'] . '">' . '<font color="' . $color_last . '">' . $row['lastPosterName'] . '</font>' . '</a>' : $row['lastPosterName']
            ),
            'time' => timeformat($row['lastPosterTime']),
            'timestamp' => forum_time(true, $row['lastPosterTime']),
            'subject' => $row['lastSubject'],
            'preview' => $row['lastBody'],
            'icon' => $row['lastIcon'],
            'icon_url' => $settings[$icon_sources[$row['lastIcon']]] . '/post/' . $row['lastIcon'] . '.gif',
            'href' => $scripturl . '?topic=' . $row['id_topic'] . ($row['num_replies'] == 0 ? '.0' : '.msg' . $row['id_last_msg']) . ';topicseen#msg' . $row['id_last_msg'],
            'link' => '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . ($row['num_replies'] == 0 ? '.0' : '.msg' . $row['id_last_msg']) . ';topicseen#msg' . $row['id_last_msg'] . '">' . $row['lastSubject'] . '</a>'
         ),
         'new' => $row['isRead'],
         'new_from' => $row['new_from'],
         'new_href' => $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['new_from'] . ';topicseen#new',
         'href' => $scripturl . '?topic=' . $row['id_topic'] . ($row['num_replies'] == 0 ? '.0' : '.msg' . $row['new_from']) . ';topicseen' . ($row['num_replies'] == 0 ? '' : 'new'),
         'link' => '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . ($row['num_replies'] == 0 ? '.0' : '.msg' . $row['new_from']) . ';topicseen#msg' . $row['new_from'] . '">' . $row['firstSubject'] . '</a>',
         'is_sticky' => !empty($modSettings['enableStickyTopics']) && !empty($row['isSticky']),
         'is_locked' => !empty($row['locked']),
         'is_poll' => $modSettings['pollMode'] == '1' && $row['id_poll'] > 0,
         'is_hot' => $row['num_replies'] >= $modSettings['hotTopicPosts'],
         'is_very_hot' => $row['num_replies'] >= $modSettings['hotTopicVeryPosts'],
         'is_posted_in' => false,
         'icon' => $row['firstIcon'],
         'icon_url' => $settings[$icon_sources[$row['firstIcon']]] . '/post/' . $row['firstIcon'] . '.gif',
         'subject' => $row['firstSubject'],
         'pages' => $pages,
         'replies' => $row['num_replies'],
         'views' => $row['num_views'],
         'board' => array(
            'id' => $row['id_board'],
            'name' => $row['bname'],
            'href' => $scripturl . '?board=' . $row['id_board'] . '.0',
            'link' => '<a href="' . $scripturl . '?board=' . $row['id_board'] . '.0">' . $row['bname'] . '</a>'
         )
      );

      determineTopicClass($topics[$row['id_topic']]);
   }
   $smcFunc['db_free_result']($request);

   if (!empty($modSettings['enableParticipation']) && !empty($topic_ids))
   {
      $result = $smcFunc['db_query']("", "
         SELECT id_topic
         FROM ".$db_prefix."messages
         WHERE id_topic IN (" . implode(', ', $topic_ids) . ")
            AND id_member = {int:id_member}",
         array('id_member' => $user_info['id']));
      while ($row = $smcFunc['db_fetch_assoc']($result))
      {
         if (empty($topics[$row['id_topic']]['is_posted_in']))
         {
            $topics[$row['id_topic']]['is_posted_in'] = true;
            $topics[$row['id_topic']]['class'] = 'my_' . $topics[$row['id_topic']]['class'];
         }
      }
      $smcFunc['db_free_result']($result);
   }

   }

if (!empty($topics))
    {
    echo '
        <div class="tborder" ', $context['browser']['needs_size_fix'] && !$context['browser']['is_ie6'] ? 'style="width: 100%;margin:0px;"' : 'style="margin:0px;"', '>
            <table border="0" width="100%" cellspacing="1" cellpadding="1" class="bordercolor">
                <tr>';

    echo '
                    <td class="titlebg" colspan="7">', $heading, '</td>';
    echo '
                </tr>';

    echo '
            <tr class="titlebg">
               <td width="10%" colspan="2"> </td>
               <td>', $txt['subject'], '
               </td><td width="14%">', $txt['posted_by'], '
               </td><td width="4%" align="center">', $txt['replies'], '
               </td><td width="4%" align="center">', $txt['views'], '
               </td><td width="24%">', $txt['last_post'], '
               </td>
            </tr>';

   foreach ($topics as $topic)
   {
      // Do we want to seperate the sticky and lock status out?
      if (!empty($settings['seperate_sticky_lock']) && strpos($topic['class'], 'sticky') !== false)
         $topic['class'] = substr($topic['class'], 0, strrpos($topic['class'], '_sticky'));
      if (!empty($settings['seperate_sticky_lock']) && strpos($topic['class'], 'locked') !== false)
         $topic['class'] = substr($topic['class'], 0, strrpos($topic['class'], '_locked'));

      echo '
            <tr>
               <td class="windowbg2" valign="middle" align="center" width="6%">
                  <img src="' . $settings['images_url'] . '/topic/' . $topic['class'] . '.gif" alt="" />
               </td><td class="windowbg2" valign="middle" align="center" width="4%">
                  <img src="' . $topic['first_post']['icon_url'] . '" alt="" align="middle" />
               </td><td class="windowbg' , $topic['is_sticky'] && !empty($settings['seperate_sticky_lock']) ? '3' : '' , '" width="48%" valign="middle">' , $topic['is_locked'] && !empty($settings['seperate_sticky_lock']) ? '
                  <img src="' . $settings['images_url'] . '/icons/quick_lock.gif" align="right" alt="" style="margin: 0;" />' : '' , $topic['is_sticky'] && !empty($settings['seperate_sticky_lock']) ? '
                  <img src="' . $settings['images_url'] . '/icons/show_sticky.gif" align="right" alt="" style="margin: 0;" />' : '', $topic['first_post']['link'];
               if ($topic['new'] == 0)
                  {
                  echo '<a href="', $topic['new_href'], '"> <img src="', $settings['images_url'], '/', $context['user']['language'], '/new.gif" alt="', $txt['seconds_with'], '" /></a>';
                  }
                echo '
               <span class="smalltext">', $topic['pages'], '<br>', $txt['in'], ' ', $topic['board']['link'], '</span></td>
               <td class="windowbg2" valign="middle" width="14%">
                  ', $topic['first_post']['member']['link'], '</td>
               <td class="windowbg" valign="middle" width="4%" align="center">
                  ', $topic['replies'], '</td>
               <td class="windowbg" valign="middle" width="4%" align="center">
                  ', $topic['views'], '</td>
               <td class="windowbg2" valign="middle" width="22%">
                  <a href="', $topic['last_post']['href'], '"><img src="', $settings['images_url'], '/icons/last_post.gif" alt="', $txt['last_post'], '" title="', $txt['last_post'], '" style="float: right;" /></a>
                  <span class="smalltext">
                     ', $topic['last_post']['time'], '<br />
                     ', $txt['by'], ' ', $topic['last_post']['member']['link'], '
                  </span>
               </td>
            </tr>';
   }

    echo '</table></div>';

    }
   else
       echo '<b><u>'.$heading.'<br><br>No Topics Match Search Criteria</u></b>';

Ken.

Tried it on my test site and live site and on both it gives this error when trying to save the code to the block:
QuoteThe database value you're trying to insert does not exist: user_id
" If everything seems under control, you're not going fast enough." - Mario Andretti
Yesterday When I was Young.

Mick

Oh wow, thanx for trying ;)


As Ken said, there is an error :o

IchBin

Aren't you using another portal bluedevil? Does this happen in that portal too?

I don't know why it's throwing that error when it tries to save the block code. It shouldn't be trying to execute the statement when it saves the code. I'll try to figure it out later today or during a work break.

Mick

Yes i use another portal.

...but also i have tp98 in my old test site and the following shows after saving.

Fatal error: Function name must be a string in /home/********/public_html/devsite/Sources/Load.php(1742) : eval()'d code(209) : eval()'d code on line 243

Mick

#5
Nevermind my previous post.  I just realized is smf 1.1.x


Anywho,  in my other portal with rc2,   it shows "nothing" after saving.   It cuts out the page, meaning it has an error but no indication what kind of error. :o


Unless im doing it wrong...... i added the entire code in a php block and tried in a php page too.

ZarPrime

Ichbin,

Also, $ID_MEMBER in your global declaration is no longer a valid variable but I don't think that has anything to do with the error.  I'm pretty sure that it can just be removed.  I see where the error is coming from but it is confusing me too.

ZarPrime

bloc

$ID_MEMBER is longer filled in SMF2. So you need to set that somewhere, on top maybe?

Like:

$ID_MEMBER = $context['user']['id'];

IchBin

#8
Yeah, I just changed it to user_info['id'] instead. Thanks for the heads up guys. I think this code is working for me now. Updating my first post.

--edit--

oops... It would seem there's quite a few variables that need to be changed for the $txt language strings. I'll have to look at those later.

ZarPrime

Yeah, it's a pretty complicated bit of code.  I'm going to look at it again this weekend if I can find the time but no promises. ;)

ZarPrime

This website is proudly hosted on Crocweb Cloud Website Hosting.