New
PeoplePress is here. Community building for WordPress, reimagined. Fast, modern, and built for the communities you've always wanted to run.
See it live

BuddyDev

Search

Replies

  • Keymaster
    (BuddyDev Team)
    Posts: 25513

    Hi,
    Welcome to BuddyDev.

    Thank you for using MediaPress.

    Here is the code that you can use to create a gallery when a user activates their account.

    
    
    /**
     * Create gallery on user activation.
     *
     * @param int $user_id user id.
     */
    function mpp_custom_create_gallery_on_account_activation( $user_id ) {
    	// make sure that user gallery functions are available.
    	if ( ! function_exists( 'mpp_create_gallery' ) ) {
    		return;
    	}
    
    	$display_name = bp_core_get_user_displayname( $user_id );
    
    	// does this user has predefined gallery?
    	// we use this check to avoid same type of gallery again and again for the user(we most probably don't need it).
    	if ( ! get_user_meta( $user_id, '_mpp_predefined_gallery_photo_1', true ) ) {
    		// No, then we need to create it.
    		// repeat it as you want.
    		$gallery_id = mpp_create_gallery(
    			array(
    				'creator_id'   => $user_id,
    				'title'        => $display_name,
    				'description'  => '', // add description if any.
    				'status'       => mpp_get_default_status(), // can use any of the status e.g. 'public' , 'private', 'loggedin', 'friends' etc.
    				'component'    => 'members', // for user.
    				'component_id' => $user_id, // no need to change.
    				'type'         => 'photo', // can change to "audio", "video", "doc".
    			)
    		);
    
    		// let us keep the id in usermeta to avoid creating it again, right?
    		if ( ! is_wp_error( $gallery_id ) ) {
    			// you can change the key to anything.
    			update_user_meta( $user_id, '_mpp_predefined_gallery_photo_1', $gallery_id );
    		}
    	}
    }
    
    add_action( 'bp_core_activated_user', 'mpp_custom_create_gallery_on_account_activation' , 2 );
    
    

    Please do not use the shortcode for asking user to upload. Instead, redirect user to their gallery. They can upload from there.

    3. Restricting creation. This is a bit tricky in your case. It is very easy to disable gallery creation. In your case, restricting based on number of gallery is a bit tricky.

    I will see if I can put some code quickly today. Otherwise, will suggest using a plugin.

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25513

    Hi Noha,
    Thank you for the patience.
    I have pushed the updated today. Please check.

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25513
    Brajesh Singh on in reply to: Profile Tabs Feedback and Assistance #24979

    Hi Mike,
    Thank you for using the plugin and you suggestions.

    1. I will add a back link at bottom to make it easy.
    2. Since we are using the post type internally for tabs, the listing screen follows default WordPress way(same way you visit your Dashboard->Posts screen). For now, I am unable to enhance the list filtering experience(can be done in future though).

    3. For the blogs, I will check and get back to you. It could be a bug. I will get back at the end of the day(PST) with a solution.

    4. For member type, I will reply on your topic regarding use of member types.

    Thank you
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25513

    Hi Terry,
    Thank you for sharing the details.

    1st you will need to import the images as WordPress media. Once you have done it, you can use

    
    mpp_update_media_cover_id($media_id, $cover_media_id);
    

    to set the cover for $media_id.

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25513
    Brajesh Singh on in reply to: Member Types – Alphabetical Order #24976

    Hi Mike,
    Thank you for the topic.

    I have got the exact same request from another member. I will be putting some solution inside the plugin in a day to two.

    For “None”, I will post back in the other topic.

    Thank you
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25513

    Hi John,
    Since checkbox represents Yes/no, we used it.

    Your implementation is correct too as you have moved from checkbox to radio. Thank you for sharing.

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25513
    Brajesh Singh on in reply to: Badge images css #24974

    Hi Mike,
    Thank you.

    We are pushing an update this week for sure.

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25513
    Brajesh Singh on in reply to: Additional custom tabs on group page #24973

    Hi Slaven,

    Thank you for the question.

    You will need to modify that code to make it work(adapt it as per your need).

    We do have a paid plugin that allows adding tabs without writing code
    https://buddydev.com/plugins/buddypress-group-tabs-creator-pro/

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25513
    Brajesh Singh on in reply to: [Resolved] Custom avatar for gender #24972

    Hi Slaven,
    Thank you for opening the topic.
    Please do the following

    1. Change

    
    $field_id_or_name = "field_19";
    
    

    to

    
    
    $field_id_or_name = 19;
    

    I am assuming that 19 is your field id.

    Does that make it work?

    If not, please visit Dashboard->Users->Profile Field and edit the field.
    Please make sure to disable “Autolinking” form the right side and save. Now, check again and let me know if it works or not?

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25513

    Hi Richard,
    I am sorry to hear that you are unable to use it. I will be working on MediaPress after 5th September.

    I have been holding most of the critical changes due to the issue of migration of old data. The first priority is to get a basic migrator running and then we can go ahead with comments update and even structural changes to our gallery/media storage(introducing custom table for fast access).

    I will keep updated.

    Regards
    Brajesh