TinyPortal

Development => Feedback => Bugs/Errors => Topic started by: morskisrle on February 24, 2008, 12:04:16 AM

Title: Undefined index: ID_MEMBER error
Post by: morskisrle on February 24, 2008, 12:04:16 AM
I get this error every time i go onoto the forum

8: Undefined index: ID_MEMBER
Datoteka: /home/selovese/public_html/Themes/default/TPortal.template.php (main_below sub template - eval?)
Linija: 23

The code is:
<div style="margin-bottom: 4px;">', theme_linktree() , '</div>';

What can be the problem?
Title: Re: Undefined index: ID_MEMBER error
Post by: JPDeni on February 24, 2008, 12:32:53 AM
The error is obviously somewhere before line 23. Many times the error message does not give the line number where the actual problem is.
Title: Re: Undefined index: ID_MEMBER error
Post by: morskisrle on February 24, 2008, 12:48:33 AM
<?php

// Version: 0.9; TPortal



// TPortal template - for frontpage.



function template_main()

{

global $context, $settings, $options, $txt, $scripturl, $modSettings;

// show the linktree

if((isset($context['TPortal']['boardnews'][0]['options']['linktree']) && $context['TPortal']['front_type']!='frontblock') || $context['TPortal']['front_type']=='frontblock')

echo '

<div style="margin-bottom: 4px;">'
, theme_linktree() , '</div>';


This is the whole code before it with the line 23.
Title: Re: Undefined index: ID_MEMBER error
Post by: IchBin on February 24, 2008, 02:52:52 AM
Do you have any custom blocks or articles that use ID_MEMBER?
Title: Re: Undefined index: ID_MEMBER error
Post by: morskisrle on February 24, 2008, 03:03:37 AM
Yeah. Use one custom block with random messages from one topic. It has an ID MEMBER in it.
Title: Re: Undefined index: ID_MEMBER error
Post by: IchBin on February 24, 2008, 04:26:19 AM
Can you post the code in it? I think it should probably have the global $ID_MEMBER in it. :)
Title: Re: Undefined index: ID_MEMBER error
Post by: morskisrle on March 02, 2008, 04:23:43 AM
Sorry, was busy with some stuff..
ok this is the only block with id_member:

global $db_prefix, $scripturl;

$topic_number = 1272.0; // fill in the number of the topic you want to pull your info from

$query = db_query(
      "SELECT *
       FROM {$db_prefix}messages
       WHERE `ID_TOPIC` = $topic_number
       ORDER BY RAND( )
       LIMIT 1", __FILE__, __LINE__);
$row = mysql_fetch_assoc($query);
$row['body'] = parse_bbc($row['body'], $row['smileysEnabled'], $row['ID_MSG']);

// set up your printout
// variables:
// $row['ID_MEMBER']
// $row['posterName']
// $row['body']

echo '
<div style="text-align: center; width: 170px; height: 150px; overflow: auto; margin-top:20%; margin-bottom: 0%;">' . $row['body'] . '<br />';

echo '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['posterName'] . ' </a> '  ;

echo '<a style="color:red;" href="http://seloveselo.com/index.php?topic=1272.msg104#new">Idi na temu</a></div>';

/*sta je bilo ' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '*/


Title: Re: Undefined index: ID_MEMBER error
Post by: IchBin on March 02, 2008, 02:43:22 PM
Judging by the look of your code, if you call a topic or post that doesn't have those fields set you'll get that error.
Title: Re: Undefined index: ID_MEMBER error
Post by: morskisrle on March 04, 2008, 09:11:24 AM
It seems it's ok  now. I've put some test posts in the topic and now i don't get anny errors.