👻 Halloween Treat: Our biggest-ever 25% OFF memberships — use SPOOKYSOCIAL before Nov 1! 🎃

BuddyDev

Search

Replies

  • Keymaster
    (BuddyDev Team)
    Posts: 25197

    Thank you Andrew,
    I am happy it is resolved now.

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25197
    Brajesh Singh on in reply to: [Resolved] BP Simple Front End Post Form #3549

    Hi Leo,
    Is it happening for new posts or the old posts? This solution should only work with new posts using the custom form.

    Please let me know and I will check the code.

    Thank you
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25197

    Hi Andrew,
    Now, I can see the problem.

    Field 1140 is not part of your registration forms, so BuddyPress is not saving it even if we put it in the post fields. Earlier, I assumed that you had hidden this field using css and that’s why i suggested the above suggestion.

    For you, a better option will be using the following code

    
    function buddydev_update_related_field( $user_id ) {
    	
    	
    	//get the field value
    	
    	$field_data = xprofile_get_field_data(960, $user_id );
    	
    	if ( ! empty( $field_data ) ) {
    		
    		xprofile_set_field_data( 1140, $user_id, $field_data );
    	}
    	
    }
    add_action( 'bp_core_activated_user', 'buddydev_update_related_field' );
    
    

    On activation, we fetch and update the field. Please test it and let me know if it works or not?

    Thank you
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25197
    Brajesh Singh on in reply to: [Resolved] BP Simple Front End Post Form #3544

    Hi Leo,
    I am sorry. Ravi will be back tomorrow.
    I had a look at the above code and I see that Ravi missed to post the last line.

    Please add this line

    
    $form->show();
    

    after this

    
    $form = bp_get_simple_blog_post_form( $form_id );
    

    That should work.

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25197
    This reply has been marked as private.
  • Keymaster
    (BuddyDev Team)
    Posts: 25197

    Hi Andrew,
    Can you please point me to your registration page. I will be in a much better position to help you if I can see the fields.

    Thank you
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25197

    Hi Phil,
    Please use the following code to assign a default category.

    
    
    //set default categorywhen post is being saved
    function bcg_set_default_category_to_post( $post_id ) {
    	
    	$post = get_post( $post_id );
    	
    	if ( ! $post ) {
    		return ;
    	}
    	
    	$terms = wp_get_object_terms( $post_id, 'category' );
    	
    	if ( empty( $terms ) || ( count( $terms ) == 1 && $terms[0]->term_id == 1 ) ) {
    		
    		$term_id = 32;//please change it with the default term you want to assign
    		
    		wp_set_object_terms( $post->ID, $term_id, 'category' );
    		
    	}
    	
    }
    
    add_action( 'bsfep_post_saved', 'bcg_set_default_category_to_post' );
    
    

    Please make sure to change $term_id to your choice of default term id.

    Hope that helps

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25197

    Closing it as resolved due to lack of reply. Please feel free to reopen if you need further assistance.

    Thank you
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25197

    Hi Phil,
    Ravi will be away for the weekend. I will post the code tonight.
    It is a quick fix and not any paid service.

    Thank you
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25197

    A solution may be deleting the automatically created activity based on tags, but I am not sure if that will be appropriate.