Topic: New Messages on index.php

Private Messaging System

I want to show if the user has any new PM's in his startpage, I'm using this code:

<?php

define('PUN_TURN_OFF_MAINT', 1);
define('PUN_QUIET_VISIT', 1);

$pun_root = './forum/';
@include $pun_root.'include/common.php';

// If PUN isn't defined, config.php is missing or corrupt
if (!defined('PUN'))
exit('config.php doesn\'t exist or is corrupt. Please run install.php to install PunBB first.');
?>


<?php
if ($cookie['is_guest'])
{
include "loginBB.php";
}
else
{
echo 'Welcome '.pun_htmlspecialchars($cur_user['username']);

New Messages here.
}

?>

I would like to display it like this:
Example:

You have 3 new messages in your inbox

Then of course with a link to his/hers inbox.



I just saw that you have made the same on your site. (http://www.cactuz.nu/forum)

Here is my profile status:

madjedo

0 new messages
0 new gb entries
0 new friendships
1 new forum posts

Supervise

Logout

Re: New Messages on index.php

I tried this:

require($pun_root.'pms/header_new_messages.php');

But i got this:

Warning: Unable to access ./forum/pms/header_new_messages.php in /customers/art4gamers.net/art4gamers.net/httpd.www/sheep.php on line 193

Fatal error: Failed opening required './forum/pms/header_new_messages.php' (include_path='.:/usr/share/pear:/usr/share/php/PEAR') in /customers/art4gamers.net/art4gamers.net/httpd.www/sheep.php on line 193

Re: New Messages on index.php

Is any1 gonna help me?

Re: New Messages on index.php

First, the errormessage mentions the file sheep.php. What's that? That line should be in header.php...

Second, are you sure header_new_messages.php exists in the pms-directory?

Third, if it exists, does it have the right permissions so the webserver can open it?

5 (edited by madjedo 2004-04-09 09:13)

Re: New Messages on index.php

Chacmool wrote:

First, the errormessage mentions the file sheep.php. What's that? That line should be in header.php...

I mean, if the user have had any new PM's, it should be in art4gamers.net startpage not in the art4gamers.net/forum

Understand?

*sheep.php is my test file

Re: New Messages on index.php

I think he wants it to be like this, on the index.php page on his site, not the forum index.php:

Code wrote:

<?php
if ($cookie['is_guest'])
{
   //login here
}
else
{
   //You have 2 new PM's

}
?>

I don't know the code, havn't installed the PM script... yet. But i will, I would like the code by hand then smile

Re: New Messages on index.php

madjedo wrote:
Chacmool wrote:

First, the errormessage mentions the file sheep.php. What's that? That line should be in header.php...

I mean, if the user have had any new PM's, it should be in art4gamers.net startpage not in the art4gamers.net/forum

Understand?

*sheep.php is my test file

Ahh, I see! I thought you hade problems in the forums :) It's a good idea though, I'll have a look at it tonight or tomorrow.

Re: New Messages on index.php

Actually i don't think you need to.

U can just contact the man behind http://www.cactuz.nu/ because he has already made it.

Re: New Messages on index.php

I contacted Jansson for help, but not even he could help me...

I have chmoded common.php and some other PM files to 777, and I am using the right code! Why isn't it working?

Re: New Messages on index.php

I've tried to solve it now, and the code below works (almost :P) fine for me:

<?php
    
    define('PUN_TURN_OFF_MAINT', 1);
    define('PUN_QUIET_VISIT', 1);
    
    $pun_root = './punbb-pms/';
    @include $pun_root.'include/common.php';
    
    // If PUN isn't defined, config.php is missing or corrupt
    if (!defined('PUN'))
        exit('config.php doesn\'t exist or is corrupt. Please run install.php to install PunBB first.');

    if ($cookie['is_guest']){

        echo "Guest user detected, please login instead";

    }

    else{

        echo 'Welcome '.pun_htmlspecialchars($cur_user['username']);

        require($pun_root.'pms/header_new_messages.php');
        echo $tpl_temp;
    
    }
    
?>

The problem is that $tpl_temp points to the url "href='message_list.php'", so the link don't really work. I can't help you with the problem where you can't include the file, unless you give us the url to the forum. I'm quote sure you have som path problem somewhere.

11 (edited by madjedo 2004-04-19 16:15)

Re: New Messages on index.php

Aiight i Fixed it, but where do i change the text: "There are new messages" - i cant find the file...

Re: New Messages on index.php

It should be in lang-directory named: en_pms.php.