Forum Replies Created

Viewing 15 replies - 571 through 585 (of 718 total)
  • Plugin Author donmik

    (@atallos)

    It’s really weird… I don’t know why it’s doing this. If you want, you can try to delete placeholder and don’t show anything, at least there is no default values saved wrong.

    To do this you need to search “bxcft_edit_render_new_xprofile_field” function in my plugin and in this function I create all the fields. Look for :
    elseif ( bp_get_the_profile_field_type() == 'web' ) {
    and delete the placeholder.

    Plugin Author donmik

    (@atallos)

    In the edit.php of profile you should have this piece of code:

    <?php if ( bp_current_user_can( 'bp_xprofile_change_field_visibility' ) ) : ?>
    					<p class="field-visibility-settings-toggle" id="field-visibility-settings-toggle-<?php bp_the_profile_field_id() ?>">
    						<?php printf( __( 'This field can be seen by: <span class="current-visibility-level">%s</span>', 'buddypress' ), bp_get_the_profile_field_visibility_level_label() ) ?> <a href="#" class="visibility-toggle-link"><?php _e( 'Change', 'buddypress' ); ?></a>
    					</p>
    
    					<div class="field-visibility-settings" id="field-visibility-settings-<?php bp_the_profile_field_id() ?>">
    						<fieldset>
    							<legend><?php _e( 'Who can see this field?', 'buddypress' ) ?></legend>
    
    							<?php bp_profile_visibility_radio_buttons() ?>
    
    						</fieldset>
    						<a class="field-visibility-settings-close" href="#"><?php _e( 'Close', 'buddypress' ) ?></a>
    					</div>
    				<?php else : ?>
    					<div class="field-visibility-settings-notoggle" id="field-visibility-settings-toggle-<?php bp_the_profile_field_id() ?>">
    						<?php printf( __( 'This field can be seen by: <span class="current-visibility-level">%s</span>', 'buddypress' ), bp_get_the_profile_field_visibility_level_label() ) ?>
    					</div>
    				<?php endif ?>

    Between the two hooks:
    <?php do_action( 'bp_custom_profile_edit_fields_pre_visibility' ); ?>

    and

    <?php do_action( 'bp_custom_profile_edit_fields' ); ?>

    This will show the option for changing field’s visibility below the field and above the field’s description.

    Are you using a custom theme ? I’m asking because all of these is working in the default theme with buddypress maybe you can look at the default theme and see what you miss in yours.

    Plugin Author donmik

    (@atallos)

    Ok. I’m glad to read this!

    Plugin Author donmik

    (@atallos)

    In my plugin, there is no default value, but there is a placeholder attribute. What you are seeing in the form is the placeholder value. The placeholder of the field cannot be saved. If you don’t write anything, the field remains empty, so there is another thing that is interfering here.

    To check if you are seeing a placeholder or not in the form you can search in the html code for the attribute placeholder in your field or simply click on the field and start writing, if the value disappears then it was a placeholder.

    Plugin Author donmik

    (@atallos)

    Hi,

    What default value ? There is no way you can define in the wordpress admin a default value for the fields you create.

    If I leave it blank, the field won’t show anything on it. Can you show me a picture or send me a link to see it ?

    Plugin Author donmik

    (@atallos)

    I cannot help much without seeing the code.

    In this thread they have the same problem and they solved with the hook I mentioned.

    Plugin Author donmik

    (@atallos)

    Hi,

    Have you checked if you have the needeed hook to show fields in your register page ? If you are using the latest version of Buddypress (1.7 and later) you need “bp_custom_profile_edit_fields_pre_visibility”. If it does not appear in the register page, add the hook.

    I write a little FAQ with this question.

    Plugin Author donmik

    (@atallos)

    Good idea. I’ll think about it in future versions.

    Plugin Author donmik

    (@atallos)

    You need to use the filter I’ve created for this. You can see how to use it in the FAQ.

    If you need more help, ask here.

    Plugin Author donmik

    (@atallos)

    I’m glad you solved your problems 😉

    You’re welcome.

    Plugin Author donmik

    (@atallos)

    You can see how to do it in this thread. In your case you can show “None” instead of a default image.

    Plugin Author donmik

    (@atallos)

    Hi,

    Thanks!

    1. I don’t know why in your administration you are seeing two fields. It’s weird. I try to add more than one image field in my test website but I cannot reproduce this error.

    2. You need to show a thumbnail instead the original image, no? I believe there is no thumb created when uploading the image with my plugin, so for now I’m afraid that we can only show the original image.

    I think I cannot help you much. Sorry…

    Plugin Author donmik

    (@atallos)

    Well, I’m sorry but I don’t know what can I do. I can only explain how it is working.

    The fields are showing using the hook “bp_custom_profile_edit_fields_pre_visibility”. This hook must be in a while like this:
    <?php while ( bp_profile_fields() ) : bp_the_profile_field(); ?>
    In the edit.php where the form of edit profile is created it must be something like this:
    <?php do_action( 'bp_custom_profile_edit_fields_pre_visibility' ); ?>

    If this hook does not exist, the fields cannot be shown because my plugin’s function “bxcft_edit_render_new_xprofile_field” is not being called. Maybe you can check this by putting this code in this function at the beginning before “global $field”:

    echo "Entering in bxcft_edit_render_new_xprofile_field";

    If this text appears when you enter to edit profile form, then there is another problem. If it does not appear, the problem is with the hook “bp_custom_profile_edit_fields_pre_visibility”.

    Plugin Author donmik

    (@atallos)

    Thanks! We were working hard this week to solve all the bugs founded by our users.

    Plugin Author donmik

    (@atallos)

    In the FAQ which I’ve uploaded today, you can see how to use the filter. In your case I suppose you need to do something like this:

    add_filter( 'bxcft_show_field_value', 'my_show_field', 15, 4);
    function my_show_field($value_to_return, $type, $id, $value) {
        if ($type == 'image') {
            $value = str_replace("<p>", "", $value);
            $value = str_replace("</p>", "", $value);
            if ($value != '') {
                   return '<p><img src="'.$uploads['baseurl'].$value.'" alt="" /></p>';
            } else {
                 return YOUR_DEFAULT_IMAGE;
            }
        }
        return $value_to_return;
    }

    Something like this might work.

Viewing 15 replies - 571 through 585 (of 718 total)