Forum Replies Created

Viewing 15 replies - 391 through 405 (of 718 total)
  • Plugin Author donmik

    (@atallos)

    Hi,

    Sorry for the delay, I’ve been looking at this but I did not find an easy way to achieve what you want. There is no magic hook to use here. I tried many things but none of them was successful. I’m sorry but I have no solution.

    Plugin Author donmik

    (@atallos)

    I’m not sure I understand what you want to do?

    I don’t understand this sentence: “The data will be added automaticaly to that directory from all users profile field values.” Explain a bit more please.

    Plugin Author donmik

    (@atallos)

    Hi,

    You’re totally right, use this code instead of previous:

    function my_bp_get_the_profile_field_name($name) {
        if ($name == 'Date of Birth' && !bp_is_register_page()
                && !bp_is_profile_edit()) {
            return 'Age';
        }
        return $name;
    }
    add_filter ( 'bp_get_the_profile_field_name', 'my_bp_get_the_profile_field_name', 15, 1);
    Plugin Author donmik

    (@atallos)

    Done!

    Thanks!

    Plugin Author donmik

    (@atallos)

    Hi,

    I believe this is already working… I’ve tried in my test site and multi-line textbox displays the line breaks… Try to use buddypress default theme to see if it works.

    Plugin Author donmik

    (@atallos)

    He is probably talking about when you display the image in edit profile form. You need to look into this function “bxcft_edit_render_new_xprofile_field” in my plugin. Search this code:

    if (bp_get_the_profile_field_edit_value() != '') {
                    $actual_image = sprintf('<img src="%s" alt="%s" /><label for="%s_deleteimg"><input type="checkbox" name="%s_deleteimg" id="%s_deleteimg" value="1" />%s</label><input type="hidden" name="%s_hiddenimg" id="%s_hiddenimg" value="%s" />',
                                            $uploads['baseurl'].bp_get_the_profile_field_edit_value(),
                                            bp_get_the_profile_field_input_name(),
                                            bp_get_the_profile_field_input_name(),
                                            bp_get_the_profile_field_input_name(),
                                            bp_get_the_profile_field_input_name(),
                                            __('Check this to delete this image', 'bxcft'),
                                            bp_get_the_profile_field_input_name(),
                                            bp_get_the_profile_field_input_name(),
                                            bp_get_the_profile_field_edit_value());
                } else {
                    $actual_image = '';
                }

    And between src and alt attributes you can write the width attribute like this:

    if (bp_get_the_profile_field_edit_value() != '') {
                    $actual_image = sprintf('<img src="%s" width="300" alt="%s" /><label for="%s_deleteimg"><input type="checkbox" name="%s_deleteimg" id="%s_deleteimg" value="1" />%s</label><input type="hidden" name="%s_hiddenimg" id="%s_hiddenimg" value="%s" />',
                                            $uploads['baseurl'].bp_get_the_profile_field_edit_value(),
                                            bp_get_the_profile_field_input_name(),
                                            bp_get_the_profile_field_input_name(),
                                            bp_get_the_profile_field_input_name(),
                                            bp_get_the_profile_field_input_name(),
                                            __('Check this to delete this image', 'bxcft'),
                                            bp_get_the_profile_field_input_name(),
                                            bp_get_the_profile_field_input_name(),
                                            bp_get_the_profile_field_edit_value());
                } else {
                    $actual_image = '';
                }

    I believe this is what you are looking for.

    Plugin Author donmik

    (@atallos)

    Hi,

    In my test site, this is working so it’s difficult to debug without seeing code. You can do this checks:

    – First, try to change the permissions of your uploads folder to 0777.
    – In my plugin, the function responsible of copying the image to your uploads folder is “bxcft_signup_user”. Search this code “copy($uploaded_file[‘file’], $destino);” and below it write this:

    var_dump($uploaded_file); var_dump($destino); die();

    This code will stop the execution when uploading the image and copying to your folder. The first var_dump will show what file it is going to upload. The second var_dump ($destino) will show the destination of the file.
    When you click on register, it must stop the execution and show this var_dump. If not, it is not doing this function, so maybe you are missing the hook of signup.

    Try this and come back with the results.

    Plugin Author donmik

    (@atallos)

    Great! I’m glad to read you finally solve it. You’re welcome!

    Plugin Author donmik

    (@atallos)

    You’re welcome!

    Plugin Author donmik

    (@atallos)

    I’m sorry but I can’t help you without seeing anything.

    I’ve created the field as a dropdown box, the name of the field was “User Role”. I’ve created 3 options: “Role 1”, “Role 2” and “Role 3”.

    Then in the filter I wrote above, I’ve replaced “NAME OF THE XPROFILE FIELD” with “User Role” and it works as expected… So I don’t know you are missing something here.

    Try to write this line under $user_role = strtolower(xprofile_get_field_data(‘NAME OF THE XPROFILE FIELD’, $user_id));

    $user_role = strtolower(xprofile_get_field_data('NAME OF THE XPROFILE FIELD', $user_id));
    var_dump($user_role); die();

    It will display the value of $user_role, it must be role 1 or role 2 or role 3, what you selected.

    Plugin Author donmik

    (@atallos)

    You can use this hook “xprofile_field_data_updated”. This hook is called just after updating the field value. Something like this:

    function custom_xprofile_profile_field_data_updated($field_id, $value) {
        $field = new BP_XProfile_Field($field_id);
        if ($field->type == 'textbox' || $field->type == 'textarea') {
            xprofile_set_field_data($field_id, bp_displayed_user_id(), strip_tags($value));
        }
    }
    add_action('xprofile_profile_field_data_updated', 'custom_xprofile_profile_field_data_updated', 10, 2);

    This function is deleting tags from all texboxes or textareas fields.

    Plugin Author donmik

    (@atallos)

    Have you created the field in Profile fields?

    Plugin Author donmik

    (@atallos)

    I believe this thread can help you to solve this.

    Plugin Author donmik

    (@atallos)

    Hi,

    Well, sorry for the delay but I didn’t find the time to do this thing. Today I can try some things and I think it’s working.

    You need to add this filter to your functions.php:

    function custom_bp_core_signup_user($user_id) {
        $user_role = strtolower(xprofile_get_field_data('NAME OF THE XPROFILE FIELD', $user_id));
        switch($user_role) {
            case "role 1":
                $new_role = 'Contributor';
                break;
            case "role 2":
                $new_role = 'Author';
                break;
            default:
            case "role 3":
                $new_role = 'Suscriber';
                break;
        }
        wp_update_user(array(
            'ID' => $user_id,
            'role' => $new_role
        ));
    }
    add_action( 'bp_core_signup_user', 'custom_bp_core_signup_user', 10, 1);

    First I have created an xprofile field (dropdown select box) with the name “NAME OF THE XPROFILE FIELD”. You can give the name you want but you need to write it in the place of this string. The options of the field are the name of the roles: “role 1”, “role 2” and “role 3”. I make this field required and the visibility settings admins only. When a user sign up, he choose the role he want. When he sends the sign up form, this function is executed.

    The function see what $user_role the user has selected searching it by the name of the field and $user_id. Then it changes the role of the user. If the user selects “role 1” we change his role as a contributor. If he chooses “role 2”, he will be an author. If he chooses “role 3”, he will be a suscriber. Suscriber is also the default role.

    Now, you need to decide what you want to do when a user edit his profile. If you don’t want a user be able to change his role, you need to hide this field. I believe you can use this hook “xprofile_screen_edit_profile”. You need to do the same thing, check what value has the field $user_role and then change the role consequently.

    Plugin Author donmik

    (@atallos)

    Hi,

    This is buddypress stuff… Buddypress is filtering target blank. First in the file buddypress/bp-xprofile/bp-xprofile-admin.php line 246, it is sending description value to wp_filter_kses function. This function is filtering this tag. Then it uses filters you can find them in buddypress/bp-xprofile/bp-xprofile-filters.php. Search this string: “xprofile_field_description_before_save”.

    So I think the best way will be using javascript. You need to put this javascript in your registration template at the end of the file.

    <script type="text/javascript">
    jQuery(document).ready(function() {
        if (jQuery('.checkbox-acceptance a').length > 0) {
            console.log('a');
            jQuery('.checkbox-acceptance a').attr('target', '_blank');
        }
    });
    </script>

Viewing 15 replies - 391 through 405 (of 718 total)