Why add a forum to your blog?
Note : Whilst this post attempts to stay as non-technical as possible it's a pretty technical exercise to get a blog to act like a forum.
I'll happily answer any technical questions you may have, but I will just point you to google if you ask me shit like "how can I change the font size on links ?"
Lots of people ask how they can integrate their b2evolution blog with [insert name of forum software]. They're usually told that it's a bitch to synchronise the user logins and profiles as you have to understand the core code of both applications to be able to hack in all the stuff you need .... I know, because I once integrated SMF with a blog install .... it never survived beyond the first upgrade 
So I asked myself "Why would you want to integrate a forum with your blogs?", I don't mean "why would you want a forum", there's loads of good reason .... and millions of crap ones .... I don't even mean "why would you want to integrate them" having a single login kinda answers that one. What I mean is "why use forum software at all?". When it comes down to it the main difference between a blogs and forums is how they present there data, otherwise they're pretty much the same. Both have users, both have profiles, both have groups and permissions, both allow posts ( threads ) and comments ( replies ), both have smilies (
) and some version of [bbcode] ... can you see where this is going?
Forget integration, enhance your blog instead
Instead of trying to integrate a forum with your blog, and then having to redo all that hard work every time either application is upgraded, take advantage of the "multi-user, multi-blog" aspect of b2evolution and use one of your blogs to be a forum ... or use several! Single sign in, full groups and permissions, and smilies
, multiple forums and sub-forums, and no need to "re-hack the core" on every upgrade! It's really not that difficult ... hell I'm blonde and I managed ... Having said that, unlike the rest of our work, this is not as simple as "upload this plugin/widget and press 'install'", so if that's the limits of your abilities then you may as well stop reading now
Requirements
To add a blogrum to your blogs you're going to need a few things before you start :
- AstonishMe's Blogrum Plugin
- A blogrum user, who will be the "owner" of all your blogrums ( it'll make sense )
- An aware skin
Preparing for your blogrum(s)
Lets start with the easy bits, first off all you need to create a new group to hold your blogrum user, this group needs absolutely minimal everything ( see screen shot ), no admin access, no files, stats ... no anything .... all we need is a unique user ID that can then be used to tag a blog as a blogrum. I was really imaginative and called my group "blogrum stuff", you can call yours whatever you want.
Once you've created your group you need to add a single user to it, once again I was dead imaginative and I called my user "blogrum". Set the users level to zero and untick everything except validated email ( see screen shot ), and give them some suitably random password like "sdhfciuowey6f8w34yr8746238823" ( don't use that one though huh
), press save and make a note of their user ID, you're going to need it in a minute
Ok, so now you have a blogrum group that contains a single blogrum user and all settings have been locked down to a minimum, it's time to install the blogrum plugin and start creating your shiny new blogrums.
Creating your blogrums
You're all set to start creating your blogrums, hooray, the first thing you need to do is to meander over to your plugins tab and install the Blogrum plugin. Once you've done that then meander into it's settings and slap in the user ID of the blogrum user that you created in the previous step. That's about all you need to do with the settings, the rest is down to creating blogs and a fancy skin. Lets start with creating a single blogrum .... just to break you in gently
.... meander over to your blogs tab and hit "create a shiny new blog", call it whatever you like ... in keeping with my imaginative ways my main one is called "blogrums" .... the most important thing is that you need to enter the blogrum username as the blog owner, and you need to change the "order by" to "date modified" ( see screen shot ), pick your skin of choice, change your url settings and all the other stuff to suit your preferences
Due to the fact that having a guest account seriously screws around with my anti-spam measures I decided to remove that ability from the blogrum plugin .... if you want guest accounts then you'll have to code them yourself .... this means that you need to add every group you want to have access as blog members, you also need to give them posting rights if you want them to be able to start new threads. The good news is that this allows you to have private blogrums for groups of your choice. If your in any doubt about groups and permissions then I advise that you either read the b2evolution manual or ask on their forums .... one word of advice, if you allow a group/user editing rights for comments then they can edit anybodies comments 
Now what?
That's pretty much it, you now have blogrums where the posts are ordered by date modified and new comments to posts will automatically update the date modified, which is pretty much how a forum displays its data huh? ... now all you really need is a skin that can display your blogrums in a forum like manner. This basically means that you just list post titles instead of full posts and link them to the full post including comments ... not really a challenge
.... the hard part is when you want sub-blogrums .... but I'm getting a smidge ahead of myself 
To make life a lot easier for skinners, the blogrum plugin adds a flag to $Blog which allows them to detect if a blog is a normal blog or if it's a blogrum blog. I personally use this to change the "skin includes" for the various values of $disp without trying to merge shedloads of various code differences into my normal skins pages. An example of how it's coded is as follows :
PHP:
| <?php |
| if( !empty( $Blog->isBlogrum ) ) |
| { |
| $disp_array = array( |
| 'disp_page' => '_blogrum.page.disp.php', |
| 'disp_posts' => '_blogrum.posts.disp.php', |
| 'disp_profile' => '_blogrum.profile.disp.php', |
| 'disp_single' => '_blogrum.single.disp.php', |
| ); |
| } |
| |
| skin_include( '$disp$', $disp_array ); |
| |
| |
| |
| ?> |
How easy is that? It's about to get a smidge more complicated 
Weren't sub-blogrums mentioned?
In reality every blogrum is a sub-blogrum, just like every blog is a sub blog. What this means is that any blogrum ( or blog ) can be aggregated into another ( parent ) blog ... if you don't know how to aggregate blogs then I once again suggest the b2evo manual, or their forums .... which leads to a smidge of a problem. Unlike an aggregate blog where you show all posts from all the aggregated blogs in post date order, with a forum you normally show the sub-forum "details" and the last post modified ( either by posting or because of a new comment ) ... don't worry, it's all covered 
There's 3 things to worry about when showing aggregate blogrums :
- Listing the aggregate blogrums as "sub-blogrums". ie/ just the name & description of the sub-blogrum, and the last commenter ... hmmmm, time for another $disp page

- Supressing all the aggregated blogrum posts from the parent blogrum. This allows posts in both blogrums .... depending on group/user permissions ( *points to evo manual/forums for information on groups and permission* )
- Killing "Sorry, there are no posts to display", if the aggregate blogrum only has sub-blogrum posts in it
I told you, it's all covered
My _blogrum.posts.disp.php looks a smidge like this :
PHP:
| <?php |
| global $timestamp_max, $timestamp_min, $blog, $DB, $MainList, $Blog; |
| $hideEmpty = false; |
| if( $foo = $Blog->get_setting( 'aggregate_coll_IDs' ) ) |
| { |
| skin_include( '_blogrum.list.disp.php' ); |
| |
| $sql = 'SELECT cat_ID |
| FROM T_categories |
| WHERE cat_blog_ID = '.$Blog->ID; |
| |
| if( $blog_cats = $DB->get_results( $sql, ARRAY_A ) ) |
| { |
| $catFilter = array(); |
| foreach( $blog_cats as $blog_cat ) |
| { |
| $catFilter[] = $blog_cat['cat_ID']; |
| } |
| $hideEmpty = true; |
| } |
| } |
| |
| |
| $MainList = & new ItemList2( $Blog, $timestamp_min, $timestamp_max ); |
| |
| if( !empty( $catFilter ) ) |
| { |
| $MainList->set_filters( array( |
| 'cat_array' => $catFilter, |
| ) ); |
| } |
| $MainList->query(); |
| |
| if( !$hideEmpty || $MainList->result_num_rows ) |
| { |
| |
| echo '<table class="postList"> |
| <tr class="postHeader"><th>'.T_( 'Title' ).'</th><th>'.T_( 'Views' ).'</th><th>'.T_( 'Replies' ).'</th><th>'.T_( 'Author' ).'</th><th>'.T_( 'Last reply' ).'</th></tr>'; |
| |
| |
| display_if_empty( array( 'msg_empty' => '<tr><td colspan="5"><h3>'.T_( 'There are no threads in this blogrum yet' ).'</h3></td></tr>'."\n" ) ); |
| |
| while( $Item = & mainlist_get_item() ) |
| { |
That was easy huh? .... seriously, yer done, you now have blogrums and the rest is down to your skin, and you have custom disps for your blogrum ..... what more could you want? 
This bit is technical 
Until I can be arsed writing a skinning tutorial I'm just going to copy + paste all the various files that make up my blogrum skin. I warn you in advance though, they're coded to take advantage of the AM Profiles plugin as it stands now, the code for the plugin and how you call it in your skin is still in flux and can change at any moment 
_blogrum.feedback.inc.php
PHP:
| <?php |
| if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' ); |
| |
| |
| |
| $params = array_merge( array( |
| 'disp_comments' => true, |
| 'disp_comment_form' => true, |
| 'disp_trackbacks' => true, |
| 'disp_trackback_url' => true, |
| 'disp_pingbacks' => true, |
| 'before_section_title' => '', |
| 'after_section_title' => '', |
| 'comment_list_start' => ''."\n", |
| 'comment_list_end' => ''."\n\n", |
| 'comment_start' => '<tr class="bComment">', |
| 'comment_end' => '</tr>', |
| 'preview_start' => '<tr class="bComment" id="comment_preview">', |
| 'preview_end' => '</tr>', |
| 'comment_template' => '_item_comment.inc.php', |
| 'form_title_start' => '', |
| 'form_title_end' => '', |
| ), $params ); |
| |
| |
| global $c, $tb, $pb; |
| |
| |
| if( ! $Item->can_see_comments() ) |
| { |
| return; |
| } |
| |
| if( empty($c) ) |
| { |
| $params['disp_comments'] = false; |
| $params['disp_comment_form'] = false; |
| } |
| |
| $params['disp_trackbacks'] = false; |
| $params['disp_trackback_url'] = false; |
| $params['disp_pingbacks'] = false; |
| |
| if( ! ($params['disp_comments'] || $params['disp_comment_form'] || $params['disp_trackbacks'] || $params['disp_trackback_url'] || $params['disp_pingbacks'] ) ) |
| { |
| return false; |
| } |
| |
| if( $params['disp_comments'] || $params['disp_trackbacks'] || $params['disp_pingbacks'] ) |
| { |
| |
| $CommentList = & new CommentList( NULL, "'comment'", array('published'), $Item->ID, '', 'ASC' ); |
| |
| echo $params['comment_list_start']; |
| |
| |
| |
| global $odd; |
| $commentCount = 0; |
| while( $Comment = & $CommentList->get_next() ) |
| { |
| ?> |
| <div id="c<?php echo $Comment->ID; ?>" class="commentRow<?php echo ( ( $odd = empty( $odd ) ) ? 'Odd' : 'Even' ); ?>"> |
| |
| <div class="commentAuthor"> |
| <?php |
| $Plugins->trigger_event( 'LinkUserProfile', array( |
| 'user_ID' => $Comment->author_user_ID, |
| 'Object' => $Comment, |
| 'block_start' => '<span class="profileLink">', |
| 'block_end' => '</span>', |
| )); |
| ?> |
| <?php |
| if( $Comment->author_user_ID ) |
| { |
| $Plugins->trigger_event( 'UserAvatar', array( |
| 'user_ID' => $Comment->author_user_ID, |
| )); |
| $UserCache = get_cache('UserCache' ); |
| global $DB; |
| $foo = $UserCache->get_by_ID( $Comment->author_user_ID, false ); |
| echo '<p class="postCount">Posts : '.( $foo->get('num_posts') + $DB->get_var( 'select count(*) from T_comments where comment_status="published" and comment_author_ID='.$foo->ID ) ).'</p>'; |
| |
| $Plugins->trigger_event( 'UserLocation', array( |
| 'user_ID' => $Comment->author_user_ID, |
| )); |
| |
| $Plugins->trigger_event( 'UserTimezone', array( |
| 'block_start' => '<p class="userJoined">Joined : <span>', |
| 'block_end' => '</span></p>', |
| 'display' => true, |
| 'localdatetime' => $foo->get( 'datecreated' ), |
| 'output_format' => '$date$', |
| ) ); |
| |
| } |
| ?> |
| </div> |
| |
| <fieldset class="commentDetails"> |
| <div class="c_tl"> |
| <div class="c_tr"> |
| <div class="c_tm"> |
| <p class="commentDate"> |
| <?php |
| $Comment->edit_link( '', ' · ', get_icon( 'edit', 'imgtag'), '#', 'permalink_right' ); |
| $Comment->delete_link( '', ' · ', get_icon( 'delete', 'imgtag'), '#', 'permalink_right' ); |
| $Plugins->trigger_event( 'UserTimezone', array( |
| 'block_start' => ''.T_( 'Replied on' ).' : <span>', |
| 'block_end' => '</span> #<a href="'.$Comment->get_permanent_url().'" title="'.T_( 'Permanent link to this reply' ).' ">'.( ++$commentCount ).'</a>', |
| 'display' => true, |
| 'localdatetime' => $Comment->get( 'date' ), |
| ) ); |
| ?> |
| </p> |
| </div> |
| </div> |
| </div> |
| |
| <div class="c_ml"> |
| <div class="c_mr"> |
| <?php |
| $Comment->content(); |
| $Plugins->trigger_event( 'UserSignature', array( |
| 'user_ID' => $Comment->author_user_ID, |
| )); |
| ?> |
| </div> |
| </div> |
| |
| <div class="c_bl"> |
| <div class="c_br"> |
| <div class="c_bm"> |
| |
| </div> |
| </div> |
| </div> |
| </fieldset> |
| <div class="clear"> </div> |
| </div> |
| <?php |
| } |
| echo $params['comment_list_end']; |
| |
| |
| |
| |
| |
| $Item->feedback_moderation( 'feedbacks', '<div class="moderation_msg"><p>', '</p></div>', '', |
| T_('This post has 1 feedback awaiting moderation... %s'), |
| T_('This post has %d feedbacks awaiting moderation... %s') ); |
| |
| |
| } |
| |
| if( $params['disp_comment_form'] && $Item->can_comment() ) |
| { |
| echo '<div class="commentForm">'."\n"; |
| skin_include( '_item_comment_form.inc.php'; |
| echo '</div>'."\n"; |
| } |
| |
| |
| |
| |
| ?> |
_blogrum.footer.inc.php
PHP:
| <?php |
| |
| skin_container( NT_('Page Bottom'), array( |
| |
| 'block_start' => '<div class="blogrumOnline">', |
| 'block_end' => '</ul></div>', |
| 'block_display_title' => true, |
| 'block_title_start' => '<p class="widgetTitle">', |
| 'block_title_end' => '</p><ul>', |
| 'list_start' => '', |
| 'list_end' => '', |
| 'item_start' => '<li>', |
| 'item_end' => '</li>', |
| ) ); |
| |
| echo '<div class="footer">Original <a href="http://b2evolution.net" title=" add power to your website ">b<sub>2</sub>evolution</a> <a href="http://innervisions.org.uk/blogrums/" title=" expand your blog ">Blogrum</a> skin by <a href="http://astonishme.co.uk" title=" ready to be astonished? ">AstonishMe</a></div>'."\n"; |
| ?> |
_blogrum.header.inc.php
PHP:
| <?php |
| global $Blog; |
| ?> |
| <div id="blogrumHeader"> |
| <?php |
| echo '<h1><a href="'.$Blog->gen_blogurl().'" title=" '.T_( 'Blogrum home' ).' ">'.$Blog->dget( 'name' ).'</a></h1> |
| <h2>'.$Blog->dget( 'tagline' ).'</h2>'."\n"; |
| echo '<div id="menuItems">'."\n"; |
| echo '<ul id="topMenu">'."\n"; |
| |
| |
| skin_container( NT_('Menu'), array( |
| |
| 'block_start' => '', |
| 'block_end' => '', |
| 'block_display_title' => false, |
| 'list_start' => '', |
| 'list_end' => '', |
| 'item_start' => '<li>', |
| 'item_end' => '</li>', |
| ) ); |
| |
| echo '</ul>'."\n"; |
| echo '<ul class="userLinks">'."\n"; |
| if( !empty( $current_User ) && $current_User->check_perm( 'blog_post_statuses', 'any', false, $Blog->ID ) ) |
| { |
| global $dispatcher, $baseurlroot; |
| echo '<li><a href="'.$baseurlroot.'/'.$dispatcher.'?ctrl=items&action=new&blog='.$Blog->ID.'" title=" create a new thread ">'.T_( 'New thread' ).'</a></li>'; |
| } |
| user_login_link( '<li>', '</li>', T_( 'Login' ) ); |
| user_register_link( '<li>', '</li>', T_( 'Register' ) ); |
| user_profile_link( '<li>', '</li>', T_( 'Profile' ), T_( 'View your profile' ) ); |
| user_subs_link( '<li>', '</li>', T_( 'Subscriptions' ) ); |
| user_logout_link( '<li>', '</li>', T_( 'Logout' ) ); |
| echo '</ul>'."\n"; |
| ?> |
| </div> |
| </div> |
_blogrum.list.disp.php
PHP:
| <?php |
| echo '<table class="forumList"> |
| <tr class="forumHeader"><th>Blogrum</th><th>Last action</th></tr>'; |
| $BlogCache = & get_Cache( 'BlogCache' ); |
| $foo = explode( ',', $Blog->get_setting( 'aggregate_coll_IDs' ) ); |
| global $timestamp_max, $timestamp_min, $blog, $forum; |
| foreach( $foo as $bar ) |
| { |
| $forum = $BlogCache->get_by_ID( $bar ); |
| echo '<tr class="row'.( ( $odd = empty( $odd ) ) ? 'Odd' : 'Even' ).'"><td class="forumDescription"> |
| <a href="'.$forum->gen_blogurl().'" title=" Forum : '.$forum->dget( 'name' ).' ">'.$forum->dget( 'name' ).'</a><br /> |
| '.$forum->dget( 'longdesc' ).'</td>'; |
| $singlePostList = & new ItemList2( $forum, $timestamp_min, $timestamp_max, 1 ); |
| |
| $singlePostList->query(); |
| echo '<td class="postLastComment">'; |
| |
| $singlePostList->display_if_empty( array( 'msg_empty' => 'No posts yet' ) ); |
| |
| while( $Item = & $singlePostList->get_item() ) |
| { |
| $save_blog = $blog; |
| $blog = $bar; |
| $CommentsList = & new CommentList( NULL, "'comment'", array('published' ), $Item->ID, '', 'DESC', '', 1 ); |
| $blog = $save_blog; |
| while( $Comment = & $CommentsList->get_next() ) |
| { |
| $commented = true; |
| $Plugins->trigger_event( 'UserTimezone', array( |
| 'block_start' => '', |
| 'block_end' => '', |
| 'display' => true, |
| 'localdatetime' => $Comment->get( 'date' ), |
| ) ); |
| $Comment->permanent_link( array( |
| 'before' => ' ', |
| 'after' => '', |
| 'text' => get_icon( 'parent_childto_arrow', 'imgtag' ), |
| 'nofollow' => false, |
| 'title' => 'skip to last reply', |
| ) ); |
| $Plugins->trigger_event( 'LinkUserProfile', array( |
| 'user_ID' => $Comment->author_user_ID, |
| 'Object' => $Comment, |
| 'block_start' => '<span class="profileLink">', |
| 'block_end' => '</span>', |
| )); |
| |
| } |
| if( empty( $commented ) ) |
| { |
| $Plugins->trigger_event( 'UserTimezone', array( |
| 'block_start' => '', |
| 'block_end' => '', |
| 'display' => true, |
| 'localdatetime' => $Item->get( 'datemodified' ), |
| ) ); |
| $Item->permanent_link( array( |
| 'before' => ' ', |
| 'after' => '', |
| 'text' => get_icon( 'parent_childto_arrow', 'imgtag' ), |
| 'nofollow' => false, |
| 'title' => 'skip to last reply', |
| ) ); |
| $Item->get_creator_User(); |
| $Plugins->trigger_event( 'LinkUserProfile', array( |
| 'user_ID' => $Item->creator_user_ID, |
| 'block_start' => '<span class="profileLink">', |
| 'block_end' => '</span>', |
| )); } |
| $commented = false; |
| } |
| ?> |
| </td> |
| </tr> |
| <?php |
| } |
| ?> |
| </table> |
_blogrum.posts.disp.php
PHP:
| <?php |
| global $timestamp_max, $timestamp_min, $blog, $DB, $MainList, $forum; |
| |
| skin_include( '_blogrum.header.inc.php' ); |
| $hideEmpty = false; |
| if( $foo = $Blog->get_setting( 'aggregate_coll_IDs' ) ) |
| { |
| skin_include( '_blogrum.list.disp.php' ); |
| |
| |
| $sql = 'SELECT cat_ID |
| FROM T_categories |
| WHERE cat_blog_ID = '.$Blog->ID; |
| |
| if( $blog_cats = $DB->get_results( $sql, ARRAY_A ) ) |
| { |
| $catFilter = array(); |
| foreach( $blog_cats as $blog_cat ) |
| { |
| $catFilter[] = $blog_cat['cat_ID']; |
| } |
| $hideEmpty = true; |
| } |
| } |
| $MainList = & new ItemList2( $Blog, $timestamp_min, $timestamp_max ); |
| |
| |
| |
| |
| |
| if( !empty( $catFilter ) ) |
| { |
| $MainList->set_filters( array( |
| 'cat_array' => $catFilter, |
| ) ); |
| } |
| $MainList->query(); |
| |
| if( !$hideEmpty || $MainList->result_num_rows ) |
| { |
| echo '<table class="postList"> |
| <tr class="postHeader"><th>'.T_( 'Title' ).'</th><th>'.T_( 'Views' ).'</th><th>'.T_( 'Replies' ).'</th><th>'.T_( 'Author' ).'</th><th>'.T_( 'Last reply' ).'</th></tr>'; |
| |
| |
| display_if_empty( array( 'msg_empty' => '<tr><td colspan="5"><h3>'.T_( 'There are no threads in this blogrum yet' ).'</h3></td></tr>'."\n" ) ); |
| |
| while( $Item = & mainlist_get_item() ) |
| { |
| ?> |
| <tr id="<?php $Item->anchor_id() ?>" class="row<?php echo ( ( $odd = empty( $odd ) ) ? 'Odd' : 'Even' ); ?>" lang="<?php $Item->lang() ?>"> |
| |
| <?php |
| $Item->locale_temp_switch(); |
| ?> |
| |
| <td class="postTitle"><?php |
| if( $Item->comment_status != 'open' ) |
| { |
| $foo = get_icon( 'file_not_allowed', 'imgtag', array( 'title' => T_( 'Thread locked' ) ) ).' '; |
| } |
| else |
| { |
| $foo = ''; |
| } |
| $Item->title = $foo.$Item->title; |
| $Item->title(); |
| ?></td> |
| |
| <td class="postViews"><?php $Item->views('%d', '%d', '%d'); ?></td> |
| |
| <td class="postComments"> |
| <?php |
| |
| $Item->feedback_link( array( |
| 'type' => 'feedbacks', |
| 'link_before' => '', |
| 'link_after' => '', |
| 'link_text_zero' => ' 0 ', |
| 'link_text_one' => ' 1 ', |
| 'link_text_more' => ' %d ', |
| 'link_title' => 'read replies', |
| 'use_popup' => false, |
| ) ); |
| ?> |
| </td> |
| <td class="postAuthor"> |
| <?php |
| $Item->get_creator_User(); |
| $Plugins->trigger_event( 'LinkUserProfile', array( |
| 'user_ID' => $Item->creator_User->ID, |
| 'block_start' => '<span class="profileLink">', |
| 'block_end' => '</span>', |
| )); |
| ?> |
| </td> |
| <td class="postLastComment"> |
| <?php |
| $CommentList = & new CommentList( NULL, "'comment'", array('published'), $Item->ID, '', 'DESC', '', 1 ); |
| while( $Comment = & $CommentList->get_next() ) |
| { |
| $Plugins->trigger_event( 'UserTimezone', array( |
| 'block_start' => '', |
| 'block_end' => '', |
| 'display' => true, |
| 'localdatetime' => $Comment->get( 'date' ), |
| ) ); |
| $Comment->permanent_link( array( |
| 'before' => ' ', |
| 'after' => '', |
| 'text' => get_icon( 'parent_childto_arrow', 'imgtag' ), |
| 'nofollow' => false, |
| 'title' => 'skip to last reply', |
| ) ); |
| $Plugins->trigger_event( 'LinkUserProfile', array( |
| 'user_ID' => $Comment->author_user_ID, |
| 'Object' => $Comment, |
| 'block_start' => '<span class="profileLink">', |
| 'block_end' => '</span>', |
| )); |
| $commented = true; |
| } |
| if( empty( $commented ) ) |
| { |
| echo '----'; |
| } |
| $commented = false; |
| ?> |
| </td> |
| </tr> |
| <?php |
| locale_restore_previous(); |
| } |
| ?> |
| </table> |
| <?php |
| } |
| skin_include( '_blogrum.footer.inc.php' ); |
| ?> |
_blogrum.profile.disp.php
PHP:
| <?php |
| if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' ); |
| |
| $allow_guests = false; |
| |
| skin_include( '_blogrum.header.inc.php' ); |
| |
| echo '<table id="blogrumProfile"> |
| <tr><td class="userProfile">'."\n"; |
| |
| if( $allow_guests || is_logged_in() ) |
| { |
| $UserCache = get_cache( 'UserCache' ); |
| global $DB, $locales; |
| $profileID = param( 'ID', 'integer' ); |
| if( is_logged_in() && !$profileID ) |
| { |
| $profileID = $current_User->ID; |
| } |
| |
| if( $profileID && $profileUser = $UserCache->get_by_ID( $profileID, false ) ) |
| { |
| echo '<h3>'.$profileUser->get_preferred_name().'\'s profile'; |
| if( isset( $current_User ) && $current_User->ID == $profileID ) |
| { |
| global $admin_url; |
| echo ' <a href="'.url_add_param( $admin_url, 'ctrl=users&user_ID='.$current_User->ID ).'" title= " edit your profile ">'.get_icon( 'edit', 'imgtag' ).'</a>'; |
| } |
| echo '</h3><table class="profileDetails">'."\n"; |
| |
| $Plugins->trigger_event( 'UserTimezone', array( |
| 'block_start' => '<tr><td class="profileLeft">Joined</td><td>', |
| 'block_end' => '</td></tr>', |
| 'display' => true, |
| 'localdatetime' => $profileUser->get( 'datecreated' ), |
| ) ); |
| echo '<tr><td class="profileLeft">Posts</td><td>'.( $profileUser->get('num_posts') + ( $foo = $DB->get_var( 'select count(*) from T_comments where comment_status="published" and comment_author_ID='.$profileUser->ID ) ) ); |
| if( $profileUser->get('num_posts' ) ) |
| { |
| $postLinks[] = ' <a href="'.url_add_param( $Blog->gen_blogurl(), 'disp=single&author='.$profileUser->ID ).'" title=" read all threads started by '.$profileUser->get_preferred_name().' ">threads started</a>'; |
| } |
| if( $foo ) |
| { |
| $postLinks[] = ' <a href="'.url_add_param( $Blog->gen_blogurl(), 'disp=comments&author='.$profileUser->ID ).'" title=" read all replies by '.$profileUser->get_preferred_name().' ">replies</a>'; |
| } |
| |
| if( isset( $postLinks ) ) |
| { |
| echo ' ( find all '.implode( ', ', $postLinks ).' by '.$profileUser->get_preferred_name().' )'; |
| } |
| |
| echo '</td></tr>'."\n"; |
| $Plugins->trigger_event( 'DisplayProfile', array( |
| 'user_ID' => $profileUser->ID, |
| 'setting_block_start' => '<tr>', |
| 'setting_block_end' => '</tr>', |
| 'setting_title_start' => '<td class="profileLeft">', |
| 'setting_title_end' => '</td>', |
| 'setting_value_start' => '<td>', |
| 'setting_value_end' => '</td>', |
| ) ); |
| |
| echo '<tr><td class="profileLeft">Website</td><td>'.( $profileUser->get( 'url' ) ? sprintf( '<a href="%1$s" title=" visit %2$s\'s website ">%1$s</a>', $profileUser->dget( 'url', 'htmlbody' ), $profileUser->get_preferred_name() ) : '' ).'</td></tr>'."\n"; |
| echo '<tr><td class="profileLeft">ICQ</td><td>'.$profileUser->dget( 'icq', 'htmlbody' ).'</td></tr>'."\n"; |
| echo '<tr><td class="profileLeft">AIM</td><td>'.$profileUser->dget( 'aim', 'htmlbody' ).'</td></tr>'."\n"; |
| echo '<tr><td class="profileLeft">MSN</td><td>'.$profileUser->dget( 'msn', 'htmlbody' ).'</td></tr>'."\n"; |
| echo '<tr><td class="profileLeft">Yahoo</td><td>'.$profileUser->dget( 'yim', 'htmlbody' ).'</td></tr>'."\n"; |
| |
| echo '</table>'."\n"; |
| } |
| else |
| { |
| echo 'No user selected'; |
| } |
| } |
| else |
| { |
| echo '<h3>'.T_( 'You need to be a registered member to view profiles' ).'</h3>'."\n"; |
| } |
| echo '</td></tr></table>'."\n"; |
| |
| skin_include( '_blogrum.footer.inc.php' ); |
| ?> |
_blogrum.single.disp.php
PHP:
| <?php |
| global $DB,$odd; |
| skin_include( '_blogrum.header.inc.php' ); |
| ?> |
| <div class="postSingle"> |
| <?php |
| |
| display_if_empty( '<h3>'.T_( 'There are no threads in this blogrum yet' ).'</h3>' ); |
| |
| while( $Item = & mainlist_get_item() ) |
| { |
| ?> |
| <?php |
| $Item->locale_temp_switch(); |
| ?> |
| <div id="<?php $Item->anchor_id() ?>" class="postRow<?php echo ( ( $odd = empty( $odd ) ) ? 'Odd' : 'Even' ); ?>" lang="<?php $Item->lang() ?>"> |
| <h3 class="singleTitle"> |
| <?php |
| if( $Item->comment_status != 'open' ) |
| { |
| $foo = get_icon( 'file_not_allowed', 'imgtag', array( 'title' => T_( 'Thread locked' ) ) ).' '; |
| } |
| else |
| { |
| $foo = ''; |
| } |
| echo '<a href="'.$Item->get_permanent_url().'" title=" '.T_( 'permanent link for this post' ).' ">'.$foo.$Item->dget( 'title', 'htmlbody' ).'</a>'; |
| $Item->edit_link( array( |
| 'before' => ' ', |
| 'after' => '', |
| 'text' => get_icon( 'edit', 'imgtag' ), |
| ) ); |
| ?></h3> |
| <div class="postAuthor"> |
| <?php |
| $foo = $Item->get_creator_User(); |
| $Plugins->trigger_event( 'LinkUserProfile', array( |
| 'user_ID' => $Item->creator_User->ID, |
| 'block_start' => '<span class="profileLink">', |
| 'block_end' => '</span>', |
| )); |
| ?> |
| <?php |
| $Plugins->trigger_event( 'UserAvatar', array( |
| 'user_ID' => $Item->creator_User->ID, |
| 'block_start' => '', |
| 'block_end' => '', |
| )); |
| |
| echo '<p class="postCount">Posts : '.( $foo->get('num_posts') + $DB->get_var( 'select count(*) from T_comments where comment_status="published" and comment_author_ID='.$foo->ID ) ).'</p>'; |
| $Plugins->trigger_event( 'UserLocation', array( |
| 'user_ID' => $Item->creator_User->ID, |
| )); |
| ?> |
| <?php |
| $Plugins->trigger_event( 'UserTimezone', array( |
| 'block_start' => '<p class="userJoined">Joined : <span>', |
| 'block_end' => '</span></p>', |
| 'display' => true, |
| 'localdatetime' => $foo->get( 'datecreated' ), |
| 'output_format' => '$date$', |
| ) ); |
| ?> |
| </div> |
| |
| <fieldset class="postDetails"> |
| <div class="p_tl"> |
| <div class="p_tr"> |
| <div class="p_tm"> |
| <?php |
| $Plugins->trigger_event( 'UserTimezone', array( |
| 'block_start' => '<p class="postDate">Posted on : <span>', |
| 'block_end' => '</span></p>', |
| 'display' => true, |
| 'localdatetime' => $Item->get( 'datecreated' ), |
| ) ); |
| ?> |
| </div> |
| </div> |
| </div> |
| |
| <div class="p_ml"> |
| <div class="p_mr"> |
| <?php |
| |
| include dirname(__FILE__).'/../_item_content.inc.php'; |
| |
| |
| |
| |
| |
| |
| |
| |
| ?> |
| <?php |
| |
| $Item->tags( array( |
| 'before' => '<div class="posttags">'.T_('Tags').': ', |
| 'after' => '</div>', |
| 'separator' => ', ', |
| ) ); |
| |
| skin_container( NT_('After Posts'), array( |
| ) ); |
| |
| $Plugins->trigger_event( 'UserSignature', array( |
| 'user_ID' => $Item->creator_User->ID, |
| )); |
| ?> |
| |
| </div> |
| </div> |
| |
| <div class="p_bl"> |
| <div class="p_br"> |
| <div class="p_bm"> |
| |
| </div> |
| </div> |
| </div> |
| </fieldset> |
| <div class="clear"> </div> |
| </div> |
| |
| <?php |
| |
| include dirname(__FILE__).'/_blogrum.feedback.inc.php'; |
| |
| |
| |
| ?> |
| |
| <?php |
| locale_restore_previous(); |
| } |
| ?> |
| </div> |
| <?php |
| skin_include( '_blogrum.footer.inc.php' ); |
| ?> |
Urm, is that it? 
When I get a chance I'll take one of the default b2evo skins and convert it into a blogrum aware skin ... I might even create a tutorial about it, you never know. ... in the meantime you're pretty much stuck with the above .... and I really will just direct any muppet questions to goggle ... this is a work in progress huh? ( note to self : bbcode plugin
).
For those of you that are prepared to melt your server by installing one of our over-bloated plugins that have a deficiency of settings .... according to some archaic git .. then you can download the latest version from my credits page ( credits page ).
Bye 
As always, let me know if you find any problems / bugs / blonde thoughts ... or if it melts your server ..... just don't ask me how to change bloody link font-sizes huh? 
Note : Replies to this post are closed. Start a new thread if you have a problem
¥