SEO-Board: Free, Fast and Search Engine Optimization Friendly Forum Script
»User: »Password:   Remember Me? 
SEO-Board Forum Software Community / General / Support / Addon Post Not Working
Posted:  11 May 2005 22:57
Hi I was trying to put the addon posts to my front page. I've done it successfully already on one site, but for some reason I can't get it to work now.
Here's what I did.
I put the htm files into the skin folder.
I put the lastposts_addon.php in the main message board folder.

Put this line of code on a php page <?php DEFINE ('SEO-BOARD', true); include('lastposts_addon.php');?>

And then tested it. http://www.spiderman-web.com/spiderman-messag ... and I get nothing.
The board is working ok http://www.spiderman-web.com/spiderman-messag ... just can't get the add on to work.  I was going to use a ssi include to add it to my front page.

Did I forget a step?

The only thing that I know is different is I downloaded the latest version of the board before installing. Thanks for your help.
Posted:  11 May 2005 23:17
Usually problems with the addon are path related or an error must show up. Real strange. First, see if the addon is called correctly. Put an echo or print command somewhere on top of the addon to see if its gonna be displayed or remove the define command and see if the addon will complain about it. Next see if the addon connects to mysql by putting a print command after the mysql_connect and mysql_select_db commands.
Next, post what's the result of these here and I'll think about it.
__________________
Are you looking for an SEO Consultant?
Email me: hristo at seo-board dot com
Posted:  12 May 2005 01:55
ok I tried to do what you asked.
1. I put a hello command on the posts.php page and <?php
print("Hello World");?> and it read Hello world

2. I took out DEFINE ('SEO-BOARD', true) and got nothing and I took out just the word DEFINE and got nothing

3. on the http://www.spiderman-web.com/spiderman-messag ... I tried adding that hello line but got nothing. I don't think I got the right code for it though. I'm not an expert on php.

I have a feeling if there's nothing I am supposed to change on the addon pages to connect to my database or if there's nothing I missed then perhaps when you made your most recent change to the script some little bug crept in.

Of course I'm just guessing. I know just enough about php to use it, and that's about it. I can recognize the simple things like connecting commands and so forth, but I'm no expert on writing it.
Posted:  12 May 2005 09:41
I haven't changed anything in the addon. I don't know why but the addon simply does not get executed. If it were then it will complain when you remove the define and if it worked the print would also work.

Please, post the two files.
__________________
Are you looking for an SEO Consultant?
Email me: hristo at seo-board dot com
Posted:  12 May 2005 14:35
Is it possible that something was changed in the seo_options that or other page that might somehow affect the addon?


here's the lastposts_addon.php


<?php

if(!defined('SEO-BOARD'))
{
  die($lang['fatal_error']);
}

error_reporting(E_ALL);
set_magic_quotes_runtime(0);

if (!get_magic_quotes_gpc())
  array_add_slashes($_COOKIE); 

//LAST POSTS ADDON OPTIONS
//exclude some forums from the last posts?
//example $addon_excludeforums = array(2, 4); will exclude topics from forums with IDs 2 and 4 from being shown in last posts
$addon_excludeforums = array(8);
$addon_shownumlastposts = 5; //show how many topics/posts?

require('seo-board_options.php');
require ('./code/functions.php');
require ('./code/skinning.php');
require ("./lang/$lang.php");

@mysql_connect($dbhost, $dbuser, $dbpass) or exit;
@mysql_select_db($dbname) or exit;

$user_id = 0;
$user_name = $lang['guest'];
$user_timezone = $forumtimezone;
$user_lastsession = 0;

if (isset($_COOKIE[$cookiename]))
{
  list($user_id, $user_pass_sha1) = unserialize(stripslashes($_COOKIE[$cookiename]));
  if (!is_numeric($user_id))
    die($lang['fatal_error']);

  $result = mysql_query("SELECT user_timezone, user_lasttimereadpost, user_lastsession FROM {$dbpref}users WHERE user_id='$user_id' AND user_pass='$user_pass_sha1'");
  if (mysql_num_rows($result) != 1)
    $user_id = 0;
  else
  {
    $user_row = mysql_fetch_row($result);
    list($user_timezone, $user_last_time_read_post, $user_lastsession) = $user_row;

    $now = time();
    if (($now - $user_last_time_read_post > $visittimeout) && ($user_lastsession != $user_last_time_read_post))
    {
      $user_lastsession = $user_last_time_read_post;
      mysql_query("UPDATE {$dbpref}users SET user_lastsession='$user_lastsession' WHERE user_id='$user_id'");
    }
  }
}

$cell_iterator = 0;
//exclude private to the current user forums + the ones in $addon_excludeforums
$userprivateforums = get_invisible_forums($user_id);
if (!empty($addon_excludeforums))
  $userprivateforums = array_unique(array_merge($userprivateforums, $addon_excludeforums));
 
if (count($userprivateforums)==0)
  $result = mysql_query("SELECT topic_id, topic_title, topic_poster_name, topic_poster_id, topic_lastposter_name, topic_lastposter_id, topic_created_time, topic_lastpost_time, topic_numreplies, topic_numviews, topic_sticky, topic_locked, topic_moved FROM {$dbpref}topics ORDER BY topic_lastpost_time DESC LIMIT $addon_shownumlastposts") or die(mysql_error());
else
{
  $where = 'WHERE forum_id<>'.implode(' AND forum_id<>', $userprivateforums);
  $result = mysql_query("SELECT topic_id, topic_title, topic_poster_name, topic_poster_id, topic_lastposter_name, topic_lastposter_id, topic_created_time, topic_lastpost_time, topic_numreplies, topic_numviews, topic_sticky, topic_locked, topic_moved FROM {$dbpref}topics $where ORDER BY topic_lastpost_time DESC LIMIT $addon_shownumlastposts") or die(mysql_error());
}
if (mysql_num_rows($result) != 0)
{
  $topics_html = array();
  $template_topic = get_template('addon_lastpostscell');
  while($row = mysql_fetch_row($result))
  {
    list($id, $title, $author, $author_id, $lastposter, $lastposter_id, $createdtime, $lastposttime, $num_replies, $num_views, $sticky, $locked, $moved) = $row;
    $topic_link = get_topic_link($id, $title, $num_replies+1, 'topiclink');

    if (($lastposttime > $user_lastsession) && ($lastposter_id != $user_id) && ($user_id != 0))
      if ($createdtime < $user_lastsession) //created before lastsession
        $topic_link = '<sup>'.$lang['new'].'</sup> '.$topic_link;
      else//created after lastsession
        if ($author_id != $user_id)
          $topic_link = '<sup>'.$lang['new'].'</sup> '.$topic_link;
     
    $started_by = $lang['started_by'].' '.$author;     
    $lastpost = $lastposter.'<br>'.format_datetime($lastposttime, $user_timezone);
    array_push($topics_html, eval($template_topic));
    $cell_iterator = 1 - $cell_iterator;   
  }
  $topics_html = implode('', $topics_html);
  print eval(get_template('addon_lastposts'));   
  unset($template_topic);
}

?>


Here's all I have on the posts.php


<?php
print("Hello World");?>
<?php DEFINE ('SEO-BOARD', true); include('lastposts_addon.php');?>
Posted:  12 May 2005 15:33
I think the bug is in the addon and it appears depending on your php configuration. I think I fixed the problem. I've updated lastposts_addon.php.
Download the new zip and use the new version. Just changed 1 line and moved 2 other lines. Hope that'll fix it. It's my mistake. Sorry [sad]
__________________
Are you looking for an SEO Consultant?
Email me: hristo at seo-board dot com
Posted:  12 May 2005 17:23
Thanks a bunch works fine now.
Posted:  21 May 2005 07:00
ok ... I've read everything above, but i can't seem to get this last adon working ...

I place files in skins dir

On my index.php it looks like this:

Code:


<?php
echo "Hello";
DEFINE ('SEO-BOARD', true);
include('/forums/lastposts_addon.php');
?>


My forum sits in the /forums dir
'lastposts_addon.php' sits in the /forums dir
the 2 .htm files sit in the /forums/skin dir
I copied and pasted the above code ... nothing

help! :)
__________________
Posted:  21 May 2005 08:56
1. make sure you use the fixed version of the addon
2. try putting a dot as
Code:

include('./forums/lastposts_addon.php');
before /forums/
3. see for any more error messages. You may need to fix some include paths
__________________
Are you looking for an SEO Consultant?
Email me: hristo at seo-board dot com
Posted:  21 May 2005 10:03
thanks ... have downloaded the latest version ...

if I run a test file in the /forums directory - it works ...

if I run the file in the root, I get an error message that says:

Quote:


Warning: main(./code/functions.php): failed to open stream: No such file or directory in /home/midnitej/public_html/forums/lastposts_addon.php on line 19

Warning: main(./code/functions.php): failed to open stream: No such file or directory in /home/midnitej/public_html/forums/lastposts_addon.php on line 19

Fatal error: main(): Failed opening required './code/functions.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/midnitej/public_html/forums/lastposts_addon.php on line 19



my 'seo-board_options.php' file looks like this:

Quote:

$forumhome = 'http://www.oooooo.com/forums/'; //link to forum home
$forumdir = 'http://www.oooooo.com/forums/'; //forum dir without the script file, must end with a '/'
$forumscript = 'http://www.oooooo.com/forums/index.php'; //forum dir + script file



have tried the dot - nogo ....

hmm ... will keep trying
__________________
Posted:  21 May 2005 10:36
Working one:
http://www.midnitejamm.com/forums/test.php

content of this file:
Code:


<?php
DEFINE ('SEO-BOARD', true);
include('lastposts_addon.php');
?>


Not working one:

http://www.midnitejamm.com/test.php

contents of this file:

Code:


<?php
DEFINE ('SEO-BOARD', true);
include('forums/lastposts_addon.php');
?>


Error message I get on this one is:

FATAL ERROR: File not found addon_lastpostscell
__________________
Posted:  21 May 2005 11:31
The addon is written assuming it is in the main forum directory. To make it work in another directory, you may need to fix the include paths and probably put a /skin/ directory within the main dir with the latest posts addon templates in it.
__________________
Are you looking for an SEO Consultant?
Email me: hristo at seo-board dot com
Posted:  21 May 2005 18:56
Hristo

Yes - that did it!!! 

Created a new /skin dir under the root

Working very nice!!!

Thanks - great support!
__________________