BP: Add profile field data to members directory with links

Hey guys,

First off, great site! Glad to be a member!

Im looking for a way to include data from profile fields to each listing the the members directory. I have users selecting categories on sign up with a checkbox field. Id like to add those categories to the members director under the members name. I can output the catagories easily with the following php:

do_action( 'bp_directory_members_actions' );

What id like to do is have each category link to a member search of that word. In exactly the same way as it does by default on the profile pages. Iv tried a number of ways including explode and preg_split to output the data from the field into an array so i can use a foreach to put links around them, and tried using the existing xprofile_filter_link_profile_data filter but have had no luck. It could of course been my fault [im definitely not what youd call an experienced php programmer]. Im sure this is possible and is being done, im just missing something.

Take note im looking for a way to do this with checkbox fields not just a textbox [i can achieve this already], ie multiple pieces of data [although its stored as one string in the db].

Any help would be greatly appreciated.

Cheers,
Gogger!

    Philip John

    Hiya,

    I'm not too familiar with BP and have never seen that hook before so not sure how much help I can be. However, my first thought is that you simply need to filter whatever comes through that hook.

    I suspect at that point the data is already in an array which you can run though with a search/replace.

    Phil

    gogger

    Hmmm, i bet its just me having a lack of understanding on how to use hooks and filters properly, ill sit down with the wordpress codex and a phat coffee this evening and go through it again.

    The data is not an array when its echoed from do_action( 'bp_directory_members_actions' ); - its a string... Its stored as serialized data, I think thats causing some issues too.

    Richie_KS

    hi
    add something like this to your functions.php

    function add_member_custom_extended_profile() {
    $data_name = bp_get_member_profile_data( 'field=Name' );
    $data_jobs = bp_get_member_profile_data( 'field=Jobs' );
    echo 'Name' . ' - ' . $data_name . '<br />';
    echo 'Jobs' . ' - ' . $data_jobs . '<br />';
    }
     add_action('bp_directory_members_item',  'add_member_custom_extended_profile');

    you need specify the field you want to show.

    cheers

    gogger

    Hey Richie,

    Yeah, but how would i put tags around each of the tagged categories in a checkbox type field? If i input the following they just come out as text, no link to a search of the category like it does on a normal profile [remember the field is of the checkbox type, therefore there are multiples entries to think about]:

    function add_member_custom_extended_profile() {
    $data_name = bp_get_member_profile_data( 'field= Categories' );
    echo 'Categories' . ' - ' . $data_name . '
    ';
    }
    add_action('bp_directory_members_item', 'add_member_custom_extended_profile');

    Cheers for the help so far!!

JOIN 428983 HAPPY MEMBERS

We pride ourselves on our level of customer support and responsiveness to member requests. Your WordPress experience will never be the same


Start free trial


ABOUT SSL CERTIFICATES