Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 18 replies - 1 through 18 (of 18 total)

  • rezon8dev
    Participant

    @rezon8dev

    And putting , before the   I get that comma!
    Thank so much @danbp!
    Case Closed…


    rezon8dev
    Participant

    @rezon8dev

    OK yup that does it. A question and one more request. @danbp I really do appreciate this, you’re helping me learn some basic stuff and some more detail on BP in general!

    Question, why does bp_member_profile_data pull in the array data but not print the classes?

    Request, I need the fields returned from musical genre to all be on one line and they should be if all the values of the array are returned wrapped in the class rather than than each of the values being wrapped in the class, I just can’t figure out the syntax to make that happen…

    Thanks a million!


    rezon8dev
    Participant

    @rezon8dev

    Changing the function to this:

    /*
    * Add xprofile fields to member header
    */
    function custom_display_xprofile_fields() {
    
    if ( $data = bp_get_profile_field_data( 'field=Artist Name' ) ) : 
    	echo '<div class="mdetcenter"><div class="artist"><h4 class="user-nicename">'. xprofile_get_field_data( 'Artist Name', bp_displayed_user_id() ) .'</h4></div></div>';
    endif;
    
    if ( $data = bp_member_profile_data( 'field=Musical Genre' ) ) : 
    
    	echo '<div class="mdetcenter"><div class="genre">'. xprofile_get_field_data( 'Musical Genre', bp_displayed_user_id() ) .'</div></div>';
    
    endif;
    
    if ( $data = bp_get_profile_field_data( 'field=Location' ) ) : 
        echo '<br>';
    	echo '<div class="mdetcenter"><div class="location">'. xprofile_get_field_data( 'Location', bp_displayed_user_id() ) .'</div></div>';
    endif;

    Gives me this HTML output:

    	<div class="mdetcenter"><div class="artist"><h4 class="user-nicename">No Way Back</h4></div></div>
    Alternative, Blues, Country, Electronic
    <br><div class="mdetcenter"><div class="location">Detroit, MI. US</div></div>

    rezon8dev
    Participant

    @rezon8dev

    they are 2 classes, do I need “” around each of them?
    This is a multi-select field.
    The other 2 work fine its just the musical genre field that is not printing the classes, or any of the html…


    rezon8dev
    Participant

    @rezon8dev

    @danbp several searches seemed to turn up that this is an open issue with this field type. What I did was basically workaround and added a echo <br> to the following line in the function which is using bp_get_profile_field_data rather than bp_member_profile_data. If you or anyone can point to the direct so I could properly allow this to output my html classes around a multi-select field type being called with bp_member_profile_data, I would be greatful. @danbp Thanks a million for your assistance!


    rezon8dev
    Participant

    @rezon8dev

    @danbp I’ve also tried it like this without any success:

    if ( $data =  bp_member_profile_data( 'field=Musical Genre' ) ) : 
    	echo '<div class="mdetcenter genre">';
    	echo  xprofile_get_field_data( 'Musical Genre', bp_displayed_user_id() );
    	echo '</div>';
    
    endif;

    rezon8dev
    Participant

    @rezon8dev

    For some reason this line

    if ( $data = bp_get_profile_field_data( 'field=Musical Genre' ) ) : 
    	echo '<div class="mdetcenter genre">'. xprofile_get_field_data( 'Musical Genre', bp_displayed_user_id() ) .'</div>';
    endif;

    Is not printing the div class, it’s just printing the values. I’ve tried to create a new field, first renaming the previous and recreating the new with the same name “Musical Genre” but I’m not getting and <div class=”…. to print. @danbp any ideas?


    rezon8dev
    Participant

    @rezon8dev

    OK so I switched to bp_member_profile_data() for the Musical Genre field and seem to be getting a result with the proper data but its not taking the formatting still… Almost there…


    rezon8dev
    Participant

    @rezon8dev

    OK this mostly worked and I do not know how to fix the portion that is not working. I’ve entered this:

    /*
    * Add xprofile fields to member header
    */
    function custom_display_xprofile_fields() {
    
    if ( $data = bp_get_profile_field_data( 'field=Artist Name' ) ) : 
    	echo '<div class="mdetcenter artist"><h4 class="user-nicename">'. xprofile_get_field_data( 'Artist Name', bp_displayed_user_id() ) .'</div>';
    endif;
    
    if ( $data = bp_get_profile_field_data( 'field=Musical Genre' ) ) : 
    	echo '<div class="mdetcenter genre">'. xprofile_get_field_data( 'Musical Genre', bp_displayed_user_id() ) .'</div>';
    endif;
    
    if ( $data = bp_get_profile_field_data( 'field=Location' ) ) : 
    	echo '<div class="mdetcenter location">'. xprofile_get_field_data( 'Location', bp_displayed_user_id() ) .'</div>';
    endif;
    
    }
    add_action( 'bp_profile_header_meta' , 'custom_display_xprofile_fields' );
    add_filter( 'bp_before_member_header_meta', 'custom_display_xprofile_fields' );
    

    The Musical Genre field is a multi-select field type and the echo is printing “array” rather than the array of selected values in this field…


    @danbp
    can you help here?


    rezon8dev
    Participant

    @rezon8dev

    I guess I see how, I would use my bp-custom.php plugin file but I thought overriding files in this manor was the acceptable way to do it? I guess it makes sense that if the file changes shi* will break…


    rezon8dev
    Participant

    @rezon8dev

    Is your child theme working correctly with Kleo ?
    Is the altered member-header.php file in your child-theme ?

    Yes and Yes..

    Do you really use a file called member-profile.php, as stated in your first topic ? Bad !

    How else would I override the buddypress file unless it was in my child theme with the same name?

    I’ll give this a go and report back, thank you very much!


    rezon8dev
    Participant

    @rezon8dev

    Has anyone seen the duplicating profile fields issue happen when displaying xprofile fields in the member header before?


    rezon8dev
    Participant

    @rezon8dev

    OK will do @shanebp.
    Can anyone give me a hand and let me know if this code looks proper? Even if I remove this from my child theme functions.php file and add the following to my member-header.php file:

    
    bp_member_profile_data( 'field=Artist Name' );
    bp_member_profile_data( 'field=Musical Genre' );
    bp_member_profile_data( 'field=Location' );

    I get similar results; the custom fields being displayed multiple times, oddly when I add the above to the member-header.php I get the Artist name field showing 4 times in a row rather than repeating sets of fields 1-4 and then fields 1-4 again duplicating when the code in a previous post above is in the functions file…


    rezon8dev
    Participant

    @rezon8dev

    @shanebp, I’ve tracked it down but still cant figure out what is wrong. This was all working until I upgraded to the latest bp… It is in my functions file for my theme, it is this function to place 3 xprofile fields in the member header area:

    /** 
     *  Add extended profile fields to the member profile header area  
    */
    
    add_action( 'bp_profile_header_meta' , 'display_user_xprofile_fields' );
    function display_user_xprofile_fields() {
    
     	$artistname = bp_get_member_profile_data('field=Artist Name');
        $musicalgenre = bp_get_member_profile_data('field=Musical Genre');
        $location = bp_get_member_profile_data('field=Location');
    
        if ($artistname || $musicalgenre || $location) {
    
            echo '<div class="mdetcenter artist"><h4 class="user-nicename">'. '' . $artistname . '</h4></div>';
            echo '<div class="mdetcenter genre">'. '' . $musicalgenre . '</div>';
            echo '<div class="mdetcenter location">'. '' . $location . '</div>';
        }
    }

    Can you see what is wrong? This is driving me crazy…


    rezon8dev
    Participant

    @rezon8dev

    @shanebp I appreciate your confidence, unfortunately I’m lost and have not gotten anything that is helping me narrow things down, not from logs or debug either….


    rezon8dev
    Participant

    @rezon8dev

    They see the duplicated fields as 2 sets, so fields 1-5 and then again fields 1-5. After trying to remove the 3rd shortcode the issue still persists…


    rezon8dev
    Participant

    @rezon8dev

    That did it – Thank you!
    Just in case any one else finds this

    <?php if(bp_is_my_profile() ) : ?>
    
    // code goes here
    
    <?php endif; ?>

    rezon8dev
    Participant

    @rezon8dev

    I see how this is working but I’m still lost as to why you cannot display on the member profile page. Can anyone tell me what is happening to prevent oembed content from rendering on the profile pages?

Viewing 18 replies - 1 through 18 (of 18 total)
Skip to toolbar