PHPBB3 Forum feed on external page for non-authenticated users -
i trying integrate forum feeds of phpbb3 forum external frontpage.
for i'm using illustration phpbbwiki : here code
my problem works if user authenticated on forum allready, user see topics open invitee users, instead of phpbb default (blank-)page.
in case using ajax homecoming topics in json, should not matter problem here.
it know if achievable within scope of phpbb able deliver , start looking if more complicated problem.
if simple matter of grateful help.
thank you!
update
the sql statement retrieval of posts not created, because user not seem have read permissions. conditional fails (funnction: create_where_clauses) :
// if type forum, check create sure user has read permissions else if( $type == 'forum_id' && $auth->acl_get('f_read', $id_check) )
where id_check current forum_id.
here part of user info object:
["user_id"] => string(1) "1" ["user_type"]=> string(1) "2" ["group_id"] => string(1) "1"
this user in guests grouping , type ignore default. i'have tried setting user_type 0=normal - no avail.
as normal visitor on phpbb3 forum can read open forums , wonder why generic invitee user cannot access forums.
update , sollution
i want give thanks reply brought me on track again. have searchted endlessly sollution in depths of phpbbs user management when original error made dumb copy/paste problem...
$forum_id = array(2, 5); $forum_id_where = create_where_clauses($forum_id, 'forum'); $topic_id = array(20, 50); $topic_id_where = create_where_clauses($topic_id, 'topic');
these 2 lines taken tutorial , still in place when trying retrieve info "all" forums , topics. incidentally forum id's open registered users , closed non-authenticated users. when lifiting above content restrictions script 1 time again performs should be.
so 1 time again - goes andy.
the blank page because don't have external_body.html
file in style/prosilver/templates
directory.
a basic external_body.html
this. obviously, you'll have integrate home page's theme.
<!-- begin announcements --> title: {announcements.topic_title}<br /> post author: {announcements.post_author}<br /> post date: {announcements.post_date}<br /> lastly post text: {announcements.post_text}<br /> post link: {announcements.post_link} <!-- end announcements -->
then, using file provided battye of phpbb.com mod team, , putting in root of forum, can show recent posts.
external_page.php
<?php /* * description: illustration file displaying latest posts , topics * battye (for phpbb.com mod team) * september 29, 2009 * modified stackoverflow question: http://stackoverflow.com/questions/14723578/phpbb3-forum-feed-on-external-page-for-non-authenticated-users */ define('in_phpbb', true); $phpbb_root_path = (defined('phpbb_root_path')) ? phpbb_root_path : './'; $phpex = substr(strrchr(__file__, '.'), 1); include($phpbb_root_path . 'common.' . $phpex); include($phpbb_root_path . 'includes/bbcode.' . $phpex); include($phpbb_root_path . 'includes/functions_display.' . $phpex); // start session management $user->session_begin(); $auth->acl($user->data); $user->setup('viewforum'); $search_limit = 5; // ----- alter between here ----- $posts_ary = array( 'select' => 'p.*, t.*, u.username, u.user_colour', 'from' => array( posts_table => 'p', ), 'left_join' => array( array( 'from' => array(users_table => 'u'), 'on' => 'u.user_id = p.poster_id' ), array( 'from' => array(topics_table => 't'), 'on' => 'p.topic_id = t.topic_id' ), ), 'where' => $db->sql_in_set('t.forum_id', array_keys($auth->acl_getf('f_read', true))) . ' , t.topic_status <> ' . item_moved . ' , t.topic_approved = 1', 'order_by' => 'p.post_id desc', ); $posts = $db->sql_build_query('select', $posts_ary); $posts_result = $db->sql_query_limit($posts, $search_limit); while( $posts_row = $db->sql_fetchrow($posts_result) ) { $topic_title = $posts_row['topic_title']; $post_author = get_username_string('full', $posts_row['poster_id'], $posts_row['username'], $posts_row['user_colour']); $post_date = $user->format_date($posts_row['post_time']); $post_link = append_sid("{$phpbb_root_path}viewtopic.$phpex", "p=" . $posts_row['post_id'] . "#p" . $posts_row['post_id']); $post_text = nl2br($posts_row['post_text']); $bbcode = new bbcode(base64_encode($bbcode_bitfield)); $bbcode->bbcode_second_pass($post_text, $posts_row['bbcode_uid'], $posts_row['bbcode_bitfield']); $post_text = smiley_text($post_text); $template->assign_block_vars('announcements', array( 'topic_title' => censor_text($topic_title), 'post_author' => $post_author, 'post_date' => $post_date, 'post_link' => $post_link, 'post_text' => censor_text($post_text), )); } // --- , here --- page_header('external page'); $template->set_filenames(array( 'body' => 'external_body.html' )); page_footer(); ?>
if don't want in root of forum, need modify line utilize appropriate path point root of forum:
$phpbb_root_path = (defined('phpbb_root_path')) ? phpbb_root_path : './';
the 2 lines indicating alter block of code heart of gets displayed. above, i've posted example 4 supplied link. replacing entire block of code other examples work well.
finally, may need clear cache acp when create template changes.
phpbb3
No comments:
Post a Comment