Skip to:
Content
Pages
Categories
Search
Top
Bottom

Bulk-move topics?

  • @djosephdesign

    Participant

    Is there any way to bulk-move topics?

    I run a Once Upon a Time podcast and forums with bbPress. We have a spoiler section for each episode of the TV show. After that episode has aired, I like to move the spoiler topics into the main discussion for the TV show. This was easy with phpBB, but bbPress doesn’t seem to offer this feature.

    When I go to Admin > Topics and filter the list by a forum parent, I have no options for changing that forum parent or moving the topics in any way.

    How can I do this easily on a regular basis? Editing each topic individually is not practical.

Viewing 10 replies - 1 through 10 (of 10 total)
  • @kaliceos

    Participant

    There doesn’t seem to be an easy solution or plugin. But if you have some programming skills you may be able to do what you want : Custom bulk action

    @ailyroot

    Participant

    any body have solution for this for these years?

    @sunshineday77

    Participant

    I’m wondering if there’s a way to do this now as well.

    @robin-w

    Moderator

    so move bulk topics from one forum to another – yes?

    @sunshineday77

    Participant

    yes, exactly

    @robin-w

    Moderator

    thanks, give me a day or 2 and I’ll see if that is easy to do

    @sunshineday77

    Participant

    Thanks so much!

    @robin-w

    Moderator

    ok, so I’ve added this ability into my style pack plugin

    bbp style pack

    it is automatically there once you have activated the plugin, so just see SO TO BULK MOVE… below

    OTHERWISE IF YOU PREFER TO USE CODE then

    add_action( 'bulk_edit_custom_box',  'rew_quick_edit_fields', 10, 2 );
    
    function rew_quick_edit_fields( $column_name, $post_type ) {
    	switch( $column_name ) {
    		case 'bsp_topic_forum': {
    			echo rew_bulk_edit_forums () ;
    			break;
    		}
    		case 'bbp_topic_forum': {
    			echo rew_bulk_edit_forums () ;
    			break;
    		}
    	}
    }
    
    function rew_bulk_edit_forums () {
    	// Start an output buffer
    		ob_start();
    		
    	?>
    				<fieldset class="inline-edit-col-left">
    					<div class="inline-edit-col">
    						<p>
    							<label for="bbp_forum_id"><?php esc_html_e( 'Forum:', 'bbpress' ); ?></label><br />
    							<?php
                                                                    $no_forum_str = 
                                                                            /* translators: &mdash; is encoded long dash (-) */
                                                                            esc_html__( '&mdash; No forum &mdash;', 'bbpress' );
    								bbp_dropdown( array(
    									'show_none' => $no_forum_str,
    									'selected'  => bbp_get_form_topic_forum()
    								) );
    							?>
    						</p>
    					</div>
    				<?php
    			// Output the current buffer
    		$output =  ob_get_clean();
    	return $output ;
    }
    
    add_action( 'save_post', 'rew_bulk_edit_save' );
    
    function rew_bulk_edit_save( $post_id ){
    
    	// check bulk edit nonce
    	if ( ! wp_verify_nonce( $_REQUEST[ '_wpnonce' ], 'bulk-posts' ) ) {
    		return;
    	}
    
    	// update the forum
    	$forum_id = ! empty( $_REQUEST[ 'bbp_forum_id' ] ) ? absint( $_REQUEST[ 'bbp_forum_id' ] ) : 0;
    	remove_action( 'save_post', 'rew_bulk_edit_save' );
    
            // update the post, which calls save_post again.
            wp_update_post( array( 'ID' => $post_id, 'post_parent' => $forum_id ) );
    
            // re-hook this function.
            add_action( 'save_post', 'rew_bulk_edit_save' );
    }

    Put this in your child theme’s function file –

    ie wp-content/themes/%your-theme-name%/functions.php

    where %your-theme-name% is the name of your theme

    or use

    Code Snippets

    SO TO BULK MOVE…

    go to dashboard>topics and use the tick boxes to the left of each topic to select the ones you want
    then above the topics use the ‘bulk actions’ to select ‘edit’
    and click ‘apply’ to the right of that

    You will the see a dropdown box labelled ‘forum’ which lets you set which forum to change those topics to,
    and click ‘update’

    @sunshineday77

    Participant

    You *ROCK*, Robin!! Thank you so much. You continue to make using bbPress and bbStylePack easier and in such helpful ways!!

    @robin-w

    Moderator

    great – glad to have helped – it was an interesting challenge !

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