Get 15% off on all our plugins, themes and memberships till 4th December. Use coupon: BLACKFRIDAY2021.

BuddyDev

Search

Buddyblog assign different author to specific form id

Tagged: 

  • Keymaster
    (BuddyDev Team)
    Posts: 19762
    Brajesh Singh on #41655

    Hi Tosin,
    I am sorry for the delays. I am not sure if I can have it in the core now as it is going to be a lot more difficult to explain for us(until we add the support for anonymous posting).

    I will assist you with code by Monday.

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 19762
    Brajesh Singh on #41709

    Hi Tosin,
    I am sorry for the delayed reply.

    The following code will work with next release of BuddyBlog Pro

    
    
    /**
     * Update BuddyBlog Author when a post is submitted.
     */
    add_filter( 'bblpro_post_submission_prepared_data', function ( $post_data, $form_id, $post, $is_submission ) {
    
    	// update author if the form was submitted. Don't do anything on edit.
    	if ( $is_submission && 37232 === (int) $form_id ) {
    		$post_data['post_author'] = 3728;
    		// keep current user data for future?
    		if ( ! empty( $post_data['ID'] ) ) {
    			update_post_meta( $post_data['ID'], '_bbl_original_post_author', get_current_user_id() );
    		}
    	}
    
    	return $post_data;
    }, 10, 4 );
    

    We are changing the post author when the post is submitted(for review or published).

    You can put it in your bp-custom.php and when you upgrade to next version of BuddyBlog Pro(This Friday), It will work.

    Regards
    Brajesh

  • Participant
    Level: Master
    Posts: 487
    Tosin on #41711

    Thanks a lot Brajesh ill be looking forward to the new update. also with this upcoming update will it now be possible to differentiate the shortcode in two different pages by form ID.

    Example
    General form = [bbl-create-by-post-type post_type=’post’ id=’45755′]
    Private form = [bbl-create-by-post-type post_type=’post’ id=’37232′]

  • Keymaster
    (BuddyDev Team)
    Posts: 19762
    Brajesh Singh on #41718

    Hi Tosin,
    Thank you.

    Currently, only one visible form is possible with a post type, you can have different forms with different post type. The reason is we do not store the publishing capability with the form. It is stored with Tabs and the shortcode is for tab form.

    We are working on a generic WordPress posting solution with BuddyBlog Pro where we will store who can publish/edit with the form. That will allow us to have multiple forms with same post type.

    Regards
    Brajesh

  • Participant
    Level: Master
    Posts: 487
    Tosin on #41720

    OHH OK, So I can’t use the code yet until buddyblog will allow to have multiple forms with same post type. i’ll just have to be patient till then since I need to have two different forms (private and public) of the same post stype

You must be logged in to reply to this topic.

This topic is: not resolved