using bp profile search inside a plugin

BP Profile Search › using bp profile search inside a plugin

  • Author
    Post
  • #8608 Reply
    Fidel Duque
    Guest

    Hi! let me give you a little context. I’m using buddypress and bp search profile in the members directory page and that works like charm (thanks,by the way).

    right now i gotta create a plugin that will show all members like the front end but I’ll show another fields. That’s working right now. But I tried to put this in my code:

    <?php
    	do_action ('bps_display_form', 1385);
    ?>

    and nothing happens, this is what the html page shows instead:

    <!-- BP Profile Search 4.5.2 members/bps-form-legacy (1385, ) -->
    <!-- BP Profile Search 4.5.2 members/bps-form-legacy (1385, ) - end -->

    What am I missing? please, help

    #8611 Reply
    andrea
    Plugin Author

    Hi Fidel,

    Looks like the form template is empty. To make sure, please update BP Profile Search to the latest version, then open its file bps-form.php, locate the line:

    echo "\n<!-- BP Profile Search $version $template ($args) - end -->\n";
    

    then, right above it, add the following line:

    echo "\n<!-- found $found -->";
    

    Save the file and, after you run the plugin, look at the HTML page. You should see something like this:

    <!-- BP Profile Search 4.6.1 members/bps-form-legacy (1385, ) -->
    .
    .
    .
    <!-- found (location of the template that was found) -->
    <!-- BP Profile Search 4.6.1 members/bps-form-legacy (1385, ) - end -->

    Take a look at the template that was found, and please report here your findings. If you don’t want to share details on the forum, you can use my Contact page.

    #8612 Reply
    Fidel Duque
    Guest

    Hi! this is what i got:

    <!– found –>
    <!– BP Profile Search 4.6.1 members/bps-form-legacy (1385, ) –>
    <!– BP Profile Search 4.6.1 members/bps-form-legacy (1385, ) – end –>

    so the $found variable is empty, right? what does it means?

    #8613 Reply
    andrea
    Plugin Author

    Hi Fidel,

    The new line of code must be placed right before the second BP Profile Search line, that with the end inside.

    Please let me know!

    #8614 Reply
    Fidel Duque
    Guest

    oops! got it.

    <!– found /web_app/wordpress/wp-content/plugins/bp-profile-search/templates/members/bps-form-legacy.php –>

    #8615 Reply
    andrea
    Plugin Author

    Thank you Fidel.

    The template is found in the standard location and, if you didn’t modify it, it should be working properly.

    Did you enable WP debug? If not, please edit your wp-config.php, locate the line:

    define('WP_DEBUG', false);
    

    and change it to:

    define('WP_DEBUG', true);
    

    Then run the plugin again, and note the errors reported, if any.

    #8616 Reply
    Fidel Duque
    Guest

    could I add that just in the bps-form.php file? this is production site and don’t want the users to see the debug info.

    #8617 Reply
    andrea
    Plugin Author

    Yes, you could set WP_DEBUG true in the first line of bps_call_template(), then set it false before the return statement.

Reply to: using bp profile search inside a plugin
My Information