just had a quick look
this should get you close, totally untested !!
<?php $args = array( 'post_type' => 'topic', 'post_parent' => bbp_get_forum_id() );
$loop = new WP_Query( $args );
//get the current topic id or maybe depending in where you are putting this - bbp_get_reply_topic_id or bbp_get_reply_id()
$topic_id = bbp_get_topic_id() ;
while ( $loop->have_posts() ) : $loop->the_post();
$cur_id = get_the_ID();
if ($cur == $topic_id) {
$prev = get_previous_post() ;
$prev_id = $prev->ID ;
$next = get_next_post();
$next_id = $next->ID ;
break ;
}
endwhile;
//so you now have $cur_id, $prev_id and $next_id
//so create 3 lines
if (!empty ($prev_id)) {
$permalink = get_permalink($prev_id) ;
$title = get_the_title ($prev_id) ;
echo '<a href="'.$permalink.'">'.$title.'</a>' ;
}
if (!empty ($cur_id)) {
$permalink = get_permalink($cur_id) ;
$title = get_the_title ($cur_id) ;
echo '<a href="'.$permalink.'">'.$title.'</a>' ;
}
if (!empty ($next_id)) {
$permalink = get_permalink($next_id) ;
$title = get_the_title ($next_id) ;
echo '<a href="'.$permalink.'">'.$title.'</a>' ;
}
?>
solution is
.single-forum .post-navigation .nav-links {
display: none !important;
}
.single-topic .post-navigation .nav-links {
display: none;
}
Update Feb 11, 2021.
Having looked at this more thoroughly it looks like what has happened is that most of my replies have been treated as separate topics by the importer. Having had a deeper look between the replies that were imported properly and those that ended up in separate topics, it is likely related to the fact that all of my replies had been submitted by a form. These replies were then manually moved into the appropriate thread, however because of this, there is no value in the replyto column of the posts table. I believe that the converter relies on this relationship to combine replies in the same topic as opposed to relying on the tid column.
I am working my way through the converter code to see if I can identify the function that establishes this relationship with hopes of updating it to work. Alternatively I may have to manually update the post table in MyBB prior to import to establish this relationship.
I made the list
<?php $args = array( 'post_type' => 'topic', 'post_parent' => bbp_get_forum_id() ); $loop = new WP_Query( $args ); ?>
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
<a href="<?php echo get_the_permalink(); ?>"><?php the_title(); ?></a>
<?php endwhile;?>
This gives me all the topics under the current topic’s forum (I’m on single-topic.php)
Is there a way I could limit the list to 5 links (that’s easy, post_per_page = 5
) but on top of that only show the adjacent posts?
Topic 3 link
Topic 4 link
Topic 5 link <----- I'm here
Topic 6 link
Topic 7 link
In the above example, it’s showing me 2 previous adjacent posts and to next adjacent posts
What happens is if I set post_per_page
to 5 then this happens
Topic 1 link
Topic 2 link
Topic 3 link
Topic 4 link
Topic 5 link <----- I'm here
The current link is always last, I realized this is more of a wordpress question but I’d like to try my luck here since I already opened a thread
there are filters for topics and replies
bbpress 2.6.6\includes\topics\functions.php lines 389 and 705
$redirect_url = apply_filters( 'bbp_new_topic_redirect_to', $redirect_url, $redirect_to, $topic_id );
$topic_url = apply_filters( 'bbp_edit_topic_redirect_to', $topic_url, $view_all, $redirect_to );
bbpress 2.6.6\includes\replies\functions.php lines 473 and 768
$reply_url = apply_filters( 'bbp_new_reply_redirect_to', $reply_url, $redirect_to, $reply_id );
$reply_url = apply_filters( 'bbp_edit_reply_redirect_to', $reply_url, $redirect_to );
which Weglot can apply query args to
ok, hard to help without a link – a bit like trying to fix a car by email ๐
try
#bbpress .post-navigation {
display : none !important ;
}
add this to your theme’s custom css
Hi Robin,
Forum is logged-in users only ๐
Theme is Astra.
Maybe the code is helpful?
Code from the Forum-Next-Link:
<nav class=”navigation post-navigation” role=”navigation” aria-label=”Messages”>
<h2 class=”screen-reader-text”>Navigation</h2>
<div class=”nav-links”><div class=”nav-next”>Next Forum<span class=”ast-right-arrow”>→</span></div></div>
</nav> </main><!– #main –>
Code from the Topic-Next-Link:
<nav class=”navigation post-navigation” role=”navigation” aria-label=”Messages”>
<h2 class=”screen-reader-text”>Navigation</h2>
<div class=”nav-links”><div class=”nav-next”>” rel=”next”>Next Subject <span class=”ast-right-arrow”>→</span></div></div>
</nav> </main><!– #main –>
Oh my! Many thanks uksentinel! That worked for taking away the search bar above the forum and keeping the sidebar.
Offtopic/sidenote: for every thing I do on my page I feel really proud of my self. Never knew I could even get a site up and running. Now I am doing code (however with extremely good guides from you guys ofc!) and I feel amazing ๐ Thank you for helping out!
WP Version 5.6.1 – BBpress Version 2.6.6 – Site is currently private and in development.
I am trying to import a relatively small, private MyBB forum (200 Forums, 290 threads, 9000 posts, 50 users) however I keep running into an issue where the converter somehow gets a total count of 5703 threads which makes several duplicates of every thread. If it was a smaller circumstance I would just manually delete the duplicates however which such a huge number of duplicates I was hoping some skilled eyes might see or understand what has happened.
I have a bit of a background in coding so have been trying to troubleshoot through the code to understand when it is reading the thread table why it would end up with exponentially more thread rows than actually exist. In review the thread table I have confirmed that there are only 290 rows so I am not sure what the converter code is doing to create this circumstance.
I have read through the converter and converter class files, but can’t seem to pin point where in the Step Seven, Topic conversion that this error is being produced.
If anyone can provide any assistance with experience with this, or pointing me in the direction of the files of code that I should be trying to troubleshoot to ensure I am in the right direction, that would be greatly appreciated!
this turns comments on in bbpress
add_filter ('bbp_force_comment_status' , 'rew_set_comments_on') ;
function rew_set_comments_on () {
return true ;
}
Put this in your child theme’s function file –
ie wp-content/themes/%your-theme-name%/functions.php
where %your-theme-name% is the name of your theme
or use
Code Snippets
I’m digging through php and can’t locate where the word “On” gets inserted.
bbpress/includes/replies/template/php
lines 660-680
function bbp_get_reply_post_date( $reply_id = 0, $humanize = false, $gmt = false ) {
$reply_id = bbp_get_reply_id( $reply_id );
// 4 days, 4 hours ago
if ( ! empty( $humanize ) ) {
$gmt_s = ! empty( $gmt ) ? 'G' : 'U';
$date = get_post_time( $gmt_s, $gmt, $reply_id );
$time = false; // For filter below
$result = bbp_get_time_since( $date );
// August 4, 2012 at 2:37 pm
} else {
$date = get_post_time( get_option( 'date_format' ), $gmt, $reply_id, true );
$time = get_post_time( get_option( 'time_format' ), $gmt, $reply_id, true );
$result = sprintf( _x( '%1$s at %2$s', 'date at time', 'bbpress' ), $date, $time );
}
// Filter & return
return apply_filters( 'bbp_get_reply_post_date', $result, $reply_id, $humanize, $gmt, $date, $time );
}
comment_status
is closed
in these pages, wish I knew of a way to enable them.
I got this from stackoverflow
function set_post_comment_status( $post_id, $status = 'open' ){
global $wpdb;
$wpdb->update( $wpdb->prefix . 'posts', [ 'comment_status' => $status ], [ 'ID' => $post_id ] );
}
and tried passing the topic id, it didn’t work
Someone may need it, so I’ll update it.
function hhj_bbp_random_topic() {
global $post;
$args = array('post_type' => 'topic','orderby' => 'rand','post_status'=>'publish','posts_per_page' => '10');
$myposts = get_posts( $args );
foreach( $myposts as $post ) : setup_postdata($post); ?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a><br/>
<?php
endforeach;
wp_reset_postdata();
}
add_shortcode('hhj_bbp_random_topic', 'hhj_bbp_random_topic');
ref.
https://wordpress.stackexchange.com/questions/50761/when-to-use-wp-query-query-posts-and-pre-get-posts
Hi. This is not a CSS bit of code. it is for your functions PHP file.
@ajtruckle
I am having the same issue with participants not able to add images without moderation.
How can I add the remove moderation code to my theme’s additional css?
This line brings up an error
add_filter( ‘bbp_bypass_check_for_moderation’, ‘__return_true’ );
ok, still not sure why you want the ability for someone to comment on a forum page, or more strangely in a topic page??
but try setting up a page with the the same permalink as your forums root, and then put the shortcode
[bbp-forum-index]
in it
then set that page to have comments
it might work, it might not !
bbp style pack has buttons for subscribe
bbp style pack
once activated go to
dashboard>settings>bbp style pack>buttons
you can crack the code in includes/functions around line 336 if you want to look at code
Are there buttons or individual links for the subscription link? a substitute to this
<?php echo bbp_get_forum_subscription_link( array( 'before' => '', 'subscribe' => 'Subscribe', 'unsubscribe' => 'Unsubscribe' ) ); ?>
I tried modifying this but all I could change was the string and that wouldn’t work well also, I’d add icons to the strings and they’d disappear once the toggling starts.
I’d like to wrap two buttons in a an if statement once I get those individual subscription buttons, if there are any that is
Fatal error: Uncaught Error: Cannot use a scalar value as an array in ..\wp-content\plugins\bbpress-post-topics\index.php:924
Stack trace: #0 ..\wp-includes\class-wp-hook.php(287): bbppt_activate('')
#1 ..\wp-includes\class-wp-hook.php(311): WP_Hook->apply_filters('', Array)
#2 ..\wp-includes\plugin.php(484): WP_Hook->do_action(Array)
#3 ..\wp-admin\plugins.php(193): do_action('activate_bbpres...')
#4 {main} thrown in ..\wp-content\plugins\bbpress-post-topics\index.php on line 924
Edit: formatted for readability
if so it is being caused by line 62 of et-divi-customizer-cpt-global-16127219190526.min which says
.et-db #et-boc .et-l .et_pb_section {
padding:54px 0;
}
ok,
so if I am understanding, you have bbpress template files in your child theme under a folder called bbpress
These are just templates which can be amended to get the look you want, which is obviously what tyhe multinews theme has done.
so if correct you have 3 choices
- stay with the new files and lose the presentation you had
- go back to the old files – if they work, they are just templates and should be fine
- work out which templates are causing the issue and look to update these to any new code (which would require you to understand some php)
If everything was working, then I’d suggest you go back to the old files.
sorry shoudl be != means not equal
$role = bbp_get_user_role( $user_id );
if ($role != 'bbp_blocked' && $post_count > 4)
Thanks again for the answer.
Your code check if user is blocked.
Should I write like if ($role == 'bbp_keymaster' || $role == 'bbp_moderator'|| $role == 'bbp_participant'|| $role == 'bbp_spectator' && $post_count > 4)
Or I can use ! as counter statement to blocked somewhere in your code?
I can’t see to get
<?php comments_template(); ?>
to work, it only outputs the stringcomments are closed.
The plugin ‘bbPress Topics for Posts’ could’ve helped buy I’m getting an error when I activate it.Is there a way I could enable comments on/under forum or topic pages?