jomontvm (@jomontvm)

Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)

  • jomontvm
    Participant

    @jomontvm

    @catlawsonNHS

    I have used this plugin for my bbpress which was integrated along with wordpress MU, and it worked perfectly.


    jomontvm
    Participant

    @jomontvm

    @catlawsonNHS

    Yes, this plugin is for the standalone bbpress, not for wordpress.

    Sorry for the late response as I was concentrating completely on some other things.


    jomontvm
    Participant

    @jomontvm

    How can I get the corresponding Arabic version of bbpress 1.0.2?

    And can I install both English and Arabic versions of bbpress under a single installation of wordpress mu with the database shared?

    Anyone please advice..


    jomontvm
    Participant

    @jomontvm

    I am using wordpress-mu-2.9.2 and bbpress-1.0.2.

    Has anyone implemented this successfully?

    please help me to include wpmu sidebar in bbpress template.


    jomontvm
    Participant

    @jomontvm

    Hi Pagal,

    I have customized the permalink for bbpress, and it works fine. It’s still on the testing stage, though you can try this. The following is the modifications I have done.

    Step 1:


    Open ‘bb-admin/options-permalinks.php’

    You will find a permalink options declaration. Add one more option as shown below, it will add one more option in the permalink options in the backend. You can make the custom option with a text field, in order to customize in your own way (I have done in a predefined format in order to make it simple).


    $permalink_options = array(
    'mod_rewrite' => array(
    'title' => __( 'Permalink type' ),
    'type' => 'radio',
    'options' => array(
    '0' => sprintf( __( '<span>None</span> %s' ), bb_get_uri( 'forum.php', array( 'id' => 1 ), BB_URI_CONTEXT_TEXT ) ),
    '1' => sprintf( __( '<span>Numeric</span> %s' ), bb_get_uri( 'forum/1', null, BB_URI_CONTEXT_TEXT ) ),
    'slugs' => sprintf( __( '<span>Name based</span> %s' ), bb_get_uri( '/forum/first-forum', null, BB_URI_CONTEXT_TEXT ) ),
    'custom' => sprintf( __( '<span>Custom</span> %s' ), bb_get_uri( '/forum/%parent_slug%/%forum_slug%', null, BB_URI_CONTEXT_TEXT ))
    )
    )
    );

    Step 2:


    Now we have to create the custom format of permalinks for forums and topics.

    Open ‘bb-includes/functions.bb-template.php’

    We have to modify two functions ‘get_forum_link’ and ‘get_topic_link’. See the changes I have done for the custom permalink option.


    function get_forum_link( $forum_id = 0, $page = 1, $context = BB_URI_CONTEXT_A_HREF ) {
    $forum = bb_get_forum( get_forum_id( $forum_id ) );

    if (!$context || !is_integer($context)) {
    $context = BB_URI_CONTEXT_A_HREF;
    }

    $rewrite = bb_get_option( 'mod_rewrite' );

    if ( $rewrite ) {
    $page = (1 < $page) ? '/page/' . $page : '';
    if ($rewrite === 'custom') {
    if ($forum->forum_parent > 0) {
    $parent = bb_get_forum($forum->forum_parent);
    $parent_slug = $parent->forum_slug;
    $custom_link = $parent_slug . '/' . $forum->forum_slug;
    } else {
    $custom_link = $forum->forum_slug;
    }
    $link = bb_get_uri('forum/' . $custom_link . $page, null, $context);
    } else {
    if ( $rewrite === 'slugs' ) {
    $column = 'forum_slug';
    } else {
    $column = 'forum_id';
    }
    $link = bb_get_uri('forum/' . $forum->$column . $page, null, $context);
    }
    } else {
    $query = array(
    'id' => $forum->forum_id,
    'page' => (1 < $page) ? $page : false
    );
    $link = bb_get_uri('forum.php', $query, $context);
    }

    return apply_filters( 'get_forum_link', $link, $forum->forum_id, $context );
    }

    function get_topic_link( $id = 0, $page = 1, $context = BB_URI_CONTEXT_A_HREF ) {
    $topic = get_topic( get_topic_id( $id ) );
    if (!$context || !is_integer($context)) {
    $context = BB_URI_CONTEXT_A_HREF;
    }

    $args = array();

    $rewrite = bb_get_option( 'mod_rewrite' );
    if ( $rewrite ) {
    $page = (1 < $page) ? '/page/' . $page : '';
    if ($rewrite === 'custom') {
    $custom_link = '';
    if ($topic->forum_id > 0) {
    $forum = bb_get_forum($topic->forum_id);
    if ($forum->forum_parent > 0) {
    $parent = bb_get_forum($forum->forum_parent);
    $custom_link = $parent->forum_slug;
    }
    $custom_link .= '/' . $forum->forum_slug;
    }
    if (!empty($custom_link)) {
    $custom_link .= '/topic/' . $topic->topic_slug;
    } else {
    $custom_link .= 'topic/' . $topic->topic_slug;
    }
    $link = bb_get_uri($custom_link . $page, null, $context);
    } else {
    if ( $rewrite === 'slugs' ) {
    $column = 'topic_slug';
    } else {
    $column = 'topic_id';
    }
    $link = bb_get_uri('topic/' . $topic->$column . $page, null, $context);
    }
    } else {
    $page = (1 < $page) ? $page : false;
    $link = bb_get_uri('topic.php', array('id' => $topic->topic_id, 'page' => $page), $context);
    }

    return apply_filters( 'get_topic_link', $link, $topic->topic_id, $context );
    }

    Step 3:


    Now we have to define the htaccess rules.

    Open ‘.htaccess’ file in bbpress root folder, and add following two lines just above the code line – RewriteRule ^topic/?$ /forums/ [R=302,L,QSA].


    RewriteRule ^(.+)/topic/(.+) /forums/topic.php?id=$2 [L,QSA]
    RewriteRule ^forum/(.+)/(.+) /forums/forum/$2/ [L,QSA]

    Here is how my URLs looks after making these modifications:

    Forum URL: mysite.com/forums/forum/en/first-forum-in-english

    Topic URL: mysite.com/forums/en/first-forum-in-english/topic/the-ipad-developers-challenge

Viewing 5 replies - 1 through 5 (of 5 total)