Skip to:
Content
Pages
Categories
Search
Top
Bottom

HTML not sticking in Profile Field…


  • ekko848
    Participant

    @ekko848

    I am trying to add some HTML to a profile field (admin editable, but visible to everyone).

    <form id="frm" method="post"  action="?update_post" >
    <input type="submit" value="Update Page" id="submit" class="update-page" />
    </form>

    Note I just need HTML on one field.

    Anyone have an idea on how I would best accomplish this?

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

  • ekko848
    Participant

    @ekko848

    Well, HTML is working on this profile field..

    Meaning, I can use the editor to bold stuff, or whatever.

    But as for input buttons like I’m wanting… I can input the code

    Update

    But as soon as I try to ‘Save Changes’ with the code in place it disappears.


    danbp
    Participant

    @danbp

    Do you try to create a button via a profile field ? Huh… Preferably do that via a template.

    If you want to enter some html, you could try to remove the one or other filter.

    This snipet (untested) handles the description field. Modify the filter to your nedd. Check bp-xprofile-filters.php to get the name.
    Not that i added some conditionnals for field and user.

    Try:

    function my_field_remove_html_filter() {
    
    if ( bp_is_active( 'xprofile' ) )
    
    $bp_this_field_name = bp_get_the_profile_field_name();
       
       if( 'is_super_admin' ) {
    	// field name (case sensitive)
    	if( $bp_this_field_name == 'FIELD_NAME' ) {	  
    	remove_filter( 'bp_get_the_profile_field_description', 'wp_filter_kses' );
          }
       }
    }
    add_action( 'bp_init', 'my_field_remove_html_filter' );

    Add it to bp-custom.php.


    ekko848
    Participant

    @ekko848

    Thanks for the reply.

    I will try this.

    One question, though, what do you mean “do via a template”?

    Do you mean like in my php file…

    xprofile_set_field_data( $field_id38, $user_id, '<form id="frm" method="post"  action="?update_post" >
    <input type="submit" value="Update Artist Page" id="submit" class="update-page" />
    </form>');

    or are you referring to some other template?


    danbp
    Participant

    @danbp

    Most of bp files are in php, so i can’t answer for YOUR php file.

    I you modify the register page, where xprofile fields are showing at first, the template file i’m talking about is in bp-templates/bp-legacy/buddypress/members/register.php.

    If you don’t know about template overload, read here first.

    Or if you use a custom function to fire your work via an action hook, perhaps you could try to use bp-custom.php

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.
Skip to toolbar