• Resolved Tory

    (@tmac187)


    As another user mentioned the “hide the label if a user has not entered data” is not working on the user profile page. The label still shows even if there is no data entered. Tried on two different installs with different themes and plugins. Looking at the code, I’m not sure how it ever worked on the user profile page. I had to update the rpi_user_profile_bbp_profile_information() function in display.php:

    while($i <= $top) {
        if(!empty($rpi_options['Activate_item'.$i])) {
            $label_id = 'rpi_label'.$i;
            $usermeta = esc_attr(bbp_get_displayed_user_field($label_id));
            $usermeta = apply_filters('rpi_user_profile_field', $usermeta, $label_id);
    
            // Check if usermeta is not empty
            if (!empty($usermeta)) {
                $label = (!empty($rpi_options['item'.$i.'_label']) ? $rpi_options['item'.$i.'_label'] : '');
                echo "<p>";
                printf(__($label.': ', 'bbp-profile-informaton'));
                echo $usermeta;
                echo "</p>";
            }
        }
        $i++;
    }

    Maybe you have a better way to handle it, but this works for me. Just wanted to pass this along. Thanks.

    • This topic was modified 1 year, 1 month ago by Tory.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Hide Label If No Data Not Working’ is closed to new replies.