Skip to:
Content
Pages
Categories
Search
Top
Bottom

How do I remove P tag from field value?

  • @vbsql7

    Member

    I am dumping user profile data like this:
    `

    :

    `
    … but the bp_the_profile_field_value function is adding paragraph (p) tags to the output.
    How can I prevent this? I can’t find where it happens in the code.
    Thanks,
    Michael

Viewing 6 replies - 1 through 6 (of 6 total)
  • @djpaul

    Keymaster

    We fixed this in trunk the other day. Take a look at the change here: https://buddypress.trac.wordpress.org/changeset/4351/

    @hnla

    Participant

    @DJPaul but that was to fix the incorrect nesting of elements, the paragraph tags still exist for the bp_the_profile_field_value()

    would not something like xprofile_get_field…() be better?

    @djpaul

    Keymaster

    `
    remove_filter( ‘bp_get_the_profile_field_value’, ‘wpautop’ );
    `

    would do it but also remove the paragraph tags from all other fields

    @vbsql7

    Member

    Thanks for the help so far.
    Knowing that the extra tags were coming back, I tried to take the quick fix and strip them like this:
    `

    `
    …but I still get the same result — data wrapped in P tags.

    I spent some time trying to learn about the xprofile functions but I did not find a clear example that I could make work.

    Would I would like to find a loop that gives me rather tight control of what is happening.
    Perhaps like this (pseudo code):
    `
    $user = bp_get_profile($user_id);
    for ($i = 0;$user.fields.count;$i++) {
    $field = $user.fields($i);
    echo $field->name;
    echo $field->data;
    }
    `

    @vbsql7

    Member

    Thanks Paul. Removing the wpautop filter gets me going for now! :)

    @intervik

    Participant

    If someone like me found this (as always) very old topic, use the functions from edit-profile.php instead of profile-loop functions – but in the profie loop:

    bp_get_the_profile_field_edit_value()
    instead of :
    bp_the_profile_field_value()
    or
    bp_get_the_profile_field_value()

    Boink, it works for me.
    / Intervik, Lundman

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘How do I remove P tag from field value?’ is closed to new replies.
Skip to toolbar