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

    Hi Brendan,
    When registering the form you can register the callback to be called after post is saved

    
    
    'update_callback'       => 'buddydev_form_saved_callback',
    
    

    Now, In the callback, you can redirect as you please.
    Here is how the function should look like

    
    
    /**
     * This gets called when a post is saved/updated in the database
     * after create/edit action handled by BP simple front end post plugin
     *
     * @param int                      $post_id post id.
     * @param boolean                  $is_new is new post.
     * @param BPSimpleBlogPostEditForm $form_object form.
     */
    function buddydev_form_saved_callback( $post_id, $is_new, $form_object ) {
    // do a redirect here.
    }
    
    

    You get the post id, whether is was a new post or an edit post and the form object.

    I hope you can take from there.

    Best Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25472

    Hi Sujee,
    are you using a normal post for this? or do you want to use a custom post type? I will be happy to share the complete code for achieving it.

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25472

    Hi Sujee,
    You are correct in your assumptions.

    About 3rd:- yes, you are right about that. We can use WP_Query to fetch for the first time and cache the post id in transient for later use. That way, It can be flexible as well as efficient.

    Since we are setting the user at author of the post, we can fetch it based on the post type + author combination.

    Best Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25472
  • Keymaster
    (BuddyDev Team)
    Posts: 25472

    Hi Brendan,
    sorry about that.

    Here is how it works:-

    WordPress needs the user to have ‘upload_files’ and ‘edit_post’ capability to allow user upload and then attach the uploaded media to post.

    Since this is a common thing, The plugin does it if you are using the form on any of the BuddyPress section.

    If you are not using it from BuddyPress section, we need to manually enable it.

    For now, I will suggest putting it in your theme’s functions.php as we need the capability to be updated for ajax upload too.

    Please give a try and let me know what happens.

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25472

    Hi Herve,
    Here is the code for three

    
    /**
     * Exclude BuddyPress activity types form listing.
     *
     * @param array $args activity args.
     *
     * @return array
     */
    function buddydev_exclude_activity_types( $args ) {
    
        // do not modify if the scope is laready set.
    	if ( ! empty( $args['scope'] ) ) {
    		return $args;
    	}
        // exclude the activity types if scope is not set.
    	$args['filter_query'] = array(
    		array(
    			'column'  => 'type',
    			'value'   => array( 'friendship_created', 'new_member', 'updated_profile' ),
    			'compare' => 'NOT IN'
    		)
    	);
    
    	return $args;
    }
    
    add_filter( 'bp_after_has_activities_parse_args', 'buddydev_exclude_activity_types' );
    

    Hope this helps.

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25472

    Hi Sujee,
    You are welcome.

    If you want, I can assist with the code. It is pretty easy to accomplish

    1. Register private post type
    2. In the author box select the assigned counsellor as author
    3. Add the actual content for that counsellor.
    4. Create a simple shortcode to fetch the post for that user and that’s all.

    I believe It may be helpful for others too using the BuddyPress Profile Tabs Pro plugin.

    Best regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25472

    Thank you for clarifying.

    In my view, It will make much more sense to have a post type for the counsellors home content and assign a content page entry to a counsellor. After that, you simply put a shortcode in the home tab and it shows the content for that counsellor.

    That way, you can manage the content in better way and also won’t have to create too many tabs for the counsellors.

    What do you think of this approach?

  • Keymaster
    (BuddyDev Team)
    Posts: 25472

    Hi Sujee,
    Thank you for clarifying.

    Sorry, the above code I suggested works on the basis of member type.

    Before assisting further, May I ask what you need to create different home pages for different counsellors? Is it because you want to show different content or is there any other reason?

    Thank you
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25472

    Hi Julia,
    I am rephrasing your question

    1. Do you want to disable access to site admin’s profile?
    2. I am still confused, please clarify.

    3. Do you want the logged in users to be unable to check site’s home page and when they try to check home page they should be redirected to their profile?

    Thank you
    Brajesh