Limited Support
Our team is currently on holiday, so support will be limited during this period. Response times may be slower than usual, and some inquiries may be delayed.
We appreciate your patience and understanding, and we’ll resume our usual support by the end of August.
Hi, is it possible to add an "Search in this topic" function? I can use the customization of the theme, but I need an api (wpft) to search for posts with topicid.
You can check my forum with active search function
Needed changes:
classes/Post.php
942 > topicids' => [], // array( 2, 10, 25 ) 969 > if( $args['topicids'] ) $wheres[] = $fa . ".`topicid` IN(" . implode( ', ', array_map( 'intval', $args['topicids'] ) ) . ")";
wpforo.php
965 > 'topicids' => (array) wpfval( $get, 'wpft' ),
themes/x/post.php
e.g. at line 13 > <form action="<?php echo wpforo_home_url() ?>" method="get"> <?php wpforo_make_hidden_fields_from_url( wpforo_home_url() ) ?> <input name="wpfs" type="text" value> <input name="wpft" type="hidden" value="<?php echo $topic['topicid'] ?>"> <input type="submit" value="Im Beitrag suchen"> </form>
Hi @nick81
good idea, I modified the code a little bit 😉Â
so the search box will be displayed only above the first post "in all layouts"
<div class="wpf-topic-search"> <?php if( $post['is_first_post'] ): ?> <form action="<?php echo wpforo_home_url() ?>" method="get"> <?php wpforo_make_hidden_fields_from_url( wpforo_home_url() ) ?> <input name="wpfs" type="text" value> <input name="wpft" type="hidden" value="<?php echo $topic['topicid'] ?>"> <input type="submit" value="Im Thema suchen"> </form> <?php endif; ?> </div>
and with css you can customize the field
example
#wpforo #wpforo-wrap .wpf-topic-search {margin: 5px auto !important; width: 100%; text-align: center;} #wpforo #wpforo-wrap .wpf-topic-search input[type="text"]{border-radius: 5px;} #wpforo #wpforo-wrap .wpf-topic-search input[type="submit"]{border-radius: 5px !important; line-height: 15px;}
In which file put you the form? Or does this mean, that my suggestion will be released in near future?
i am not one of the developers of wpForo 😉 , so i have also added the form to the post.php of each layout