如何在buddypress xprofile表单验证中编辑默认错误消息?

时间:2019-04-04 11:05:13

标签: wordpress buddypress

我正在为/wp-content/themes/byron/buddypress/members/single/profile/edit.php上的buddypress个人资料编辑表单。

当我尝试提交带有无效字段的表单时,我会收到消息“此字段为必填项”。此方法应能正常工作,但我想翻译此消息。字符串来自某个地方,但是在哪里?

我已经在buddypress插件文件夹中找到buddypress.pot,但是在edit.php中没有引用验证消息。我还找到了buddypress-nl_NL.mo和buddypress-nl_NL.po文件,但是那里也没有运气。我几乎没有使用这种翻译文件的经验。我尝试添加规则,但没有任何运气

此刻的模板代码

?php echo do_shortcode("[basic-user-avatars]"); ?>

<form action="<?php bp_the_profile_group_edit_form_action(); ?>" method="post" id="profile-edit-form" class="standard-form <?php bp_the_profile_group_slug(); ?>">

    <?php

        /** This action is documented in bp-templates/bp-legacy/buddypress/members/single/profile/profile-wp.php */
        do_action( 'bp_before_profile_field_content' ); ?>

        <div class="clear"></div>

        <?php while ( bp_profile_fields() ) : bp_the_profile_field(); ?>

            <div<?php bp_field_css_class( 'editfield' ); ?>>
                <fieldset>

                <?php
                $field_type = bp_xprofile_create_field_type( bp_get_the_profile_field_type() );
                $field_type->edit_field_html();

                /**
                 * Fires before the display of visibility options for the field.
                 *
                 * @since 1.7.0
                 */
                do_action( 'bp_custom_profile_edit_fields_pre_visibility' );
                ?>

                <?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() ?>"><span id="<?php bp_the_profile_field_input_name(); ?>-2">
                        <?php
                        printf(
                            __( 'This field can be seen by: %s', 'buddypress' ),
                            '<span class="current-visibility-level">' . bp_get_the_profile_field_visibility_level_label() . '</span>'
                        );
                        ?>
                        </span>
                        <button type="button" class="visibility-toggle-link" aria-describedby="<?php bp_the_profile_field_input_name(); ?>-2" aria-expanded="false"><?php _ex( 'Change', 'Change profile field visibility level', 'buddypress' ); ?></button>
                    </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>
                        <button type="button" class="field-visibility-settings-close"><?php _e( 'Close', 'buddypress' ) ?></button>
                    </div>
                <?php else : ?>

                <?php endif ?>

                <?php

                /**
                 * Fires after the visibility options for a field.
                 *
                 * @since 1.1.0
                 */
                do_action( 'bp_custom_profile_edit_fields' ); ?>

                </fieldset>
            </div>

        <?php endwhile; ?>

    <?php

    /** This action is documented in bp-templates/bp-legacy/buddypress/members/single/profile/profile-wp.php */
    do_action( 'bp_after_profile_field_content' ); ?>

    <div class="submit">
        <input type="submit" name="profile-group-edit-submit" id="profile-group-edit-submit" value="<?php esc_attr_e( 'Save Changes', 'buddypress' ); ?> " />
    </div>

    <input type="hidden" name="field_ids" id="field_ids" value="<?php bp_the_profile_field_ids(); ?>" />

    <?php wp_nonce_field( 'bp_xprofile_edit' ); ?>

</form>

0 个答案:

没有答案