Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

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

  • Julian Lamprea
    Participant

    @jalejo08

    Hi @modemlooper, please, can you upload again the example to do it compatible with BP 1.7+
    i’m finding an example that works, but It is difficult


    Julian Lamprea
    Participant

    @jalejo08

    Hi there,
    I know this issue was fixed for some people, but I still have this problem
    I have BP 1.8.1 and WP 3.7.1

    I checked the status of the patch here:
    https://buddypress.trac.wordpress.org/ticket/4573
    and using this modification I was able to fix the problem on the activity time, but the problem on comment time not yet.
    When I write a status update, after apply the patch the activity time render fine, but if I write something in the comment of the activity, the time say that the comment was 4 hours ago.

    The patch that I used, supposedly is already included in the latest version of BP, but it is not 🙁
    Anyone know how can I apply any fix to the comments too?

    Also I have added a javascript function to change dynamically the name of the Visibility option in the toogle state, so, now, If you click on the Change Link, select other radio and click on close, you will see the new visibility option.

    this is the javascript function:

    
    function changeVisibilityLabel( id, txt ) {
          sp = jQuery('#field-visibility-settings-toggle-'+id).find('.current-visibility-level');
          sp.text(txt);
        }
    

    and the change to the xprofile template:

    
    foreach( bp_xprofile_get_visibility_levels() as $level ) {
    			$checked = $level['id'] == bp_get_the_profile_field_visibility_level() ? ' checked="checked" ' : '';
    
    			$html .= "\n".'<li><label for="see-field_' . esc_attr( $level['id'] ) . '_'.bp_get_the_profile_field_id().'" onclick="changeVisibilityLabel('.bp_get_the_profile_field_id().', \''.esc_html( $level['label'] ).'\')"><input type="radio" id="see-field_' . esc_attr( $level['id'] ) . '_'.bp_get_the_profile_field_id().'" name="field_' . bp_get_the_profile_field_id() . '_visibility" value="' . esc_attr( $level['id'] ) . '"' . $checked . ' /> ' . esc_html( $level['label'] ) . '</label></li>';
    		}
    

    Of course, this change is in the same function “bp_profile_get_visibility_radio_buttons()”

    Sorry, the correct code with the different ID implementation is:

    
    foreach( bp_xprofile_get_visibility_levels() as $level ) {
    			$checked = $level['id'] == bp_get_the_profile_field_visibility_level() ? ' checked="checked" ' : '';
    
    			$html .= '<li><label for="see-field_' . esc_attr( $level['id'] ) . '_'.bp_get_the_profile_field_id().'"><input type="radio" id="see-field_' . esc_attr( $level['id'] ) . '_'.bp_get_the_profile_field_id().'" name="field_' . bp_get_the_profile_field_id() . '_visibility" value="' . esc_attr( $level['id'] ) . '"' . $checked . ' /> ' . esc_html( $level['label'] ) . '</label></li>';
    		}
    

    Check the id attribute for the radio input.

    The issue is in the core of the xprofile fields integration that have been added to buddypress with errors.
    The problem is in the bp-xprofile-template.php file in the method bp_profile_get_visibility_radio_buttons()
    Currently that function is rendering the visibility levels as radiobuttons, but is using the same id for all radiobuttons, so, if you want to allow multiple field with visibility options, the current version don’t works because the IDs of each radiobutton is repeated.
    The current code of this method is:

    
    foreach( bp_xprofile_get_visibility_levels() as $level ) {
    			$checked = $level['id'] == bp_get_the_profile_field_visibility_level() ? ' checked="checked" ' : '';
    
    			$html .= '<li><label for="see-field_' . esc_attr( $level['id'] ) . '"><input type="radio" id="see-field_' . esc_attr( $level['id'] ) . '" name="field_' . bp_get_the_profile_field_id() . '_visibility" value="' . esc_attr( $level['id'] ) . '"' . $checked . ' /> ' . esc_html( $level['label'] ) . '</label></li>';
    		}
    

    and the correct way to do it should be:

    
    foreach( bp_xprofile_get_visibility_levels() as $level ) {
    			$checked = $level['id'] == bp_get_the_profile_field_visibility_level() ? ' checked="checked" ' : '';
    
    			$html .= '<li><label for="see-field_' . esc_attr( $level['id'] ) . '"><input type="radio" id="see-field_' . esc_attr( $level['id'] ) . '" name="field_' . bp_get_the_profile_field_id() . '_visibility" value="' . esc_attr( $level['id'] ) . '"' . $checked . ' /> ' . esc_html( $level['label'] ) . '</label></li>';
    		}
    

    Notice how I’m adding the correct ID for each radiobutton, thus the visibility options for each field will have the respective ID and will works!

    I’m not sure why this issue is not related in the bugs list.

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