liderxlt (@liderxlt)

Forum Replies Created

Viewing 6 replies - 1 through 6 (of 6 total)
  • In reply to: Repair tool with cron

    liderxlt
    Participant

    @liderxlt

    Hello, thanks for answering @robin-w
    I’m using an import plugin called wpallimport.

    Do you suggest that when importing, update the topic or reply data that you are importing at that moment?

    If possible, I would like to do it with a scheduled task since I have more than 100 daily imports with a pro- file of 300 imported records for each one. Imports are scheduled to run between 13 pm and 17 pm.

    I think that if I execute repair only once (5:30 pm) I will demand less from my server and I will be able to import it faster.


    liderxlt
    Participant

    @liderxlt

    Update with more information, I am using the wpallimport plugin, it allows to use PHP functions.

    Which allow to add hooks before, during and after importing.
    All the information here >> http://www.wpallimport.com/documentation/advanced/action-reference/

    <?php
    
    add_action( 'pmxi_saved_post', 'soflyy_forum_data', 10, 3 );
    
    function soflyy_forum_data( $post_id, $xml_record, $is_update ) {
    	$exped = array('1','3','5','7','9','11');//ID OF THE FILE OF TOPIC
    	$actualiz = array('2','4','6','8','10','12');//ID OF THE FILE OF REPLY
    	$import_id = ( isset( $_GET['id'] ) ? $_GET['id'] : ( isset( $_GET['import_id'] ) ? $_GET['import_id'] : 'new' ) );
    
    	if ( in_array($import_id,$exped) ) {
    		// Topics import - 1 esel id de la importacion
    		$parent_forum = get_post_meta( $post_id, '_bbp_forum_id', true );
    		if ( $parent_forum != 0 ) {
    			$args = array(
    				'ID' => $post_id,
    				'post_parent' => $parent_forum
    				);
    			wp_update_post( $args );
    			update_post_meta( $post_id, '_bbp_topic_id', $post_id );
    			update_post_meta( $post_id, 'post_alter_id', $post_id );
    			update_post_meta( $post_id, '_bbp_last_active_time', date( "Y-m-d H:i:s", time() ) );
    		}
    	} elseif ( in_array($import_id,$actualiz) ) {
    		// Replies import - 2 esel id de la importacion
    		$old_topic_id = get_post_meta( $post_id, '_bbp_topic_id', true );
    		$post = get_posts( array(
    			'post_type' => 'topic',
    			'meta_key' => '_old_topic_id',
    			'meta_value' => $old_topic_id
    			) );
    		if ( $post ) {
    			$new_topic_id = $post[0]->ID;
    			$args = array(
    				'ID' => $post_id,
    				'post_parent' => $new_topic_id
    				);
    			wp_update_post( $args );
    			update_post_meta( $post_id, '_bbp_topic_id', $new_topic_id );
    			update_post_meta( $post_id, '_edit_last', 1 );
    			
    			//wp_update_post( $post_id,'post_parent',$new_topic_id );
    		}
    	}
    }
    ?>
    

    I have tried adding hooks like

    add_action( 'pmxi_update_post_meta','bbp_notify_subscribers',10,3);
    add_action( 'bbp_new_reply','bbp_notify_topic_subscribers', 10, 3 );
    add_action( 'bbp_new_reply','bbp_notify_topic_subscribers', 10, 3 );

    But without success.

    I hope this information is useful.

    regards…


    liderxlt
    Participant

    @liderxlt

    It’s a bit complicated import, I need something more complete. Thanks for your answer.

    Regarding the plugin, I have removed the topic id and it works.


    liderxlt
    Participant

    @liderxlt

    Thanks for answering…
    As I mentioned in the open topic today https://bbpress.org/forums/topic/do-not-see-the-topic-in-forum/ What I did was prepare an xml file with the information to upload in the forums , topic and replies.

    I am using the plugin all import to load because it allows me to use cron tasks daily, not overload the server and not rewrite what is already loaded.

    I can do the import and visualize it correctly in the dashboard. The problem is that it is not displayed in the frontend. As far as I could see the post_parent of the topic is 0 … It must be equal to _bbp_forum_id.

    These are the parameters for the topic:
    _bbp_topic_id = 2231
    _bbp_forum_id = 2229
    _bbp_reply_count = 0
    _bbp_voice_count = 1
    _bbp_forum_parent_id = 2229

    Parameters replies:
    _bbp_topic_id = 2231
    _bbp_forum_id = 2229
    the_reply_parent_topic_id = 2229

    The other parameters, such as Post Status, are already automated.
    The good thing about the import plugin is that it allows you to introduce functions in import http://www.wpallimport.com/documentation/advanced/execute-php/

    I leave an extract of the topic export, there you can see how it takes the values but not the post_parent one

    <title>2586/15</title>
    		<link>http://localhost/expedientes/forums/topic/2586-15/</link>
    		<pubDate>Fri, 19 Jan 2018 03:22:16 +0000</pubDate>
    		<dc:creator><![CDATA[liderxlt]]></dc:creator>
    		<guid isPermaLink="false">http://localhost/expedientes/forums/topic/2586-15/</guid>
    		<description></description>
    		<content:encoded><![CDATA[<p style="text-align: center;"><strong><span style="text-align: start;">
    <strong>CAUSA:</strong> JUICIO EJECUTIVO]]></content:encoded>
    		<excerpt:encoded><![CDATA[]]></excerpt:encoded>
    		<wp:post_id>2113</wp:post_id>
    		<wp:post_date><![CDATA[2018-01-19 00:22:16]]></wp:post_date>
    		<wp:post_date_gmt><![CDATA[2018-01-19 03:22:16]]></wp:post_date_gmt>
    		<wp:comment_status><![CDATA[closed]]></wp:comment_status>
    		<wp:ping_status><![CDATA[closed]]></wp:ping_status>
    		<wp:post_name><![CDATA[2586-15]]></wp:post_name>
    		<wp:status><![CDATA[publish]]></wp:status>
    		<wp:post_parent>0</wp:post_parent>
    		<wp:menu_order>0</wp:menu_order>
    		<wp:post_type><![CDATA[topic]]></wp:post_type>
    		<wp:post_password><![CDATA[]]></wp:post_password>
    		<wp:is_sticky>0</wp:is_sticky>
    		<category domain="topic-tag" nicename="2586-15"><![CDATA[2586/15]]></category>
    		<wp:postmeta>
    			<wp:meta_key><![CDATA[_bbp_activity_id]]></wp:meta_key>
    			<wp:meta_value><![CDATA[10]]></wp:meta_value>
    		</wp:postmeta>
    		<wp:postmeta>
    			<wp:meta_key><![CDATA[_bbp_author_ip]]></wp:meta_key>
    			<wp:meta_value><![CDATA[120.000.001]]></wp:meta_value>
    		</wp:postmeta>
    		<wp:postmeta>
    			<wp:meta_key><![CDATA[_bbp_last_active_time]]></wp:meta_key>
    			<wp:meta_value><![CDATA[2016-02-03]]></wp:meta_value>
    		</wp:postmeta>
    		<wp:postmeta>
    			<wp:meta_key><![CDATA[_bbp_reply_count]]></wp:meta_key>
    			<wp:meta_value><![CDATA[0]]></wp:meta_value>
    		</wp:postmeta>
    		<wp:postmeta>
    			<wp:meta_key><![CDATA[_bbp_voice_count]]></wp:meta_key>
    			<wp:meta_value><![CDATA[1]]></wp:meta_value>
    		</wp:postmeta>
    		<wp:postmeta>
    			<wp:meta_key><![CDATA[_wp_page_template]]></wp:meta_key>
    			<wp:meta_value><![CDATA[default]]></wp:meta_value>
    		</wp:postmeta>
    		<wp:postmeta>
    			<wp:meta_key><![CDATA[_bbp_forum_id]]></wp:meta_key>
    			<wp:meta_value><![CDATA[1327]]></wp:meta_value>
    		</wp:postmeta>
    		<wp:postmeta>
    			<wp:meta_key><![CDATA[_bbp_forum_parent_id]]></wp:meta_key>
    			<wp:meta_value><![CDATA[1327]]></wp:meta_value>
    		</wp:postmeta>
    		<wp:postmeta>
    			<wp:meta_key><![CDATA[post_parent]]></wp:meta_key>
    			<wp:meta_value><![CDATA[1327]]></wp:meta_value>
    		</wp:postmeta>
    		<wp:postmeta>
    			<wp:meta_key><![CDATA[wp_get_post_parent_id]]></wp:meta_key>
    			<wp:meta_value><![CDATA[1327]]></wp:meta_value>
    		</wp:postmeta>
    		<wp:postmeta>
    			<wp:meta_key><![CDATA[parent_id]]></wp:meta_key>
    			<wp:meta_value><![CDATA[1327]]></wp:meta_value>
    		</wp:postmeta>
    	</item>

    Can it be solved with the correct function?
    Thanks for your time @netweb


    liderxlt
    Participant

    @liderxlt

    Hi Mike!
    I have the same problem. https://bbpress.org/forums/topic/do-not-see-the-topic-in-forum/
    Have you been able to solve the problem? I’m almost sure it’s the post_parent although I still can not assign a value to that paramenter. If I could do it with the others _bbp_forum_id, _bbp_reply_count, etc.

    When I’m doing the import I tried to force it with the function

    <?php
    function pariente($id){
      	include "wp-load.php";  
    	wp_get_post_parent_id( $id );
    	return ;
    }
    ?>

    But I have not succeeded


    liderxlt
    Participant

    @liderxlt

    Resetting the permalinks does not work.

    If I access the topic directly website / topics /. com if I can see all.
    An observation that may help. If I enter the topic from the dashboard and update it if they appear in the forum.

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