MyBB Community Forums

Full Version: [Tutorial] Basic Site-Forum Integration
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7
I've inserted the code for the user control panel thingy. The code works, BUT!, I get this error:

Warning: chdir() [function.chdir]: No such file or directory (errno 2) in /home/manne/public_html/p_index.php on line 10

I checked what is on line 10 which is the following:
Code:
define("IN_MYBB", 1);

It's part of a code that's being used to retreive posts as news items on my website.

So the main website code looks like this:
Code:
<head>
<script>
function submitted()
{
setTimeout("refresh()",6000);
}
function refresh()
{
var sURL = unescape(window.location.pathname);
window.location.href = sURL;
}
</script>

<link rel="stylesheet" href="tangodown.css">

etc. etc. until
[/head]
<?php
$rel = "forum/"; // The directory to your forum--relative to this file's location; include ending slash
chdir($rel);
define('IN_MYBB', 1);
require("./global.php");
?>

Now I'm using this together with a different news post-retreive thing which uses the following code (p_index.php):

Code:
<?php

    $fid = 2;
    $limit = 5;
    $forumpath = 'forum/';

    chdir($forumpath);
    define("IN_MYBB", 1);
    require('./global.php');
    require_once MYBB_ROOT."inc/class_parser.php";
    $parser = new postParser;
    chdir('../');
?>
<span class="forumtext">
<?php
    
    $query = $db->simple_select(TABLE_PREFIX.'threads', '*', "fid='{$fid}' ORDER BY tid DESC LIMIT {$limit}");
    if($db->num_rows($query) > 0)
    {
        while($row = $db->fetch_array($query))
        {
            $query2 = $db->simple_select(TABLE_PREFIX.'posts', '*', "pid='{$row['firstpost']}'");
            $row2 = $db->fetch_array($query2);
            
            $date = my_date($mybb->settings['dateformat'], $row2['dateline'], "", 1);
            $time = my_date($mybb->settings['timeformat'], $row2['dateline'], "", 1);

            $options = array(
                            'allow_html' => 'no',
                            'filter_badwords' => 'yes',
                            'allow_mycode' => 'yes',
                            'allow_smilies' => 'yes',
                            'nl2br' => 'yes',
                            'me_username' => 'yes'
                            );
            $message = $parser->parse_message($row2['message'], $options);
            echo("<a href=\"{$forumpath}showthread.php?tid={$row['tid']}\">{$row['subject']}</a> <br />");
        echo("Door <a href=\"{$forumpath}member.php?action=profile&uid={$row2['uid']}\">{$row2['username']}</a> op {$date}");
            echo("<br /><br />");
            echo("{$message}<br /><br />");
        echo("<a href=\"{$forumpath}showthread.php?tid={$row['tid']}\">{$row['replies']} Reacties</a>");
            echo("<hr />");
            echo("<br /><br />");
        }
    }
    else
    {
        echo 'Nothing to display.';
    }

?>

Could it be that the combination of these scripts create the error? I thought it might be because 2 times the code defines IN_MYBB but deleting one row doesn't work..
Can anyone help?
I have in root my portal (which i want to integrate with mybb) and in /forums/ i have mybb.

I put the
Code:
define("IN_MYBB", 1);
// set the path to your forums directory here (without trailing slash)
$forumdir = "/forums";

// end editing

$change_dir = "/forums";

if(!@chdir($forumdir) && !empty($forumdir))
{
    if(@is_dir($forumdir))
    {
        $change_dir = $forumdir;
    }
    else
    {
        die("\$forumdir is invalid!");
    }
}

require_once $change_dir."/global.php";
but when i print the $mybb->user i take:
Code:
Array ( [usergroup] => 1 [username] => [uid] => 0 [displaygroup] => 1 [lastvisit] => 1220098510 [ismoderator] => )

and of course nothing is working.
is this also possible whit a forum in a http://forum.mysite.com url?
can someone confirm if this works with 1.4? Smile Thanks!
Can someone help me put newest member Today's top poster and Most popular forum into the stats bit,

so making

$user_result = mysql_query("SELECT COUNT(*) as count FROM ".$prfx."users");
$user_count = mysql_fetch_array($user_result);
$user_count = $user_count["count"];

for each one, im not sure how as im new to the mysql query stuff =[
*BUMP*

And other question,

should the login form one you press the login button change to list the change email, avatar ect?

Mine isnt doing this ;[
it just logs the user in and goes straight to the forum
is there a way to make this work with 1.6?

i'm tryin to get it to pull the latests posts.

it doesnt pull the data or render. all i get is "by" x5 .
http://www.mjgz.com/test.php

The database info is correct or else i'd get an error instead. anyone know how to get this to work? Pretty super please?
thanks
GREAT! now somebody makes a tutorial on integrating.

NY insurance agency
Can anyone help me please? it wont render or create the text.
Pages: 1 2 3 4 5 6 7
Reference URL's