• Resolved Kenneth Johnson

    (@chuckj2109)


    I am not reporting a problem, I am reporting a triumph, I hope. Been trying to edit profile photo ratio (more height/less width) for WP Ultimate Member default profile form. Do not really know what I am doing so have been playing “monkey watchmaker” for at least three years. Finally got it to work, I think. Opened [website]_wp-content_plugins_ultimate-member_includes_admin_templates_form_profile_customize.php
    Changed lines 147-150 from:
    ‘1.6:1’ => ‘1.6:1’,
    ‘2.7:1’ => ‘2.7:1’,
    ‘2.2:1’ => ‘2.2:1’,
    ‘3.2:1’ => ‘3.2:1’,
    To:
    ‘1:1.5’ => ‘1:1.5’,
    ‘1:1.25’ => ‘1:1.25’,
    ‘1:1’ => ‘1:1’,
    ‘1.6:1’ => ‘1.6:1’,

    Worked great! Feel free to to pass it on.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Ultimate Member Support

    (@ultimatemembersupport)

    Hi @chuckj2109

    Thanks for sharing the solution. We don’t recommend modifying the core files. You can try the following Code Snippet to change the Profile Cover Photo’s Ratio:

    add_filter("um_get_option_filter__profile_cover_ratio", "um_093022_change_profile_cover_ratio");
    function um_093022_change_profile_cover_ratio( $ratio ){
      
       return "1:1.5";
    }

    Please note: The above code applies to all profile forms. If you want to apply it to a specific Profile form, just add the following condition:

    add_filter("um_get_option_filter__profile_cover_ratio", "um_093022_change_profile_cover_ratio");
    function um_093022_change_profile_cover_ratio( $ratio ){
      
       if( "1234" === UM()->form()->form_id ){ // 1234 is the form ID.
          return "1:1.5";
       }
       return $ratio;
    }

    Kindest Regards,

    Thank you

    This fix works great

    by using the default settings of cover ratio, the cover height is far too big, hiding the rest of the profile and visitors have to scroll each time they want to see results below the account menu…

    i think this kind of ratio (invision community member) is the best (same as Linkedin too) :
    https://invisioncommunity.com/profile/634255-gary/content/

    to achieve this set the ratio to 5:1

    Thread Starter Kenneth Johnson

    (@chuckj2109)

    I reiterate that I really don’t know what I am doing. I arrived at the fix in my original post by trial and error with frequent backups. I am trying to learn more. Here is the code for wp_content/plugins/ultimate_member/includes/admin/templates/form/profile_settings.php. Is this the right file? If so, where would I add the code snippet? If not, which file and where do I add it? Thanks.

    <?php if ( ! defined( 'ABSPATH' ) ) {
    	exit;
    }
    
    $user_fields = array();
    foreach ( UM()->builtin()->all_user_fields() as $key => $arr ) {
    	$user_fields[ $key ] = isset( $arr['title'] ) ? $arr['title'] : '';
    }
    
    $post_id = get_the_ID();
    $_um_search_fields = get_post_meta( $post_id, '_um_profile_metafields', true );
    $_um_search_fields = empty( $_um_search_fields ) ? array() : $_um_search_fields; ?>
    
    <div class="um-admin-metabox">
    	<?php
    	UM()->admin_forms(
    		array(
    			'class'     => 'um-form-profile-settings um-top-label',
    			'prefix_id' => 'form',
    			'fields'    => array(
    				array(
    					'id'                  => '_um_profile_metafields',
    					'type'                => 'multi_selects',
    					'label'               => __( 'Field(s) to show in user meta', 'ultimate-member' ),
    					'tooltip'             => __( 'Fields selected here will appear in the profile header area below the user\'s display name', 'ultimate-member' ),
    					'value'               => $_um_search_fields,
    					'options'             => $user_fields,
    					'add_text'            => __( 'Add New Field', 'ultimate-member' ),
    					'show_default_number' => 0,
    				),
    			),
    		)
    	)->render_form();
    	?>
    	<div class="um-admin-clear"></div>
    </div>

    add the snippet to the functions.php file of your theme

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Change UM default profile cover photo ratio’ is closed to new replies.