abonnement Unibet Coolblue Bitvavo
  vrijdag 27 juni 2003 @ 18:41:41 #1
36043 Inspiration
flame attraction
pi_11417449
Ik heb een phpBB forum in combinatie met Ez Board, alles werkt goed enzo maar ik heb een vraagje over het ophalen van berichten van diverse fora naar de portal. (De nieuwsfunctie op het portal).
Ik heb 2 newsfora met mededelingen, waarvan er 1 openbaar is (#3) en 1 prive moet zijn (#4) (voor members only dus)
Dit ziet er als volgt uit:
php:
<?
// Hoeveelheid nieuws op portal
$CFG['number_of_news'] = '5';

// Lengte van nieuws
$CFG['news_length'] = '200';

// Nieuws bron forum ID: scheid met comma voor meerdere forums, bijv. '1,2,5'
$CFG['news_forum'] = '3,4';
?>

Het nieuws wordt dus opgehaald vanaf 3 en 4 zodat of je nu ingelogd bent of niet, altijd ook de private (#4) mededelingen zou kunnen lezen.
Ik wil graag dat als je ingelogd bent, nummer 3 en 4 kan lezen. En als je een gast bent dat je dan alleen 3 kan lezen.
Dit klinkt als een aanvraag van uren coden, maar volgens mij valt dit wel mee want een "recent topics" gedeelte werkt namelijk wel zoals ik dat zou willen, namelijk dat je ingelogd moet zijn om de private fora te kunnen lezen.

gedeelte voor mededeling forum:

php:
<?
//
// Haal berichten van mededeling forum op
//
if(!isset($HTTP_GET_VARS['article']))
{
    
$template->assign_block_vars('welcome_text', array());

    
$fetchposts phpbb_fetch_posts($CFG['news_forum'], $CFG['number_of_news'], $CFG['news_length']);

    for (
$i 0$i count($fetchposts); $i++)
    {
        if( 
$fetchposts[$i]['striped'] == )
        {
            
$open_bracket '[ ';
            
$close_bracket ' ]';
            
$read_full $lang['Read_Full'];
        }
        else
        {
            
$open_bracket '';
            
$close_bracket '';
            
$read_full '';
        }

        
$template->assign_block_vars('fetchpost_row', array(
            
'TITLE' => $fetchposts[$i]['topic_title'],
            
'POSTER' => $fetchposts[$i]['username'],
            
'TIME' => $fetchposts[$i]['topic_time'],
            
'TEXT' => $fetchposts[$i]['post_text'],
            
'REPLIES' => $fetchposts[$i]['topic_replies'],
            
'U_VIEW_COMMENTS' => append_sid('viewtopic.' $phpEx '?t=' $fetchposts[$i]['topic_id']),
            
'U_POST_COMMENT' => append_sid('posting.' $phpEx '?mode=reply&amp;t=' $fetchposts[$i]['topic_id']),
            
'U_READ_FULL' => append_sid('portal.' $phpEx '?article=' $i),
            
'L_READ_FULL' => $read_full,
            
'OPEN' => $open_bracket,
            
'CLOSE' => $close_bracket)
        );
    }
}
else
{
    
$fetchposts phpbb_fetch_posts($CFG['news_forum'], $CFG['number_of_news'], 0);

    
$i intval($HTTP_GET_VARS['article']);

    
$template->assign_block_vars('fetchpost_row', array(
        
'TITLE' => $fetchposts[$i]['topic_title'],
        
'POSTER' => $fetchposts[$i]['username'],
        
'TIME' => $fetchposts[$i]['topic_time'],
        
'TEXT' => $fetchposts[$i]['post_text'],
        
'REPLIES' => $fetchposts[$i]['topic_replies'],
        
'U_VIEW_COMMENTS' => append_sid('viewtopic.' $phpEx '?t=' $fetchposts[$i]['topic_id']),
        
'U_POST_COMMENT' => append_sid('posting.' $phpEx '?mode=reply&amp;t=' $fetchposts[$i]['topic_id'])
        )
    );
}
//
// BEEINDIG: Haal mededelingen op
//
?>

Gedeelte voor recente topics
php:
<?
//
// Recente onderwerpen
//
$sql "SELECT * FROM "FORUMS_TABLE " ORDER BY forum_id";
if (!
$result $db->sql_query($sql))
{
    
message_die(GENERAL_ERROR'Could not query forums information'''__LINE____FILE__$sql);
}
$forum_data = array();
while( 
$row $db->sql_fetchrow($result) )
{
    
$forum_data[] = $row;
}

$is_auth_ary = array();
$is_auth_ary auth(AUTH_ALLAUTH_LIST_ALL$userdata$forum_data);

if( 
$CFG['exceptional_forums'] == '' )
{
    
$except_forum_id '\'start\'';
}
else
{
    
$except_forum_id $CFG['exceptional_forums'];
}

for (
$i 0$i count($forum_data); $i++)
{
    if ((!
$is_auth_ary[$forum_data[$i]['forum_id']]['auth_read']) or (!$is_auth_ary[$forum_data[$i]['forum_id']]['auth_view']))
    {
        if (
$except_forum_id == '\'start\'')
        {
            
$except_forum_id $forum_data[$i]['forum_id'];
        }
        else
        {
            
$except_forum_id .= ',' $forum_data[$i]['forum_id'];
        }
    }
}
$sql "SELECT t.topic_id, t.topic_title, t.topic_last_post_id, t.forum_id, p.post_id, p.poster_id, p.post_time, u.user_id, u.username
        FROM " 
TOPICS_TABLE " AS t, " POSTS_TABLE " AS p, " USERS_TABLE " AS u
        WHERE t.forum_id NOT IN (" 
$except_forum_id ")
            AND t.topic_status <> 2
            AND p.post_id = t.topic_last_post_id
            AND p.poster_id = u.user_id
        ORDER BY p.post_id DESC
        LIMIT " 
$CFG['number_recent_topics'];
if (!
$result $db->sql_query($sql))
{
    
message_die(GENERAL_ERROR'Could not query recent topics information'''__LINE____FILE__$sql);
}
$number_recent_topics $db->sql_numrows($result);
$recent_topic_row = array();
while (
$row $db->sql_fetchrow($result))
{
    
$recent_topic_row[] = $row;
}
for (
$i 0$i $number_recent_topics$i++)
{
    
$template->assign_block_vars('recent_topic_row', array(
        
'U_TITLE' => append_sid("viewtopic.$phpEx?" POST_POST_URL '=' $recent_topic_row[$i]['post_id']) . '#' .$recent_topic_row[$i]['post_id'],
        
'L_TITLE' => $recent_topic_row[$i]['topic_title'],
        
'U_POSTER' => append_sid("profile.$phpEx?mode=viewprofile&amp;" POST_USERS_URL "=" $recent_topic_row[$i]['user_id']),
        
'S_POSTER' => $recent_topic_row[$i]['username'],
        
'S_POSTTIME' => create_date($board_config['default_dateformat'], $recent_topic_row[$i]['post_time'], $board_config['board_timezone'])
        )
    );
}
//
// BEEINDIG - Recente onderwerpen
//
?>

Dus hoe zou ik dat inlog "mechanisme" van recente topics kunnen implanteren in het mededelingenblok op mijn portal?

Duizend maal dank voor het eventuele helpen

abonnement Unibet Coolblue Bitvavo
Forum Opties
Forumhop:
Hop naar:
(afkorting, bv 'KLB')