BuddyDev

Search

Replies

  • Participant
    Level: Initiated
    Posts: 12
    Panos on in reply to: [Resolved] Help w/ auto-create gallery code #14752

    I also tried the below code from one of Brajesh’s posts. Still nothing.

    function mpp_custom_auto_create_gallery($user_id) {
    	
    	//make sure that user gallery functions are available
    	if ( ! function_exists( 'mpp_create_gallery' ) ) {
    		return;
    	}
    	
    	//repeatable block
    		$gallery_id = mpp_create_gallery( array(
    			'creator_id'	 => $user_id,
    			'title'			 => 'Pictures',
    			'description'	 => '', //add description if any
    			'status'		 => 'public',//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 ) ) {
    			update_user_meta( $user_id, '_Pictures', $gallery_id ); //you can change the key to anything
    
    		}
    	//end of repeatable block
    	
    	//repeatable block
    		$gallery_id = mpp_create_gallery( array(
    			'creator_id'	 => $user_id,
    			'title'			 => 'Private Album',
    			'description'	 => '', //add description if any
    			'status'		 => 'friendsonly',//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 ) ) {
    			update_user_meta( $user_id, '_Private_Album', $gallery_id ); //you can change the key to anything
    
    		}
    	//end of repeatable block
    	
    	//echo $user_id . '   ' . $gallery_id;
    	
    }
    
    add_action( 'user_register', 'mpp_custom_auto_create_gallery', 10, 1 );
  • Participant
    Level: Initiated
    Posts: 12
    Panos on in reply to: [Resolved] Help w/ auto-create gallery code #14751

    I added an echo to output the $user_id, to make sure it passes and it is.
    I also added an echo to give me the $gallery_id right after “$gallery_id = mpp_create_gallery( array( etc.” and it’s giving me the id which probably means that the gallery is created (I think/hope). So why is it not showing up on the user’s profile? Is there an extra step I’m missing?
    Thanks