BuddyDev

Search

BuddyPress Xprofile Custom Field Types: Description for Image Uploads, Tags, etc

  • Participant
    Level: Initiated
    Posts: 15
    scoob on #45583

    Hi Brajesh,
    when using some file types, e.g. “Image upload”, “File upload”, “Tag” and maybe some other fields, the field description is placed incorrectly.

    In case of the “Image upload” field, it is placed below the upload button. Other fields, e.g. the text field place the field description before the text input, which should be standard.
    Image: https://ibb.co/SJ0zrPt

    In case of the Tag field, the description is also placed below the input field, which overlaps the description.
    Image: https://ibb.co/1bFv2M4

    Can you please correct the placement of the description and put it after the field title and before the input.
    Thank you!

  • Keymaster
    (BuddyDev Team)
    Posts: 21489
    Brajesh Singh on #45604

    Hi,
    Thank you for reporting the issue. I will check this and update you.

    I haven’t tested this plugin with BuddyBoss recently(as per your other posts), so I am not sure what to expect when using with that.

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 15
    scoob on #45605

    Ok, thanks for looking into it.
    Yes, I’m using Buddyboss, but the thing with description placement works fine for some fields, e.g. “Birthdate selector”: https://ibb.co/Br983Lh
    But not for other fields as reported (Image, File, Location, etc.). I did not tested all the other field types.
    Regards

  • Keymaster
    (BuddyDev Team)
    Posts: 21489
    Brajesh Singh on #45606

    Hi Scoob,
    This is just to confirm that all of our fields have same markup structure.

    1. Label/Field name
    2. input/select elements
    3. description

    If it is not appearing in that order, Please contact your theme author. Probably, they have some knowledge about it.

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 15
    scoob on #45609

    Hi Brajesh, interesting.
    In my comment #45605 I posted a screenshot of a field type “Birthday selector” (https://ibb.co/Br983Lh), which is provided by your plugin. Here, the description is put in second place, after the field name.

    I copied the beginning html structure here:

    
    <div class="editfield field_50 field_alter field_order_1 required-field visibility-loggedin alt field_type_birthdate">
    <fieldset>
    <legend>Geburtsdatum</legend>
    <p class="description" tabindex="0">Lorem ipsum</p>
    <div class="input-options datebox-selects">
    <label for="field_50_day" class="xprofile-field-label">Day</label>
    <select id="field_50_day" name="field_50_day" aria-required="true">
    <option value="">----</option>
    <option value="1" selected="selected">1</option>
    ...
    

    The other field types act like you describe, description in 3rd place.

    So, is there a chance that you update the plugin so admins can choose where the description is placed a) before or b) after the custom input field?
    Maybe in the form of an admin display option (when adding/editing) the field type. Or with an “add_filter” method in functions.php.
    I would highly appreciate it, because from a usability point of view it makes more sense to read the instruction first (if a description is necessary). The major social networks behave the same.

    Thanks!

  • Keymaster
    (BuddyDev Team)
    Posts: 21489
    Brajesh Singh on #45612

    Hi Scoob,
    I will suggest you to read the code before accusing me.

    The markup is not from us but from the BuddyBoss/BuddyPress.

    This field extends their date field and the markup you see is coming from date field.

    Here is a link to the our code

    https://github.com/buddydev/bp-xprofile-custom-field-types/blob/master/src/field-types/class-field-type-birthdate.php

    Do you see any function named edit_field_html there?

  • Participant
    Level: Initiated
    Posts: 15
    scoob on #45618

    Hi Brajesh,
    sorry to bother you with this.. I’m not good in php but I could figure out how to solve the problem with some JS, I found here:
    https://wordpress.org/support/topic/field-description-below-label-script-not-working/

    
    jQuery('p.description').each(function() {
        // Clone description
        // Looking for parent
        // Looking for first label legend
        var desc = jQuery(this).clone(),
            parent = jQuery(this).parent(),
            label = parent.find('legend:first');
        // If there is a label.
        if (label.length) {
            // Putting the description after the label.
            label.after(desc);
            // Removing the original description.
            jQuery(this).remove();
        }
    });
    

    Nevertheless I would prefer an add filter solution in your plugin. Because I don’t know the negative aspects (resources) of this JS. On the other hand I understand your time preferences for this free plugin. Which I appreciate very much. Thank you.

  • Keymaster
    (BuddyDev Team)
    Posts: 21489
    Brajesh Singh on #45620

    Hi Scoob,
    I am sorry, the issue is not this plugin. The issue is BuddyBoss platform.

    When I forked the abandoned plugin you have linked to, I audited all the fields and have made sure that the description/label follow same structure(had missed some initially and did fix that after being reminded).

    For the birthdate field, we are extending the date field from BuddyPress/BuddyBoss and the edit form field is shown by them not by this plugin.
    So, I do not understand what you want me to fix in this plugin? I will suggest contacting BuddyBoss for it and they will be able to make it correct.

    Here is the code from BuddyBoss you are asking me to change.

    https://github.com/buddyboss/buddyboss-platform/blob/release/src/bp-xprofile/classes/class-bp-xprofile-field-type-datebox.php#L104

    Regards
    Brajesh

You must be logged in to reply to this topic.

This topic is: not resolved