Replies
- Tosin on June 7, 2022 at 7:28 am in reply to: [Resolved] Buddyblog change author if post is published in a specific category #45205
YES im sure the anonymous user ID exists.
1. workflow setting = on submission – publish post
2. I also have a custom post taxonomy called (locations)
3. redirect user to = Yes, to the single post screen.
4. im also using the shortcode [bbl-create-by-post-type post_type=’post’] in the (create-new-post) page
5. I also have buddyblog pay per post activeThis is all the buddyblog code I have I dont think there should be any conflict
// Request confirmation before post submission. add_filter( 'bblpro_submission_button_classes', function ( $classes ) { array_push( $classes, 'bbl-confirm-action' ); return $classes; } ); // Buddyblog minimum words for publishing add_filter( 'bblpro_validation_errors', function ( $errors, $data ) { if ( $errors->has_errors() ) { return $errors; } $content = empty( $data['bbl_post_content'] ) ? '' : $data['bbl_post_content']; $words_count = (int) str_word_count( $content ); if ( $words_count < 100 ) { $errors->add( 'bbl_post_content', _x( 'A minimum of 100 words is required to publish.', 'Post form validation message', 'buddyblog-pro' ) ); } return $errors; }, 10, 2 ); /** * Assign (Sponsored Post) category to BuddyBlog pay per post articles on checkout. */ add_action( 'bblpro_ppp_post_published', function( $post_id ) { $post_type = get_post_type( $post_id ); if ( 'post' != $post_type ) { return; } // Get category. $newcat = get_term_by( 'name', 'Sponsored posts', 'category' ); if ( ! $newcat ) { return; } wp_set_post_categories( $post_id, $newcat->term_id, true ); } ); /** * Update BuddyBlog Author when a post is submitted in a specific category. */ add_filter( 'bblpro_post_submission_prepared_data', function ( $post_data, $form_id, $post, $is_submission ) { // update author if the category was selected. Don't do anything on edit. $anonymous_cat_id = 1487; $anonymous_user_id = 4766806; if( ! $is_submission ) { return $post_data; } $selected_terms_ids = isset( $post_data['tax_input'] ) ? (array) $post_data['tax_input'] : array(); $selected_categories = isset( $selected_terms_ids['category'] ) ? (array) $selected_terms_ids['category']: array(); if( ! $selected_categories || ! in_array( $anonymous_cat_id, $selected_categories ) ) { return $post_data; } // Update. $post_data['post_author'] = $anonymous_user_id; // 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 );
- Tosin on June 6, 2022 at 10:00 pm in reply to: [Resolved] Buddyblog change author if post is published in a specific category #45200
I just tested the code but it did not work, the current logged in user is still the post author instead of the assigned anonymous user.
- Tosin on June 6, 2022 at 7:16 pm in reply to: [Resolved] Buddyblog change author if post is published in a specific category #45196
will be expecting your feed back sir.
thanks
- Tosin on June 3, 2022 at 2:20 pm in reply to: [Resolved] Buddyblog change author if post is published in a specific category #45182
1. No I dont want to limit the scope, this update should be applicable to all forms
2. Yes i’m referring to post category (category id = 1487) while use ID that will inherit the submitted post = 4766806
Thanks
- Tosin on June 1, 2022 at 7:05 am in reply to: [Resolved] Buddyblog change author if post is published in a specific category #45153
Kind reminder sir
Thanks
- Tosin on May 30, 2022 at 1:00 pm in reply to: BuddyPress Auto Friendship Pro + BuddyPress Featured Members Feature Suggestion #45135
I want new users to be friends with all the featured members.
- Tosin on May 23, 2022 at 12:59 pm in reply to: [Resolved] Buddyblog change author if post is published in a specific category #45059
I already tested the code but it did not work
- Tosin on May 23, 2022 at 9:31 am in reply to: [Resolved] Buddyblog change author if post is published in a specific category #45053
Hello Brajesh,
Please any update thanks a lot
- Tosin on May 19, 2022 at 11:59 am in reply to: [Resolved] Buddyblog change author if post is published in a specific category #45017
Gentle reminder sir
Thanks
- Tosin on May 15, 2022 at 5:09 pm in reply to: [Resolved] Buddypress confirm action on registration exit #44970
Ohh! cool
thanks Brajesh