Skip to:
Content
Pages
Categories
Search
Top
Bottom

Topic only shows while logged in


  • NeoTechni
    Participant

    @neotechni

    Using this code I am able to programmatically create a forum post, but it only shows to users who are logged in (when using the bbp-single-topic shortcode) How can I get that topics to show while logged out?

    
    	function createforumpost($text, $forums_id, $unique_id, $fighter_name = false){
    		if(is_null($forums_id) || !$forums_id){
    			if(!$fighter_name){
    				$fighter_name	= explode("-", $unique_id);
    				foreach($fighter_name as $index => $word){
    					$fighter_name[$index] = ucfirst($word);
    				}
    			}
    			$forum_post = array(
    			  'post_title'    	=> $fighter_name,
    			  'post_content'  	=> $text,
    			  'post_name'	  	=> $unique_id,
    			  'post_status'   	=> 'publish',
    			  'comment_status'	=> 'closed',
    			  'post_type'		=> 'topic',
    			  'post_parent'		=> 75857,
    			  'post_author'   	=> 1,
    			);
    			$forum_post["ID"] = wp_insert_post($forum_post);
    			return $forum_post["ID"];
    		}
    		return $forums_id;
    	}
    
Viewing 1 replies (of 1 total)

  • Robin W
    Moderator

    @robin-w

    I’d suggest you check out

    function bbp_new_topic_handler

    on line 96 of

    includes\topics\functions.php

    for how a new topic is created

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