_az_ (@_az_)

Forum Replies Created

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

  • _az_
    Participant

    @_az_

    So, small update from me:

    Unfortunately other priorities came up with my client, so i don’t expect to be able to put much time into developing. This was decided this yesterday and i am still considering implementing the feature in my free time.


    _az_
    Participant

    @_az_

    There are many plugins that should do the trick.

    Just search for wp login redirect or maybe also add bbpress to the search terms.


    _az_
    Participant

    @_az_

    @siparker thanks for posting the link to the Permalinks with id plugin. I have looked into it and the logic for adding text to a permalink seems less complicated than the logic for replacing parts of the permalink.

    However, good news may be: it is possible that i will work on that feature for a client.

    Probably not the full scope of https://bbpress.trac.wordpress.org/ticket/2258 but it may be a good start.

    If this is decided, then i’d like to propose its development on github as an public bbpress-plugin and i’d happily collaborate with other devs on the issue.


    _az_
    Participant

    @_az_

    Can you please provide more information how to use one of those two plugins to create a “default” structure in a sub-forum that is added manually at some point after installation?

    It seems those plugins are suitable for creating/importing backups of WordPress content from one instance to another.


    _az_
    Participant

    @_az_

    I think #2258 is pretty complex to implement but possible. Might take some days to do it i guess.

    Here is my workaround:

    in functions.php:

    /**
     * for nicer permalinks:
     * 
     * from: forums/forum/name -> to forum/name
     * 
     * also required rewrite rules below in myThemeName_addRewriteRules
     */
    function myThemeName_bbp_get_forum_permalink_withoutRootSlug() {
    	return preg_replace( '/(' . bbp_get_root_slug() . '\/)/', '', bbp_get_forum_permalink()); 
    }
    
    function myThemeName_addRewriteRules() {
    	/**
    	 * add rewrite rules for bbpress
    	 */
    	
    	// use this to test instead of clicking Save Changes in Settings -> Permalinks
    	// global $wp_rewrite;
    	// $wp_rewrite->flush_rules();
    
    	add_rewrite_endpoint(get_option('_bbp_forum_slug'), EP_ROOT);
    	add_rewrite_rule('^'. get_option('_bbp_forum_slug') . '/(.*)?','index.php?post_type=forum&name=$matches[1]');
    }
    add_action('init', 'myThemeName_addRewriteRules');

    Replacement in my custom loop-single-forum.php:
    <a href="<?php echo myThemeName_bbp_get_forum_permalink_withoutRootSlug(); ?>">

    Default bbpress templates use it at more places than my theme:

    Found 5 matches of bbp_(get_)?forum_permalink in 4 files.	
    loop-search-forum.php	
    		<a href="<?php bbp_forum_permalink(); ?>" class="bbp-forum-permalink">#<?php bbp_forum_id(); ?></a>      [position 18:18]	
    		<h3><?php _e( 'Forum: ', 'bbpress' ); ?><a href="<?php bbp_forum_permalink(); ?>"><?php bbp_forum_title(); ?></a></h3>      [position 26:58]	
    loop-search-topic.php	
    			<a href="<?php bbp_forum_permalink( bbp_get_topic_forum_id() ); ?>"><?php bbp_forum_title( bbp_get_topic_forum_id() ); ?></a>      [position 41:19]	
    loop-single-forum.php	
    		<a class="bbp-forum-title" href="<?php bbp_forum_permalink(); ?>"><?php bbp_forum_title(); ?></a>      [position 32:42]	
    loop-single-topic.php	
    				<span class="bbp-topic-started-in"><?php printf( __( 'in: <a href="%1$s">%2$s</a>', 'bbpress' ), bbp_get_forum_permalink( bbp_get_topic_forum_id() ), bbp_get_forum_title( bbp_get_topic_forum_id() ) ); ?></span>      [position 68:102]	

    Feel free to hit the Flattr Button on my page: az.zankapfel.org

    Update: Seems that the breadcrumbs need a hack too… 🙂


    _az_
    Participant

    @_az_

    Thanks for pointing that out. I think i should make more use of bbp_parse_args().

    bbp_create_initial_content() seems to be a good idea for deploying initial content, but i needed something more flexible, which can be used in the Dashboard. E.g. for deploying a default structure, given in said JSON File to a newly created Forum.


    _az_
    Participant

    @_az_

    In case anyone stumbles upon this.

    I wrote a plugin to generate topics and forums from a JSON File but it is still somehow specific to a certain project i am working on.

    The effort to make it more generic is not that huge, so drop me a line and i will consider doing that and release it on github.


    _az_
    Participant

    @_az_

    update: replace ‘include’ with ‘post__in’ and then its a loop just with super-stickies


    _az_
    Participant

    @_az_

    Guess it is only an issue, when autoload is not working as expected.


    _az_
    Participant

    @_az_

    Got it sorted out. Somehow my installation was missing the autoload column(?!) and by adding that i reduced the amount of queries.


    _az_
    Participant

    @_az_

    There is a function: bbp_get_super_stickies() which is used inside the function bbp_has_topics(). This function basically returns a list of Post IDs from the wp_options table from a row with the key: “_bbp_super_sticky_topics” or “_bbp_sticky_topics”

    So one approach could be: override default args

    bbp_has_topics(array('show_stickies' => false);

    Extra loop for stickys (not tested, just a sketch)

    $query = new WP_Query(array('inlucde' => bbp_get_super_stickies());

    Though i recommend looking into the function bbp_has_topics to be aware of all possible cases.

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