Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author donmik

    (@atallos)

    It’s not in the faq, the faq only shows an example using the filter. For your case, if you want to show only image url, try this:

    add_filter( 'bxcft_show_field_value', 'my_show_field', 15, 4);
    function my_show_field($value_to_return, $type, $id, $value) {
        if ($type == 'image') {
            $uploads = wp_upload_dir();
            $value = str_replace("<p>", "", $value);
            $value = str_replace("</p>", "", $value);
            $value_to_return = '<p>'.$uploads['baseurl'].$value.'</p>';
        }
        return $value_to_return;
    }
    Thread Starter The Gal

    (@peterpevensie)

    Hello there!

    First off, thank you so much for the reply! Secondly, I’m so sorry it took so long for me to reply as well. This project got stuck on a back burner due to other unrelated issues arising.

    OK, so thank you for the bit of code! It pulls the url instead of the image perfectly in the normal field.

    However, what I’m wanting is to pull that url outside of the field and not show the field in the normal profile list at all.

    I’ve already put together the basic php for where I want to pull it. You can see the mock-up here: https://www.pureplayhaven.com/members/Afton/profile/

    The banner image is the uploaded image from your plugin, but I’m just using the actual url and it’ll be showing up on all the profiles, so obviously that isn’t going to work. lol

    Do you have any hints on how to achieve what I’m going after?

    Thanks so much!!

    Plugin Author donmik

    (@atallos)

    I’m not sure I understand you.

    So, one member will upload this banner and you want to show this banner url to all profiles?

    Thread Starter The Gal

    (@peterpevensie)

    lol Oh dear, my apologies for being confusing.

    What I would like is for every member to be able to upload an image and that image displays on their profile, in the profile header. Basically like a FB Timeline photo.

    I’ve already coded out the place I want the uploaded image to be and threw in a sample image for testing purposes, but I’m still trying to figure out how to output the uploaded image url outside the usual profile field output list.

    Plugin Author donmik

    (@atallos)

    Ok, I think I understand now.

    You can do it. If you are in the member’s page, you can use:

    bp_member_profile_data('field=Image');

    You can see this code in your member-header.php. Search in your theme /members/single/member-header.php.

    /***
      * If you'd like to show specific profile fields here use:
      * bp_member_profile_data( 'field=About Me' ); -- Pass the name of the field
      */
    Thread Starter The Gal

    (@peterpevensie)

    THANK YOU SO MUCH!!!! That pretty much did it! I ended up needing to add the absolute path to the upload site as well, so this is what I ended up with:

    function store_banner() { ?>
    <div class="storebanner">
    <img src="https://www.pureplayhaven.com/wp-content/uploads/<?php bp_member_profile_data('field=Banner Image'); ?>" />
    </div>
    <?php }
    add_action('bp_before_member_header','store_banner');

    And that did the trick!

    Thank you so much!!

    Thread Starter The Gal

    (@peterpevensie)

    THANK YOU SO MUCH!!!! That pretty much did it! I ended up needing to add the absolute path to the upload site as well, so this is what I ended up with:


    function store_banner() { ?>
    <div class="storebanner">
    <img src="https://www.pureplayhaven.com/wp-content/uploads/<?php bp_member_profile_data('field=Banner Image'); ?>" />
    </div>
    <?php }
    add_action('bp_before_member_header','store_banner');

    And that did the trick!

    Thank you so much!!

    Plugin Author donmik

    (@atallos)

    You’re welcome ??

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Calling Image URL from Profile Field’ is closed to new replies.