inspirationally (@inspirationally)

Forum Replies Created

Viewing 25 replies - 1 through 25 (of 27 total)
  • In reply to: Thousands of revisions

    inspirationally
    Participant

    @inspirationally

    I took down my site recently completely and half a year before the forum, because of this, because I did not find a solution till the end. Sorry!


    inspirationally
    Participant

    @inspirationally

    Oh this is long ago.
    I just searched through my harddrive and could find a copy of the wbb3.php, my old import file, but I don’t think that’s the most recent version – I could not find anything with wbb in it. Unfortunately, the wbb3.php in the bbpress plugin folder was overwritten with the bbpress updates.


    inspirationally
    Participant

    @inspirationally

    ok, got it.
    I was sorting the topics by number of replies with this:

    <?php
    /*
    Plugin Name: Set Post Order In Admin
    Version: 0.1
    Plugin URI: https://wordpress.org/support/topic/336715/
    Description: In Posts->Edit, display posts in title order.
    Author: MichaelH
    Author URI: https://codex.wordpress.org/User:MichaelH/MyPlugins
    */
    
    function set_post_order_in_admin( $wp_query ) {
      if ( is_admin()) {
    
    $wp_query->set( 'orderby', 'meta_value_num' );
    $wp_query->set( 'meta_key', '_bbp_reply_count' );
        $wp_query->set( 'order', 'DESC' );
      
    }}
    
    add_filter('pre_get_posts', 'set_post_order_in_admin' );
    ?>

    this seems to cause the replies not to be deleted, too, curiously.`

    Any idea why this happens? And how to delete the orphan replies + postmeta.


    inspirationally
    Participant

    @inspirationally

    Admin side.
    Theme side nothing happens (side is white…)

    Something bad happens with my bbPress installation – first the revisions, now that 🙁

    In reply to: Thousands of revisions

    inspirationally
    Participant

    @inspirationally

    Fugettaboutit – some more hours passed by and they still are there. So that wasn’t the reason.

    CUrious is, that, at least for me, the URLs (guid) of the revisions are like
    http://deppheads.com/general/2014/01/24/303815-revision-v1/

    with post parent being this
    http://deppheads.com/forums/reply/303815/

    while even those spam replies have an url like this
    http://deppheads.com/forums/reply/711501/

    so they are getting normal posts in the general category (my default one)

    In reply to: Thousands of revisions

    inspirationally
    Participant

    @inspirationally

    I realize, we share(d) the plugin Wangguard.
    I deactivated it before, but the revisions kept going. A week ago I replaced it with “GoodQuestion” cause that seemed more lightweight for me and does the job, too. I just cleaned my database from old tables, including the wangguard ones, re-activated revisions and for an hour now no new revision. Although guests are even allowed to post.
    Might you try it, too? (deactivate, backup the five or six wangguard tables and test, and reload from the backup afterwards, maybe?)

    In reply to: Thousands of revisions

    inspirationally
    Participant

    @inspirationally

    I deactivated members and tehnik permissions, too, and activated the debug objects plugin – I copied all but cache part (that one was so long that I could not copy it…but made a screencap of the first part of it):

    http://johnny-depp.org/debug.rtf
    http://johnny-depp.org/cache.png

    new revisions were created all the time.

    Any new ideas?? What i could do more to know what causes it?

    In reply to: Thousands of revisions

    inspirationally
    Participant

    @inspirationally

    OK, now I

    1) deactivated all plugins but akismet, bbpress, members, tehnik bbpress permissions, wangguard and temporarily wp optimize and debug queries
    2) deleted revisions and transients and cache
    3) activated twenty fourteen theme

    and after some minutes those revisions still are being created.

    Here the queries that debug queries lists when watching the topic http://johnny-depp.org/forums/topic/neujahr/

    -> http://johnny-depp.org/queries.txt

    In reply to: Thousands of revisions

    inspirationally
    Participant

    @inspirationally

    Will try that later in the evening. For now, it was just by coincidence with my functions.php. I tried now using the unchanged 2014 theme for longer and they still are created, those inherit revisions.
    Which page should I check with the debug? The topic pages?

    In reply to: Thousands of revisions

    inspirationally
    Participant

    @inspirationally

    After deactivating all bbPress related Plugins, it still occured. Now I removed the functions.php and it seems to have stopped and I’m re-adding it one snippet after the other, but I always have to wait half an hour between each snippet to see if it continues. No idea how to test it “immediately”.

    It might be something about this part:

    //Remove bbPress Head on non bbPress sites

    add_action( 'wp_head', 'conditional_bbpress_head', 9 );
    function conditional_bbpress_head(){
    global $post;
    if( !is_bbpress() && !(is_home() && $_SERVER['SERVER_NAME'] == 'deppheads.com') && !(isset( $post->post_parent ) && $post->post_parent == "17123") )
    remove_action( 'wp_head', 'bbp_head' );
    }
    add_action( 'wp_enqueue_scripts', 'conditional_bbpress_scripts', 9 );
    function conditional_bbpress_scripts(){
    global $post;
    if( !is_bbpress() && !(is_home() && $_SERVER['SERVER_NAME'] == 'deppheads.com') && !(isset( $post->post_parent ) && $post->post_parent == "17123") )

    remove_action( 'wp_enqueue_scripts', 'bbp_enqueue_scripts' );
    }

    which I added because I have two domains running and just one little part under the domain deppheads is actually the forum, and I did not want all that bbPress code in all sites, especially not on my main site.
    Is that possible??

    In reply to: Thousands of revisions

    inspirationally
    Participant

    @inspirationally

    Thanks, Edgar, I can see, if this solves the problem, but actually…well…I don’t even want to disable revisions completely. For my blog pages, they were a nice feature…to have an older version available if one of the editors did something wrong.

    //edit: deleted those revisions again, there were over 1000 since yesterday evening. if they come, they seem to come in a batch. All posts (or some posts) of one topic, i guess. As if a google bot or something calls all edit pages of the posts at the same time.

    //edit2: no new revisions so far, but if it is possible to just disable those revisions just for bbpress (even if that checkbox IS checked), it’d be great.

    In reply to: Thousands of revisions

    inspirationally
    Participant

    @inspirationally

    Hm, the topic is showing as 1 year 6 months old…as freshness, although i started it an hour ago. Hopefully this reply will change that.


    inspirationally
    Participant

    @inspirationally

    Kaliceos posted already above an answer to my – the same – problem:

    Forums index in the same layout as other bb software


    but I did write Adam yet regarding that problem.

    I simply commented out

    #add_filter('bbp_has_forums', 'tehnik_bpp_filter_forums_by_permissions', 10, 2);
    

    in tehnik_bbp_forum.php –
    that way the forums still show up, but they cannot be entered without permissions.
    If they are not visible would be better, of course.

    I also commented out

    #if (current_user_can('read_hidden_forums'))
            #$post_stati[] = bbp_get_hidden_status_id();
    

    btw, because I did not want the moderators to enter the hidden forums. Just because they can move threads doesn’t mean they should take a look at the crew forum for the main site.


    inspirationally
    Participant

    @inspirationally

    Allright, found it in single-forum-content.php –

    <?php if ( !bbp_is_forum_category() && bbp_has_topics( array( 'meta_key' => '_bbp_language', 'meta_value' => 'German' ) ) ) : ?>

    should work


    inspirationally
    Participant

    @inspirationally

    I thought, multisite is a bit too much when everything else (themes) is the same –
    also, I wanted to use the “topics to posts” plugin, and this was (after some research) not possible with multisite – this was the main reason.


    inspirationally
    Participant

    @inspirationally

    I just installed my forum at http://mydomain.com/forums, which is the same as http://myseconddomain.com/forums – and used

    1. the multidomain plugin https://wordpress.org/plugins/multidomain/

    2. templates and menus based on the domain you see – this includes a different index loop file and different custom menu.

    This also works with subdomains.

    Here the code of index.php:

    <?php
    /**
     * The main template file.
     *
     * This is the most generic template file in a WordPress theme
     * and one of the two required files for a theme (the other being style.css).
     * It is used to display a page when nothing more specific matches a query. 
     * E.g., it puts together the home page when no home.php file exists.
     * Learn more: https://codex.wordpress.org/Template_Hierarchy
     *
     * @package WordPress
     * @subpackage Twenty_Ten
     * @since Twenty Ten 1.0
     */
    
    get_header(); ?>
    
    <?php if ( $_SERVER['SERVER_NAME'] == 'mydomain.com' ) { ?>
    
    			<?php
    			/* Run the loop to output the posts.
    			 * If you want to overload this in a child theme then include a file
    			 * called loop-index.php and that will be used instead.
    			 */
    
    			 get_template_part( 'loop', 'index-mydomain' );
    			?>
    <?php } elseif ( $_SERVER['SERVER_NAME'] == 'myseconddomain.com' || $_SERVER['SERVER_NAME'] == 'sub.mydomain.com'  ) { ?>
    
    			<?php
    			/* Run the loop to output the posts.
    			 * If you want to overload this in a child theme then include a file
    			 * called loop-index.php and that will be used instead.
    			 */
    
    			 get_template_part( 'loop', 'index-myseconddomain' );
    			?>			
    <?php } ?>
    
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>
    

    Then there is loop for the main site, and one for the forum including the forum overview.

    In the header I have

    <?php if ( $_SERVER['SERVER_NAME'] == 'mydomain.com ) { ?>
    <?php wp_nav_menu( array('container_class' => 'menu','menu' => 'Mydomain.org' )); ?>
    <?php } elseif ( $_SERVER['SERVER_NAME'] == 'myseconddomain.com' || $_SERVER['SERVER_NAME'] == 'sub.mydomain.com'  ) { ?>
    <?php wp_nav_menu( array('container_class' => 'menu','menu' => 'Myseconddomain.com' )); ?>
    <?php } ?>
    

    (the same for sidebar widgets etc.)

    Of course you could work with special forum templates for the forum sites.

    (real example see johnny-depp.org/deppheads.com)

    I think, I will have to add some kind of rewrite to not have duplicate content in the future.


    inspirationally
    Participant

    @inspirationally

    Aaaah there we have it. I use Tehnik BBPress Permissions, too!
    Now I have to see how to combine both. With deactivating your code works perfectly!

    Thanks so much!!


    inspirationally
    Participant

    @inspirationally

    This was exactly, what I needed –
    but unfortunately it does not completely work for me.
    I have 4 categories with subforum (some even sub-subforums) each.

    The code displays now 4 times the WHOLE forum the usual way, just with the 4 different categories as headlines. Any idea? See here: http://deppheads.johnny-depp.org/forums/all-forums/

    Do you have any idea? I copied your code 1:1. Somehow it doesn’t seem to catch the “new” parent forum for the subforums display. I guess.


    inspirationally
    Participant

    @inspirationally

    Found out –
    you can simply use Widgets inside your template.

    I also installed the tehnik-bbpress-permissions plugin to not show the hidden forums topics and put this into my template:

    <?php the_widget( 'Tehnik_BBP_Replies_Widget', $instance, $args ); ?> 
    

    This should work with the default BBP Replies Widget, too (just need to find out the name of it)

    Will try a bit more customization today with an eye on https://codex.wordpress.org/Function_Reference/the_widget

    Another possibility is manually:

    	<?php do_action( 'bbp_template_before_topics_index' ); ?>
    
            <?php if ( bbp_has_topics( array( 'author' => 0, 'show_stickies' => false, 'order' => 'DESC', 'post_parent' => 'any', 'posts_per_page' => 5 ) ) ) : ?>
                    <?php bbp_get_template_part( 'bbpress/loop', 'recent-topics' ); ?>
            <?php else : ?>
                    <?php bbp_get_template_part( 'bbpress/feedback', 'no-topics' ); ?>
            <?php endif; ?>
    
    	<?php do_action( 'bbp_template_after_topics_index' ); ?>

    inspirationally
    Participant

    @inspirationally

    Did you find out already? I wanted to do the same.


    inspirationally
    Participant

    @inspirationally

    I think I can do a live import now. With keeping my WBB Bridge plugin and the old user table, the can still log in.

    I did these changes/additions:

    `
    // User nice name.
    $this->field_map[] = array(
    ‘from_tablename’ => ‘wcf1_user’,
    ‘from_fieldname’ => ‘username’,
    ‘to_type’ => ‘user’,
    ‘to_fieldname’ => ‘user_nicename’,
    ‘callback_method’ => ‘callback_nicename’
    );

    /**
    * This makes the nicename nice to make profile urls work
    */
    public function callback_nicename( $nicename ) {
    //lower case everything
    $nicename = strtolower($nicename);
    //make alphaunermic
    $nicename = preg_replace(“/[^a-z0-9_\s-]/”, “”, $nicename);
    //Clean multiple dashes or whitespaces
    $nicename = preg_replace(“/[\s-]+/”, ” “, $nicename);
    //Convert whitespaces and underscore to dash
    $nicename = preg_replace(“/[\s_]/”, “-“, $nicename);
    return $nicename;
    }
    `


    inspirationally
    Participant

    @inspirationally

    Wow, great work!! Thank you so much!
    Baby sleeping, big one sent to kindergarden, so I have a bit of time, too.

    Little changes in your version:

    replaced

    			'from_tablename'  => 'forum',
    

    with

    			'from_tablename'  => 'wbb1_1_board',
    

    at forum status and forum board

    (Btw. everyone may use another board ID!!!) I have 1, some may also have wbb2_1_board and wcf2_ or even wbb1_2_board (if they have a second board – you can install two baords in one WCF – Community Framework – this is to change individually. The same goes for the language IDs. There may be more/different languages.

    Signature import works (will have to see how to implement that later for buddypress maybe), just special characters don’t convert: “there’s Johnny.— – but that’s just a mini error,
    languages work, too (I just have to see how to implement it),
    I have whole topics with all their answers (what I did not have yesterday – instead a headache).
    Categories work quite perfect, too!
    Closed forums -> no idea, because I don’t have any. But it sounds correct.
    BBCodes have been converted, too, besides a few like [align=center]

    The sortOrder does NOT work. Simply, because that field exists in wbb1_1_board, but it is empty.
    This is saved in wbb1_1_board_structure with the fields parentID boardID and position.
    I tried a table join here again and probably destroyed your clean coding once again. But it works, I just tested!!
    See the updated wbb.txt from the top!!

    The author thing is bad,
    It’d be great if they even were anonymous and not ME. Actually there are some pretty silly posts there, and I keep replying to myself this way. Hmmm…
    But I can solve it with manually replacing User ID 1 with 0 where it is a topic or reply for now to MAKE it anonymous.

    I tried – because of the smilies not working and the special chars in the signature – an import with uncommenting the last lines (see wbb.txt)
    Some Special Characters still wrong, but who cares for the few? as long as ä ö ü ß from German language work, everything is fine.
    Smilies started to work. Great!!

    So the only thing left is the author and the passwords.
    I tried to implement parts of a paid plugin WBB Bridge here, but even that didn’t work (plus we cannot simply use it because of the license)


    inspirationally
    Participant

    @inspirationally

    I’m too silly, damn. This is over my intelligence.
    I have the problem, that the posts have the wrong post_parent, so that two topics are merged curiously.

    For example Post ID 9257 from the WBB board is attached to Thread ID 9257 from the old board, and I cannot see what I have to change. Please please help!
    This took me now over 2 hours changing things and I haven’t found it. I guess it is this part, but I have no idea what to change:

    // Parent Post ID.
    		// Note: We join the posts table because this needs to be the fist post of a topic.
    		$this->field_map[] = array(
    			'from_tablename'  => 'wbb1_1_thread',
    			'from_fieldname'  => 'firstPostID',
    			'join_tablename'  => 'wbb1_1_post',
    			'join_type'       => 'INNER',
    			'join_expression' => 'USING (threadID) WHERE wbb1_1_thread.threadID = wbb1_1_post.threadID',
    			'to_type'         => 'reply',
    			'to_fieldname'    => 'post_parent',
    		);
    		

    I updated the wbb.txt above (where I also linked the WBB database structure).


    inspirationally
    Participant

    @inspirationally

    Hmm…unfortunately, all the posts written by unregistered users are assigned to ME (UserID = 1) automatically. Is there any possibility to give them the user ID 0 (=Anonymous) and in that case also save the username in postmeta?

    // Reply unregistered author name (stored in postmeta)
    		$this->field_map[] = array(
    			'from_tablename'  => 'wbb1_1_post',
    			'from_fieldname'  => 'username',
    			'to_type'         => 'reply',
    			'to_fieldname'    => '_bbp_anonymous_name',
    		);
    		

    inspirationally
    Participant

    @inspirationally

    Allright, another thing I need help with:

    In WBB, there's the field isClosed to create a WordPress status from it with this:
    // Topic status (Open or Closed)
    		$this->field_map[] = array(
    			'from_tablename'  => 'wbb1_1_thread',
    			'from_fieldname'  => 'isClosed',
    			'to_type'         => 'topic',
    			'to_fieldname'    => 'post_status',
    			'callback_method' => 'callback_topic_status'
    		);

    and

    public function callback_topic_status( $status = 0 ) {
    		switch ( $status ) {
    			case 1 :
    				$status = 'closed';
    				break;
    
    			case 0  :
    			default :
    				$status = 'publish';
    				break;
    		}
    		return $status;
    	}

    But there’s also a field called “isDeleted”, so I could also use

    `// Topic status (Deleted)
    $this->field_map[] = array(
    ‘from_tablename’ => ‘wbb1_1_thread’,
    ‘from_fieldname’ => ‘isDeleted’,
    ‘to_type’ => ‘topic’,
    ‘to_fieldname’ => ‘post_status’,
    ‘callback_method’ => ‘callback_trash_status’
    );`

    and

    public function callback_trash_status( $status = 1 ) {
    		switch ( $status ) {
    			case 1 :
    				$status = 'trash';
    				break;
    
    			case 0  :
    			default :
    				$status = 'publish';
    				break;
    		}
    		return $status;
    	}

    The second, though, would overwrite the first, so that even closed topics that are not trash have the status publish again. Is there any chance to combine these two?

Viewing 25 replies - 1 through 25 (of 27 total)