Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    Regular Coder Zangeel's Avatar
    Join Date
    Oct 2007
    Location
    public_html/
    Posts
    638
    Thanks
    17
    Thanked 79 Times in 79 Posts

    help with a phpbb integration (x messages in inbox)

    Hello,

    I'm doing a PHPBB integration with my site. I have a custom members page and I'm using this code:

    PHP Code:
    <?php
    define
    ('IN_PHPBB'true);
    $phpbb_root_path './forum/';
    include(
    $phpbb_root_path 'extension.inc');
    include(
    $phpbb_root_path 'common.'.$phpEx);

    //
    // Start session management
    //
    $userdata session_pagestart($user_ipPAGE_INDEX);
    init_userprefs($userdata);
    //
    // End session management
    //

    if($userdata['session_logged_in'])
    {
    echo(
    'You are logged in');
    }
    else
    {
    echo(
    'You are a guest');
    }

    ?>
    I want to add in the "You are logged in" area, a code to show how many messages are in your inbox.
    I have this code that works fine:

    PHP Code:
    <?php
    if($userdata['session_logged_in']){//logged in

    if ( $userdata['user_new_privmsg'] )//private messages
        
    {
            
    $l_message_new = ( $userdata['user_new_privmsg'] == ) ? $lang['New_pm'] : $lang['New_pms']; 
            
    $l_privmsgs_text sprintf($l_message_new$userdata['user_new_privmsg']); 

            if ( 
    $userdata['user_last_privmsg'] > $userdata['user_lastvisit'] )
            {
                
    $sql "UPDATE " USERS_TABLE "
                    SET user_last_privmsg = " 
    $userdata['user_lastvisit'] . 
                    WHERE user_id = " 
    $userdata['user_id'];
                if ( !
    $db->sql_query($sql) )
                {
                    
    message_die(GENERAL_ERROR'Could not update private message new/read time for user'''__LINE____FILE__$sql);
                }

                
    $s_privmsg_new 1;
                
    $icon_pm $images['pm_new_msg'];
            }
            else
            {
                
    $s_privmsg_new 0;
                
    $icon_pm $images['pm_no_new_msg'];
            }
        }
        else
        {
            
    $l_privmsgs_text $lang['No_new_pm'];

            
    $s_privmsg_new 0;
            
    $icon_pm $images['pm_no_new_msg'];
        }

        if ( 
    $userdata['user_unread_privmsg'] )
        {
            
    $l_message_unread = ( $userdata['user_unread_privmsg'] == ) ? $lang['Unread_pm'] : $lang['Unread_pms']; 
            
    $l_privmsgs_text_unread sprintf($l_message_unread$userdata['user_unread_privmsg']); 
        }
        else
        {
            
    $l_privmsgs_text_unread $lang['No_unread_pm'];
        }

    }
    // User Logged In

    ?>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    <title>Site Name</title>
    <?php
    if ( !empty($userdata['user_popup_pm']) ){
    ?>
    <script language="Javascript" type="text/javascript">
    <!--
        if (<?php echo $s_privmsg_new ?>)
        {
            window.open('<?php echo "$phpbb_root_pathprivmsg.".$phpEx."?mode=newpm" ?>', '_phpbbprivmsg', 'HEIGHT=225,resizable=yes,WIDTH=400');;
        }
    //-->
    </script>

    <?php
    }
    ?>
    <body>

    <?php
    if($userdata['session_logged_in']){
    ?>
            <a href="<?php echo $phpbb_root_path2 ?>privmsg.php?folder=inbox"><?php echo $l_privmsgs_text ?> in your Inbox</a><br><br>



    <?php
    }

    ?>
    But I can't just insert it in the brackets without getting errors, so how can I add this into it?
    Last edited by Zangeel; 11-04-2007 at 04:03 AM.


 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •