Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author wordplus

    (@wordplus)

    Hi there!

    Im not sure what you mean, but if you want to generate thread dynamically, this is example I using usually.

        $post_id = get_the_ID();
        $post = get_post( $post_id );
    
        $thread_id = (int) get_post_meta($post->ID, 'conversation_thread_id', true);
    
        if( ! $thread_id ){
            $last_thread = intval($wpdb->get_var("SELECT MAX(thread_id) FROM <code>&quot; . bpbm_get_table('messages') . &quot;</code>;"));
            $thread_id = $last_thread + 1;
    
            $wpdb->insert(
                bpbm_get_table('messages'),
                array(
                    'sender_id' => 0,
                    'thread_id' => $thread_id,
                    'subject'   => get_the_title( $post->ID ), //
                    'message'   => '<!-- BBPM START THREAD -->'
                )
            );
    
            update_post_meta($post->ID, 'conversation_thread_id', $thread_id);
        }
    
        $_GET['thread_id'] = $thread_id;
        echo BP_Better_Messages()->functions->get_page( true );
        echo '<style type="text/css">.bp-messages-wrap .chat-header{padding-left:15px}.bp-messages-wrap .chat-header .back{display: none}</style>';

    Thanks!

    Thread Starter mack1990

    (@mack1990)

    To where I should insert it? function.php?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Speak with random people’ is closed to new replies.