• Resolved alocin-deu

    (@alocin-deu)


    Hi again ??

    in the event-submit.php

    i am tryng to show the organizator user profile picture.

    code:

    <?php if ( $organizer_fields ) : ?>
    			<h2 class="section-title"><?php _e( 'Contact Information', 'wp-event-manager' ); ?></h2>
    			<?php do_action( 'submit_event_form_organizer_fields_start' ); ?>
    			<?php foreach ( $organizer_fields as $key => $field ) : ?>
    				<fieldset class="fieldset-<?php esc_attr_e( $key ); ?>">
    					<label for="<?php esc_attr_e( $key ); ?>"><?php echo $field['label'] . apply_filters( 'submit_event_form_required_label', $field['required'] ?'<span class="require-field">*</span>' : ' <small>' . __( '(optional)', 'wp-event-manager' ) . '</small>', $field ); ?></label>
    					<div class="field <?php echo $field['required'] ? 'required-field' : ''; ?>">
    						<?php if($field['label'] == 'Name' && $field['type'] == 'text' ) $field['value'] = wp_get_current_user()->display_name  ?>
    						<?php  if($field['label'] == 'Profile Picture' && $field['type'] == 'file' ) $field['value'] = get_avatar(get_the_author_meta('ID')); ?> 
    						<?php get_event_manager_template( 'form-fields/' . $field['type'] . '-field.php', array( 'key' => $key, 'field' => $field ) ); ?>
    					</div>
    				</fieldset>
    			<?php endforeach; ?>
    			<?php echo  nl2br ("\n \n \n"); ?>
    			<?php do_action( 'submit_event_form_organizer_fields_end' ); ?>
    		<?php endif; ?>

    In detail here i have added this:

    <?php if($field['label'] == 'Profile Picture' && $field['type'] == 'file' ) $field['value'] = get_avatar(get_the_author_meta('ID')); ?>

    could help me to show the profile picture? it does nto work and give me back a misisng img

    thansk a lot

    The page I need help with: [log in to see the link]

Viewing 14 replies - 1 through 14 (of 14 total)
  • Hi @alocin-deu,

    You have overrided template file to your theme side ?

    It is not working because you are sendding value as image you need to send value as image path.

    When you print the get_avatar(get_the_author_meta('ID')); It will print whole image with <img /> tag. Get the image URL from the auther meta.
    Use this function
    get_avatar_url( mixed $id_or_email, array $args = null );
    I hope it helps.

    Thank you

    Thread Starter alocin-deu

    (@alocin-deu)

    hi,

    thansk to be so fast answetring.

    Yes i have override the file in the them ??

    So u mean change this:
    get_avatar(get_the_author_meta('ID')); ?>
    for this:
    get_avatar_url( mixed $id_or_email, array $args = null );

    ?
    Or i have to change more code?

    thanks a lot

    Hi @alocin-deu,

    You can do by adding you id in this function.

    get_avatar_url(get_the_author_meta('ID'),$args = null );

    Thank you

    Thread Starter alocin-deu

    (@alocin-deu)

    i have did this now, does nto work:

    <?php if($field['label'] == 'Profile Picture' && $field['type'] == 'file' ) $field['value'] = get_avatar_url(get_the_author_meta('ID'),$args = null ); ?>

    any extra help?
    thanks a lot
    nicola

    Hi @alocin-deu,

    I think you condition is not matching with a label can you match with $key

    Thread Starter alocin-deu

    (@alocin-deu)

    i have this, does not work:

    <?php if($field['$key'] == 'Profile Picture' && $field['type'] == 'file' ) $field['value'] = get_avatar_url(get_the_author_meta('ID'),$args = null ); ?>

    Is it ok like this?

    Thread Starter alocin-deu

    (@alocin-deu)

    i tryed like this:

    <?php if($field['$key'] == 'Profile Picture' && $field['type'] == 'file' ) $field['value'] = get_avatar_url(get_the_author_meta('ID'),$args = null ); ?>

    and it comes out the img organizer…but i need the profile picture of the user

    thansk
    i hope this can help

    Hi @alocin-deu,

    Still you are doing wrong.

    if($field[$key] == 'organizer_logo' && $field['type'] == 'file')

    Update this it will work.

    Thank you

    Thread Starter alocin-deu

    (@alocin-deu)

    hi,

    thanks a lot…i did it…but does not work.

    we have 2 possibility now:

    1- If i never insert a event…i have no img of organizer logo and it supose to take the profile picture.

    2- If i already post a event in the past it take sthe last organizer logo i used

    I just need that in the form submit the organizer logo is for default the profile picture of the user.

    This can help more?

    many thanks

    Hi @alocin-deu,
    Let me correct my above code first

    <?php  if($key == 'organizer_logo' && $field['type'] == 'file'  ) $field['value'] = get_avatar_url(get_the_author_meta('ID')); 
    						?> 

    If you add this line it will take default image if you haven’t set your avatar and also it will show the avatar which you have updated.

    Thank you

    Thread Starter alocin-deu

    (@alocin-deu)

    hi mand, thansk a lot.

    IT takes the ‘default profile picture’ but does not load the picture i use for my profile :/

    any idea?

    You are using Gravatar?

    I have provided the code which will provide you only the Gravatar because you have used avatar function to get the image.

    If you are using any profile plugin then please check the meta key of user then it will give the image path.

    Thread Starter alocin-deu

    (@alocin-deu)

    HI,
    thansk to stay tuned on the problem ??

    I am using: https://www.cozmoslabs.com/wordpress-profile-builder/ for dministrate users and field.

    The profile picture variable if can be useful to know name is: custom_field_1

    regards
    nicola

    Hi @alocin-deu,

    It is paid plugin and i don’t know in which user meta key it is storing the user image otherwise i can help provide you the solution.

    You need to ask them how you can get the user image using above plugin.

    If you use default functionality above solution is working i have test.

    Thank you

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Profile Picture’ is closed to new replies.