• hi guys i’m trying to follow this article… but giveme some errors..

    https://docs.ultimatemember.com/article/51-custom-profile-tab-example-showing-user-pages, and only shows ‘description’ fields, can somebody help me?, thanks very much =)

    screenshot:

    https://enamorarse.cl/wp-content/uploads/2020/01/Screen-Shot-2020-01-07-at-1.15.27-PM.png

    Notice: Undefined property: um\core\Fields::$set_id in /home/enamorarse/public_html/wp-content/plugins/ultimate-member/includes/core/class-fields.php on line 4461

    the code i’m using

    /*---------------*/
    /**
     * Add a new Profile tab
     * @param array $tabs
     * @return array
     */
    function um_mycustomtab_add_tab( $tabs ) {
    
    	/**
    	 * You could set the default privacy for custom tab.
    	 * There are values for 'default_privacy' atribute:
    	 * 0 - Anyone,
    	 * 1 - Guests only,
    	 * 2 - Members only,
    	 * 3 - Only the owner
    	 */
    	$tabs[ 'mycustomtab' ] = array(
    		'name' => 'Seguimiento',
    		'icon' => 'um-faicon-comment',
    		'custom' => true
    	);
    
    	UM()->options()->options[ 'profile_tab_' . 'mycustomtab' ] = true;
    
    	return $tabs;
    }
    add_filter( 'um_profile_tabs', 'um_mycustomtab_add_tab', 1000 );
    
    /**
     * Render tab content
     * @param array $args
     */
    function um_profile_content_mycustomtab_default( $args ) {
    
    	$action = 'mycustomtab';
    	$fields_metakey = array(
    		'description'
    	);
    
    	$nonce = filter_input( INPUT_POST, '_wpnonce' );
    	if( $nonce && wp_verify_nonce( $nonce, $action ) && um_is_myprofile() ) {
    		foreach( $fields_metakey as $metakey ) {
    			update_user_meta( um_profile_id(), $metakey, filter_input( INPUT_POST, $metakey ) );
    		}
    		UM()->user()->remove_cache( um_profile_id() );
    	}
    
    	$fields = UM()->builtin()->get_specific_fields( implode( ',', $fields_metakey ) );
    	?>
    
    	<div class="um">
    		<div class="um-form">
    			<form method="post">
    
    				<?php
    				if( um_is_myprofile() ) {
    					foreach( $fields as $key => $data ) {
    						echo UM()->fields()->edit_field( $key, $data );
    					}
    				}
    				else {
    					foreach( $fields as $key => $data ) {
    						echo UM()->fields()->view_field( $key, $data );
    					}
    				}
    				?>
    
    				<?php if( um_is_myprofile() ) : ?>
    					<div class="um-col-alt">
    						<div class="um-left">
    							<?php wp_nonce_field( $action ); ?>
    							<input type="submit" value="<?php esc_attr_e( 'Actualizar', 'ultimate-member' ); ?>" class="um-button" />
    						</div>
    					</div>
    				<?php endif; ?>
    
    			</form>
    		</div>
    	</div>
    
    	<?php
    }
    add_action( 'um_profile_content_mycustomtab_default', 'um_profile_content_mycustomtab_default' );
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Custom tab doesn’t work (maybe UM update?’ is closed to new replies.