Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to make “about me” kinda profile field?


  • takuya
    Participant

    @takuya

    How can I make an extra profile field, where contents DO NO link? Whatever I write in textarea’s are auto linked, no matter its form, words, sentences, paragraphs…

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

  • Burt Adsit
    Participant

    @burtadsit


    takuya
    Participant

    @takuya

    thanks for the reference, but I’d like it fixed within the next releases. In fact, it’s the only “about me” section, and I like the auto linking for other fields.


    takuya
    Participant

    @takuya

    I’ve seen some buddypress sites, where user profile field has both linked and non-linked contents.

    Does anybody know how they fixed the profile?


    Burt Adsit
    Participant

    @burtadsit

    Looking at this. Gimme a minute.


    John James Jacoby
    Keymaster

    @johnjamesjacoby

    A thought on this one (as it stands today…)

    There is a limit to the length of the trimmed text between commas for what is a link and what is not, so it is possible that what you’re seeing is an about me section that people have written longer sentences in versus a textarea with “favorite movies” that have lots of commas for separation…

    View my profile for example. The same text area has a few links, and then the last entry doesn’t get linked.


    Burt Adsit
    Participant

    @burtadsit

    We have to workaround this issue.

    function my_fix_linking(){
    remove_filter( 'bp_the_profile_field_value',
    'xprofile_filter_link_profile_data', 2 );
    add_filter( 'bp_the_profile_field_value',
    'my_filter_link_profile_data', 2, 3 );
    }
    add_action('bp_member_theme_functions', 'my_fix_linking');

    function my_filter_link_profile_data($field_value,
    $field_type = 'textbox', $field_id){
    if ( 'textbox' == $field_type)
    return $field_value;
    else xprofile_filter_link_profile_data($field_value, $field_type);
    }

    That will stop linking any field that is a text box.

    function my_filter_link_profile_data($field_value,
    $field_type = 'textbox', $field_id){
    if ( 999 == $field_id)
    return $field_value;
    else xprofile_filter_link_profile_data($field_value, $field_type);
    }

    That will stop linking for the field whose field_id is 999.

    Your choice. I haven’t tested the above code but it should work. Add the code above to your bp-custom.php file. If you don’t have one create one in /mu-plugins.


    takuya
    Participant

    @takuya

    I don\’t know because of this hack or not, but even if I delete texts I saved on my profiles, empty fileds still do appear on my profile page. Is this a bug?

    I’ve checked db tables, and they are not deleted from the database…


    takuya
    Participant

    @takuya

    and if I want more fields not auto-linked? How can I set multiple field ids?


    Burt Adsit
    Participant

    @burtadsit

    Any field you create in the profile backend will appear in each user’s profile. Even if it doesn’t have anything in it.

    More fields:

    if ( 999 == $field_id || 998 == $field_id || 2 == $field_Id)


    takuya
    Participant

    @takuya

    <br />
    function my_fix_linking(){<br />
    remove_filter( \\\\\\\'bp_the_profile_field_value\\\\\\\',<br />
    \\\\\\\'xprofile_filter_link_profile_data\\\\\\\', 2 );<br />
    add_filter( \\\\\\\'bp_the_profile_field_value\\\\\\\',<br />
    \\\\\\\'my_filter_link_profile_data\\\\\\\', 2, 3 );<br />
    }<br />
    add_action(\\\\\\\'bp_member_theme_functions\\\\\\\', \\\\\\\'my_fix_linking\\\\\\\');</p>
    <p>function my_filter_link_profile_data($field_value,<br />
    $field_type = \\\\\\\'textbox\\\\\\\', $field_id){<br />
    if ( \\\\\\\'textbox\\\\\\\' == $field_type)<br />
    return $field_value;<br />
    else xprofile_filter_link_profile_data($field_value, $field_type);<br />
    }<br />

    If above code is used, textareas will not show any contents although the data is still available on the database. If you modify the above code to only disable textareas, then textboxes will disappear.

    BBpress is modifying the code too much!!!!!!!!!!!!!!!!!!!!!!!!


    takuya
    Participant

    @takuya

    function my_fix_linking(){

    remove_filter( \'bp_the_profile_field_value\',

    \'xprofile_filter_link_profile_data\', 2 );

    add_filter( \'bp_the_profile_field_value\',

    \'my_filter_link_profile_data\', 2, 3 );

    }

    add_action(\'bp_member_theme_functions\', \'my_fix_linking\');

    This code seems to be wrong. Anyone can figure out another working code?


    Burt Adsit
    Participant

    @burtadsit

    If above code is used, textareas will not show any contents although the data is still available on the database. If you modify the above code to only disable textareas, then textboxes will disappear.

    Isn’t that what you were asking for?


    takuya
    Participant

    @takuya

    I think, remove_filter and add_filter is somewhat conflicting.

    If we can sort this out, then we should be able to choose which field is hyperlinked, and not hyperlinked.


    takuya
    Participant

    @takuya

    Burt’s hack seems not working on the latest r1324 (?)

    Even if I paste the code, my profile contents are all hyperlinked.


    takuya
    Participant

    @takuya

    I think some of methods posted here no longer works with rc2.

    We really need to make this work, and be documented for other users.


    Burt Adsit
    Participant

    @burtadsit

    The action that triggers the ‘no linking’ workaround doesn’t exist in RC2. I made it easier to specify what fields you do not want linked. I haven’t tested this but it should work.

    function my_no_links(){

    remove_filter( ‘bp_the_profile_field_value’,’xprofile_filter_link_profile_data’, 2 );

    add_filter( ‘bp_the_profile_field_value’,’my_no_links_filter’, 2, 3 );

    }

    add_action(‘plugins_loaded’, ‘my_no_links’);

    function my_no_links_filter($field_value, $field_type = ‘textbox’, $field_id){

    $no_links = array(1,5,99);

    if ( in_array((int)$field_id, $no_links))

    return $field_value;

    else

    return xprofile_filter_link_profile_data($field_value, $field_type);

    }

    This is also up on http://buddypress.pastebin.com/f461fc21e

    Put the field ids that you do not want to have automatically linked in the $no_links array.


    takuya
    Participant

    @takuya

    tested it on my site, it works.


    takuya
    Participant

    @takuya

    The solution for RC2 isn’t working anymore on 1.0 official release.

    Is there another function change between RC2 and 1.0?


    Kunal17
    Participant

    @kunal17

    I would like to know how to remove auto linking in 1.0 too


    takuya
    Participant

    @takuya

    there’s minor function chage I figured. Use the following.

    function my_no_links(){

    remove_filter( 'bp_get_the_profile_field_value', 'xprofile_filter_link_profile_data', 2, 2 );

    add_filter( 'bp_get_the_profile_field_value','my_no_links_filter', 2, 3 );

    }

    add_action('plugins_loaded', 'my_no_links');

Viewing 20 replies - 1 through 20 (of 20 total)
  • The topic ‘How to make “about me” kinda profile field?’ is closed to new replies.
Skip to toolbar