Skip to:
Content
Pages
Categories
Search
Top
Bottom

Slug based permalinks

Viewing 14 replies - 1 through 14 (of 14 total)
  • Just what I have been waiting for real pretty permalinks. Thank you =)

    Great,

    I am preparing to run this patch on a fresh installed version.


    Sam Bauers
    Participant

    @sambauers

    It’s in the core code, no need to patch. Just grab the very latest version via Subversion.

    Nice,

    I’ve installed it on http://www.dfur.com/. Is there a way to configure the links like the http://www.network.net.au/bbpress/patches/permalinks/teaser.gif

    Thanx.


    Sam Bauers
    Participant

    @sambauers

    No there is no permalink configuration in the admin area, and plans for that permalink functionality have been dropped for several reasons.

    You have three choices for $bb->mod_rewrite:

    • false = normal querystring based links
    • true = permalinks based on ID
    • ‘slugs’ = permalinks based on item names/titles

    So literally:

    $bb->mod_rewrite = 'slugs';

    That works with the latest TRAC?

    Trent

    **Edit** Nevermind, it does works!


    fel64
    Member

    @fel64

    Hey Sam,

    it’s been working fine until someone made a thread called “1:28”. The slug set for it in the database is “128” but going to /topic/128?replies=1 redirects to /topic/?replies=1, resulting in an error. I assume this is a bug? My quick fix for this was to just change the slug.


    Sam Bauers
    Participant

    @sambauers

    fel64: I kind of knew this was going to be an issue, but never addressed it. I figured people would work out what to do (as you have). I guess it’s worth a ticket, if you add the ticket to the bbpress trac, I’ll patch it.


    Sam Bauers
    Participant

    @sambauers

    I’ve just written a fix, I’ll add a ticket for it.

    Edit: ticket added with patch…

    https://trac.bbpress.org/ticket/638


    fel64
    Member

    @fel64

    Thanks a lot Sam!

    Another problem I have is that the bb Post plugin doesn’t automatically add a slug. I tried addressing this but couldn’t make it work. The function bbpress_bb_new_topic is responsible for adding the topic to bb.

    function bbpress_bb_new_topic( $title, $forum, $author, $author_name, $now ) {	// making new topic in bbPress
    global $wpdb ,$otherdb;
    $bb_table_prefix = bbpress_getoption('bb_prefix');

    if ( $forum && $title ) {
    if (bbpress_getoption('bb_other_base') === "no") {
    $wpdb->query("INSERT INTO <code>&quot;. $bb_table_prefix .&quot;topics</code> (topic_title, topic_poster, topic_poster_name, topic_last_poster, topic_last_poster_name, topic_start_time, topic_time, forum_id ) VALUES ('$title', $author, '$author_name', $author, '$author_name', '$now', '$now', $forum)");
    $topic_id = $wpdb->insert_id;

    $wpdb->query("UPDATE <code>&quot;. $bb_table_prefix .&quot;forums</code> SET topics = topics + 1 WHERE forum_id = $forum");
    $wpdb->query("UPDATE <code>&quot;. $bb_table_prefix .&quot;forums</code> SET posts = posts + 1 WHERE forum_id = $forum");
    } else {
    $otherdb->query("INSERT INTO <code>&quot;. $bb_table_prefix .&quot;topics</code> (topic_title, topic_poster, topic_poster_name, topic_last_poster, topic_last_poster_name, topic_start_time, topic_time, forum_id, topic_slug) VALUES ('$title', $author, '$author_name', $author, '$author_name', '$now', '$now', $forum, $feltopic_slug)");
    $topic_id = $otherdb->insert_id;

    $otherdb->query("UPDATE <code>&quot;. $bb_table_prefix .&quot;forums</code> SET topics = topics + 1 WHERE forum_id = $forum");
    $otherdb->query("UPDATE <code>&quot;. $bb_table_prefix .&quot;forums</code> SET posts = posts + 1 WHERE forum_id = $forum");

    }

    return $topic_id;
    } else {
    return false;
    }
    }

    What needs to be done? I need to change the INSERT INTO statement, by adding the column name to the list of columns and the variable I want to insert for that to the list of variables?


    Sam Bauers
    Participant

    @sambauers

    Check out what we do with slugs in bb-includes/functions.php in the bb_new_topic() function…

    In fact, why aren’t you just using that function in that plugin???


    fel64
    Member

    @fel64

    It’s a wordpress plugin! I don’t think I can call bb_new_topic() from wordpress?


    Sam Bauers
    Participant

    @sambauers

    Oh.


    gtim
    Member

    @gtim

    This is the only thing that I missed when I first installed bbPress. Thanks!

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