Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Brajesh Singh

    (@sbrajesh)

    Hi Andrea,
    My apologies for overlooking it.

    Thank you for taking time to write and I sincerely appreciate the past help you provided on integrating my plugins with BP Profile search. You have been awesome!

    There is an issue with supporting the custom taxonomy/post type. Currently, they are stored as searialized value.

    I am not sure if it will be a good value to search for them. For efficiency reasons, Adding the ui as selector(of all posts/terms) does not seem justifiable either.

    Please let me know if you have any suggestions.

    Thank you
    Brajesh

    Thread Starter Andrea Tarantini

    (@dontdream)

    Hi Brajesh,

    No problem, it’s easy to miss a post sometimes.

    I agree with you that searching serialized data is not efficient, but for small sites it could work reasonably well. And since your field values are stored in bp_xprofile_data, the search function is already in place.

    All you need to register the Custom Taxonomy Selector type is this code:

    add_action ('bps_custom_field', 'register_my_type');
    function register_my_type ($f)
    {
        if ($f->type != 'select_custom_taxonomy')  return;
    
        // register the format of the field type
        $f->format = 'text';
    
        // register the field options, if they are not stored in
        // the standard (wp_)bp_xprofile_fields table, e.g.
        // $f->options = array (73 => 'News', 1 => 'Uncategorized');
        $f->options = ...
    }

    For a quick summary or a detailed explanation, please see:

    https://dontdream.it/bp-profile-search/custom-profile-field-types/

    or drop me a line any time if you wish to register all your field types.

    Best regards
    Andrea

    Plugin Author Brajesh Singh

    (@sbrajesh)

    Thank you Andrea.
    I have been using your guide to integrate Profile Search with many of my public and private plugins.

    I sincerely appreciate sharing the code example.

    We can certainly add the search and provide a note to avoid it for larger installation.

    Will get in touch if I needed any help.

    Thank you
    Brajesh

    Thread Starter Andrea Tarantini

    (@dontdream)

    Hi Brajesh,

    That sounds good!

    By the way, I realized that the Custom Taxonomy Selector type mentioned in my sample code does not store serialized values, while the Custom Taxonomy Multiselector type does. In the latter case, the sample code is the same but the field format should be ‘set’ (i.e. serialized data).

    add_action ('bps_custom_field', 'register_my_type2');
    function register_my_type2 ($f)
    {
        if ($f->type != 'multiselect_custom_taxonomy')  return;
    
        $f->format = 'set';
        $f->options = ...
    }

    Thank you!
    Andrea

    Plugin Author Brajesh Singh

    (@sbrajesh)

    Hi Andrea,
    Thank you. Yes, you are right.
    It is the multi valued fields(multi selector for post/taxonomy) that store the value as serialized.

    I appreciate you providing the code. I am planning an update within next 1-2 weeks and will be using it then.

    Thank you
    Brajesh

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Registering fields with BP Profile Search’ is closed to new replies.