Shape the future of Social networking with WordPress: Join Project Midnight Sun! The next generation platform for community building with WordPress!

BuddyDev

Search

Replies

  • Keymaster
    (BuddyDev Team)
    Posts: 25363

    Hi Ada,
    I am sorry. I will post the code tonight.

    Thank you
    Brajesh

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

    Hi Leo,
    Thank you for the details.

    1. Are you using any custom code to assign categories or terms? Please post me the custom codes you are using.
    2. The two forms are different and even if they are being edited from same place, should have different setup unless some custom code is being used to assign/manipulate categories.

    There is no problem in using categories.

    I will be contacting the wpml.org about the plan. Hoping that it will help us in providing compatible plugins in future.

    Thank you
    Brajesh

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

    Hi Leo,
    Thank you. I will look into it and will get back to you in next couple of hours.

    Thank you
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25363

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

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25363
    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: 25363

    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: 25363
    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: 25363
    This reply has been marked as private.
  • Keymaster
    (BuddyDev Team)
    Posts: 25363

    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: 25363

    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