Skip to:
Content
Pages
Categories
Search
Top
Bottom

Major changes to Edit.php

  • @ch1n3s3b0y

    Participant

    Hi

    I’m changing the profile edit form on the front end. What I am trying to do is:

    • List each field where I want rather than BP just looping through each profile field
    • I want to be able to customise the classes for the fields as I am using Twitter Bootstrap

    Currently I have to this to loop through the fields and only show the field I want where I want it:

    <?php while ( bp_profile_fields() ) : bp_the_profile_field();
    					if ( bp_get_the_profile_field_id() == 3 ) : ?>
    				
    					<div<?php bp_field_css_class( 'editfield' ); ?>>
    		
    						<?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
    		
    						/**
    						 * Fires after the visibility options for a field.
    						 *
    						 * @since 1.1.0
    						 */
    						do_action( 'bp_custom_profile_edit_fields' ); ?>
    					</div>
    		
    				<?php endif;endwhile; ?>

    Is there a better way to do this? It seems inefficient to loop through every profile field just to get one?

    Also, how can I add classes to the HTML output and/or completely change that output if I want?

Viewing 3 replies - 1 through 3 (of 3 total)
  • @shanebp

    Moderator

    You could let it loop thru the fields and then ‘View Source’ or equivalent in the browser and copy / paste the output.
    If you do, be sure to adjust value in this line to reflect the field ids that you actually use:
    <input type="hidden" name="field_ids" id="field_ids" value="2,8,4464" />

    @hastig

    Participant

    I’m probably misunderstanding the question but for the first part (“List each field where I want”) are you trying to control the order the fields appear to a user on this page?

    your.website/members/admin/profile/edit/group/1/

    If so, have you already tried reordering them in admin panel -> users -> profile fields ?

    @ch1n3s3b0y

    Participant

    Hi

    Thanks for the responses. I have just copied and pasted the output. I had done this before and it had worked fine. The reason I was trying to do it more like the way the vanilla BP works is due to TinyMCE not working when I copy and paste it, but I can live with just a normal text area. Thanks for the help 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Major changes to Edit.php’ is closed to new replies.
Skip to toolbar