michaelgoal (@michaelgoal)

Forum Replies Created

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

  • michaelgoal
    Participant

    @michaelgoal

    Thanks,
    My mission is to overwrite the default category.
    On the page where i can create a new post i have the parent ID in the URL like ?vis=92
    Then i want to make a function, so i can add the category related to the parent ID, to the new post.
    It means that i will overwrite the default category.
    Any ideas how this function should look like?

    I know its a wp subject now. Maybe i should move it to the wp forum?


    michaelgoal
    Participant

    @michaelgoal

    I have this now, but how do i assigm $kat_id to tthe Blog post category when i submit my Blogpost?

    function add_content_before_first_reply_content($content,$id){
    
    	$post = get_post($id);
    	$topic_id = bbp_get_topic_id();
    	$reply_id = bbp_get_reply_id();
    	
    	$hf_user = wp_get_current_user();
    	$hf_username = $hf_user->user_login;
    	
        $kat_id = wp_get_post_parent_id($post);
    	
    	
        $content_to_add =&quot;<a href=&quot;create-new-post?vis=$kat_id>&nbsp;Add new blog &nbsp;</a>
    	
    	if ($topic_id === $reply_id) {
    		// do whatever you need to in  here
    		$content .= $content_to_add;
    	}
    
    	return $content;
    
    }
    add_filter( 'bbp_get_reply_content', '

    michaelgoal
    Participant

    @michaelgoal

    I have this in my url:
    /create-new-post/?vis=current_user_id

    current_user_id should be userid as a number for logged in user.
    And i would like to bring Postid to create-new-post page too..

    Any ideas how it works in bbpress ?


    michaelgoal
    Participant

    @michaelgoal

    function is like this and not what i posted before:
    and my problem is this:
    ?vis=$current_user_id (you can see it if you are going to the link “Add new blog”)

    function add_content_before_first_reply_content($content,$id){
    
    	$post = get_post($id);
    	$topic_id = bbp_get_topic_id();
    	$reply_id = bbp_get_reply_id();
    	$current_user_id = get_current_user_id();
    	$content_to_add = '<a href="\create-new-post?vis=$current_user_id">&nbsp;Add new blog 
                              &nbsp;&nbsp;</a>';
    
    	if ($topic_id === $reply_id) {
    		
    		$content .= $content_to_add;
    	}
    
    	return $content;
    
    }
    add_filter( 'bbp_get_reply_content', 'add_content_before_first_reply_content', 99, 2 );

    michaelgoal
    Participant

    @michaelgoal

    I found this. With this function im able to insert some content in the first reply.
    But this part dont work out, it just shows text and not which user id it is…:
    <a href=\create-new-post?vis=$current_user_id\
    How can i get a variable, here user_id, to create-new-post page ?
    I have tried with “$current_user_id ” and ‘$current_user_id’ …..

    function add_content_before_first_reply_content($content,$id){

    $post = get_post($id);
    $topic_id = bbp_get_topic_id();
    $reply_id = bbp_get_reply_id();
    $current_user_id = get_current_user_id();
    $content_to_add = ‘ Add new blog
      
    ‘;

    if ($topic_id === $reply_id) {
    // do whatever you need to in here
    $content .= $content_to_add;
    }

    return $content;

    }
    add_filter( ‘bbp_get_reply_content’, ‘add_content_before_first_reply_content’, 99, 2 );

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