Frontend search options for BuddyPress

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Frontend search options for BuddyPress

This topic contains 3 replies, has 2 voices, and was last updated by

 
Keymaster
5 years, 5 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #9647

    Participant

    Hi there!

    I got some issue to fix in Your plugin.
    I have been configure setup search for only
    -bpusers,
    -bpgroups,
    -topics,

    I need to activate these options in Frontend>>general ( Show search in …… selector)

    So i edited few files to try make it at my own firstly :

    ————————————————————————
    – default-options.php

    ‘showexactmatches’ => 1,
    ‘showsearchintitle’ => 1,
    ‘showsearchincontent’ => 1,
    ‘showsearchincomments’ => 1,
    ‘showsearchinexcerpt’ => 1,

    // My Add:
    ‘searchinbpuserstext’ => 1,
    ‘searchinbpgroupstext’ => 1,
    ‘searchinbpforumstext’ => 1,

    ———————————————————————-
    – general.php
    add firstly just groups:
    <div class=”item”>
    <?php
    $o = new wpdreamsYesNo(“showsearchinbpgroups”, “Show search in excerpt selector?”, $sd[‘showsearchinbpgroups’]);
    $params[$o->getName()] = $o->getData();
    $o = new wpdreamsText(“searchinbpgroupstext”, “Text”, $sd[‘searchinbpgroupstext’]);
    $params[$o->getName()] = $o->getData();
    ?>
    </div>
    ————————————————————————-
    – asp.shortcode.general.php

    <div class=”asp_option”>
    <div class=”option<?php echo(($style[‘showsearchinbpgroups’] != 1) ? ” hiddend” : “”); ?>”>
    <input type=”checkbox” value=”None” id=”set_inexcerpt<?php echo $id; ?>”
    name=”set_inexcerpt” <?php echo $_checked[“set_inexcerpt”]; ?>/>
    <label for=”set_inexcerpt<?php echo $id; ?>”></label>
    </div>
    <div class=”label<?php echo(($style[‘showsearchinbpgroups’] != 1) ? ” hiddend” : “”); ?>”>
    <?php echo asp_icl_t(“Search in groups option” . ” ($real_id)”, $style[‘searchinbpgroupstext’]); ?>
    </div>
    </div>

    ___________________________________________

    It seems to be semi working , but checkbox is not not selecting like other ( you can see at front of: https://www.flirualni.pl )

    ————————————————-

    Could You send me a fully solution to make this implementation for now, as it is not big issue – things are code-working but just they are not showing in the frontend as option.

    Or could You make this 3 buddyPress options as standard for all in Frontend>general and update plugin to new version?

    Thank You.

    #9654

    Hi!

    The URL is unfortunately not working. Please note that this falls under the customization request category, which is not part of the support process, so I cannot guarantee it’s going to work at all.

    It’s probably not working because it’s name is not unique. The input id and name is “set_inexcerpt” and the label is for the “set_inexcerpt” field as well. You should probably change that as well.

    Please note that by simply adding a filter to the front-end will not make it functional. A handler must be created for the back-end as well, which is not an easy task to do without knowing the code. The option will be there, but it won’t do anything at all.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #9655

    Participant

    Hi. sorry for bad url.

    https://www.flirtualni.pl/

    As far as concerned the buddypress serch for users, groups and topics exist in search engine.

    I can setup only these 3 ones and it’s working with disabled “search settings switch on the frontend”

    So all i need (if it is possible – this is really not neccesary ) to add this 3 options to switch and it’s allmost done as a edit-code-work in plugin.

    Best solution for Me is to have this option developed by Author, so I ask You is it possible? And how much time woul’d it takes?

    Optionally I can try to handle it myseft :
    -Try to code it on my own or if falls
    -use 3 independent searches and make own switch with javascript
    -or just disable switch and show results mixed,

    If i would choose mixed results without switch :
    Seach results should be display ordered by these 3 categories with label over each Members: Groups: Topics:

    Is it possible with current version of plugin? ( I will try to develop that version only if other falls )

    Thanks and hope it’s not a problem!

    #9665

    Hi!

    The problem is exactly what I was thinking, the ID of the item on the front-end contains “set_inexcerpt” which refers to a different item. If you change that, it will work correctly visually.

    It still will not affect the search in any ways. This will only send additional data to the search handler, but since this new data is not handled, it won’t do anything. The buddypress user group and topic search is indeed implemented, but there is no connection in the handler yet.

    First, you should fix the front-end code to something like, and re-use this code for all 3:

    Now, you don’t need any of the back-end code, you can control this directly from here. You can copy-paste this code 3 times in the asp.shortcode.general.php, just change the $asp_front_option and the $asp_front_opt_text variables accordingly.

    Then you need to add a handler to that, open the ajax-search-pro\includes\classes\etc\class-asp_helpers.php file and scroll to lines 429-435:

    $args['bp_groups_search'] = $sd['search_in_bp_groups'] == 1;
    $args['bp_groups_search_public'] = $sd['search_in_bp_groups_public'] == 1;
    $args['bp_groups_search_private'] = $sd['search_in_bp_groups_private'] == 1;
    $args['bp_groups_search_hidden'] = $sd['search_in_bp_groups_hidden'] == 1;
    $args['bp_activities_search'] = $sd['search_in_bp_activities'] == 1;
    if ($args['bp_groups_search'] || $sd['search_in_bp_activities'])
        $args['search_type'][] = "buddypress";

    The $args array is passed to the search, the $sd array holds the search data, and the $o array are the search options, which you need.
    So, add this line below line 435:

    $args['bp_groups_search'] = isset($o['opt_bpgroup']);

    This will now handle the option we created, and pass it on if it’s selected to the arguments. You will have to do that for the other arguments you need as well.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.