Skip to:
Content
Pages
Categories
Search
Top
Bottom

Plugin: Recent Posts (kinda like the “edit comments” in WP)

  • @_ck_

    Participant

    This is so simple I bet I am duplicating what someone else has already done. I am not sure why this isn’t in bbPress by default and it doesn’t even begin to address what I would consider basic moderation tools but it’s a start.

    Install and check under “content” submenu. Why the posts menu =deleted posts in bbpress’s default I have no clue.

    <?php
    /*
    Plugin Name: bbPress Recent Posts
    Plugin URI: http://bbpress.org/plugins/
    Description: shows most recent posts with (extremely limited) moderation options
    Author: _ck_
    Author URI: http://CKon.wordpress.com
    Version: 0.01
    */

    function recent_posts_admin_page() {
    if ( !bb_current_user_can('browse_deleted') ) {die(__("Now how'd you get here? And what did you think you'd being doing?"));}
    global $bbdb, $bb_posts, $bb_post, $page;
    $bb_posts=get_latest_posts(0,$page);
    $total = bb_count_last_query();
    ?>
    <h2>Recent Posts</h2>
    <ol id="the-list">
    <? bb_admin_list_posts(); ?>
    </ol>
    <?php echo get_page_number_links( $page, $total );
    }

    function recent_posts_admin_menu() {
    global $bb_submenu;
    $bb_submenu['content.php'][] = array(__('Recent Posts'), 'use_keys', 'recent_posts_admin_page');
    }
    add_action( 'bb_admin_menu_generator', 'recent_posts_admin_menu' );

Viewing 6 replies - 1 through 6 (of 6 total)
  • @trent

    Member

    Beauty! Thanks!

    Trent

    @outchy

    Member

    is there a way to tweak this so you can simply list the latest posters on the front page (as username/profile link)?

    @_ck_

    Participant

    outchy, this plugin is for a completely different purpose.

    You already have the latest posters on the front page, if you want to turn their names into profile links you need to do something like this in your front-page.php

    <td class="num"><a href="<? user_profile_link( get_post_author_id( ) ); ?>"><?php topic_last_poster(); ?></a></td>

    (untested)

    Note because of the way user data is not cached on the front page, this will cause several extra queries per topic listed and probably not a good idea for very busy forums.

    @outchy

    Member

    ok i’ll stay away from that then, thanks.

    @_ck_

    Participant

    Actually, I just realized there is a cheat way to do zero extra mysql queries and link to the profile.

    <td class="num"><a href="/forums/profile.php?id=<? echo $topic->topic_last_poster; ?>"><?php topic_last_poster(); ?></a></td>

    untested but should work in theory

    This will just use the stored last posted id # instead of forcing bbpress to lookup all their meta data and profile link in the database.

    If your forum uses permalinks, it will just rewrite the url on display.

    @fel64

    Member

    What would bb be looking up? It knows the link type and it already has $topic->topic_last_poster_name as well as $topic->topic_last_poster.

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.
Skip to toolbar