Skip to:
Content
Pages
Categories
Search
Top
Bottom

bp-custom function to insert HTML in xprofile field stopped working


  • ekko848
    Participant

    @ekko848

    I was messing with this a few weeks ago and thought I figured this out.
    Have the following code in bp-custom.php

    function set_update_field( $field_value ) {
    	$bp_this_field_name = bp_get_the_profile_field_name();
    	// field name (case sensitive)
    	if( $bp_this_field_name == 'Update Page' ) {
    		$field_value = strip_tags( $field_value );
    $field_value = '<form id="frm" method="post"  action="?update_post"><input type="submit" value="Update Artist Page" id="submit" class="update-page" /></form>';
    	}
    	return $field_value;
    }
    add_filter( 'bp_get_the_profile_field_value','set_update_field');

    This should automatically add the following html to each users field called ‘Update Page’ : <form id="frm" method="post" action="?update_post"><input type="submit" value="Update Artist Page" id="submit" class="update-page" /></form>

    While testing this a few weeks ago, it was working perfectly. Had a form/button of the html in user profiles.
    Now, I come back, and on new user registrations this is not showing up anymore.. the field ‘Update Page’ is just simply blank.

    I do not think there was any serverside issues that affected this, but I could be wrong. Anyone have any idea on why this no longer works?

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

  • ekko848
    Participant

    @ekko848

    Note I am still on buddypress 2.5.2 (the same version I was on a few weeks ago when this was working).. maybe I should try to update and see if that fixes the issue?

    Or can my function to insert the custom HTML in every users field be optimized or targeted better with some different code?


    ekko848
    Participant

    @ekko848

    Ended up inserting random data into ‘Update Field’ on activation, and now code works to ‘overwrite’ that data and insert html again.

    I think the reason before was because ‘Update Field’ had no data so profile was not registering it as a field to display.

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