Search Results for 'code'
-
AuthorSearch Results
-
April 11, 2021 at 6:00 am #219927
Topic: Defoult Page vs Shortcode page
in forum TroubleshootingRicsca2
ParticipantBy default the forum can be reached on the forums page which is not actually a page.
However, you can also create a page with the shortcode [bbp-forum-index] .
What is the shortcose for if the forum page already exists?
Thank youApril 8, 2021 at 1:26 pm #219888In reply to: Archive old topics
Robin W
Moderatorok, so if you are happy to move them to a different forum, then contact me via
and I’ll give you some code
April 5, 2021 at 1:35 pm #219802quix8
ParticipantThanks, but I Just found #16 here:
With this in place I can just add the backlink in the forums description then. I need to hide the breadcrumb then via CSS on the forum page and also in the page I used the forum shortcode.
Maybe in future we can build a better solution for this matter. But also my use case might be kinda special.
April 5, 2021 at 1:32 pm #219801quix8
ParticipantI think the answer is #16 in this article:
So thank you! 🙂
I just noticed there is an issue with the < vs. gt;
it needs to be < in the code.April 5, 2021 at 9:55 am #219794In reply to: How do I edit my group forums?
dnfoz45
ParticipantThere are two “Activities” sessions, one is in the personal profile (all right in this one) and the other is in the groups profile, in the “home” menu, I really want to remove this, because it confuses people who access the groups a lot, why people they don’t go in the forum menu, they stay in the home menu and it confuses them, I just want to know, how do you remove it, because I don’t see anything on the forum helping about it or on the internet, is there a file I have to modify? any code? something?
This business of having activities (home button) in the groups, is very bad, confuses the members a lot and on the internet there is nothing saying to remove it (only from groups) I want to leave it in the personal profile
April 5, 2021 at 3:36 am #219777quix8
Participantthe single Forums breadcrumps root is the forum itself, but I need go a step further behind to the page I used the shortcode
Or I would like to replace the root with this page. I would even be able to pay for a custom development here, any recommendations?April 4, 2021 at 1:20 pm #219760Topic: Code which links to shortcode
in forum Troubleshootingvincenzon617
ParticipantHi which file do I need to edit which is associated with the shortcode
[bbp-single-view id=’popular’]? I would like to use this feature but I would like to customise the way it looks. I think it is the file ‘loop-topics.php’ but my changes are not showing up so not sure…
ThanksApril 4, 2021 at 7:03 am #219756In reply to: Change user role based on user post count?
Robin W
Moderator$users= get_users () ; if ( $users ) : foreach ( $users as $user ) : $user_data = get_userdata( $user->ID ); //whatever you want here endforeach ; endif ;April 3, 2021 at 4:14 pm #219746In reply to: Forum name on topic title
Robin W
Moderatoradd_action ('bbp_theme_before_topic_title' ,'rew_display_forum' ) ; function rew_display_forum () { $topic_forum_id = bbp_get_topic_forum_id(); $forum_title = bbp_get_forum_title( $topic_forum_id); $forum_url = bbp_get_forum_permalink( $topic_forum_id ); echo '<a class="rew-forum-name" href="'.$forum_url.'">'.$forum_title.': </a>' ; }April 3, 2021 at 1:10 pm #219743In reply to: Forum name on topic title
Robin W
Moderatorhmm… that’s not easy as you rightly say the hierarchy is
content-archive-topic
loop-topics
loop-single-topicThis last one is also used by forums, so you can’t just change that.
In this last you could hook an action to ‘bbp_theme_before_topic_title’ eg put this in your child theme functions file
add_action ('bbp_theme_before_topic_title' ,'rew_display_forum' ) ; function rew_display_forum () { $topic_forum_id = bbp_get_topic_forum_id(); $forum_title = bbp_get_forum_title( $topic_forum_id); echo '<div class="rew-forum-name">'.$forum_title.'</div>' ; }and then as the shortcode displays in a ‘page’ class and the forums in a ‘forum’ class, we can add css to hide the forum title unless we are in a page
so in your custom css area put
.rew-forum-name { display :none ; } .page .rew-forum-name { display : inline-block ; }that should work
April 3, 2021 at 11:01 am #219740Topic: Forum name on topic title
in forum Troubleshootingacb93
ParticipantHi everyone. In this moment I am using the “last topics” box in the main page of my website:
I am using the shortcode [bbp-topic-index]
Now is all OK, the topic title appears OK etc.
But I want to implement something like this in this shortcode: Forum name: Topic title
I want the Forum name before Topic title (only in the “last topics shortcode”)
How I can do it? Maybe I need to modify the loop-topics.php file?
Thanks in advance.
Regards.
Adrià Calendario.
April 3, 2021 at 8:35 am #219739In reply to: Search form dont’t display results
Robin W
ModeratorThis is probably because in the bbpress plugin there is a template called content-search.php. Many themes also now have a template file called content-search.php. Since the bbPress templates don’t necessarily need to be in a bbPress folder, the bbPress plugin is choosing the template from your theme before the template that is actually in bbPress.
To fix copy content-search.php from the bbPress plugin templates and place it in a child theme in a folder called bbpress.
So create a directory on your child theme called ‘bbpress’
ie wp-content/themes/%your-theme-name%/bbpresswhere %your-theme-name% is the name of your theme
find
wp-content/plugins/bbpress/templates/default/bbpress/content-search.php
Make a copy of this file, and put in in the directory called bbpress that you created above, so you end up with
wp-content/themes/%your-theme-name%/bbpress/content-search.php
bbPress will now use this template instead of the originalApril 2, 2021 at 3:53 pm #219730In reply to: Redirect to topic page by ID
Robin W
Moderator$topic_url = bbp_get_topic_permalink( bbp_get_reply_topic_id( $reply_id ) ); $forum_permalink = bbp_get_forum_permalink( $forum_id );two examples of what you might be after
April 2, 2021 at 11:16 am #219725In reply to: Limit tags to a pre-defined list?
Robin W
ModeratorI’m working on a pre-defined list option at the moment – probably about a week and I’ll release some code
April 1, 2021 at 7:31 am #219695Julia
ParticipantThank you for your advice.
Your code works well.
I do appreciate it every time.
April 1, 2021 at 4:33 am #219684In reply to: Deleting “_bbp_*” meta keys in wp_postmeta table
wrip
Participant@robin-w
Thanks for your reply. I have also checked the wp_posts table.SELECT * FROM wp_posts WHERE post_type = "forum" OR post_type = "topic" OR post_type = "reply"I can see some posts with the following post types:
- forum
- reply
- topic
Are these post types part of bbPress? Are there any additional post types added by bbPress?
April 1, 2021 at 4:12 am #219682Robin W
Moderatorif the reply is 1500 and the topic it belongs to 1000 then
$reply_topic_id = bbp_get_reply_topic_id(1500) if( $reply_topic_id == 1000 ){ echo 'Baseball rule'; return;April 1, 2021 at 4:00 am #219681Topic: How to customize reply insert format in specific forum?
in forum InstallationJulia
ParticipantTopic insert format in specific forum can change using following code.
For example, Forum post=1000,1300if( is_single(1000) ){ echo 'Baseball rule'; return; }elseif( is_single(1300) ) { echo 'Football rule'; return; }Then how can I customize reply insert format in specific forum?
For example, Forum post=1000,1300‘reply insert format’ in content-single-topic.php .
March 31, 2021 at 12:50 pm #219666Robin W
Moderatorok, so create a new topic form template
find
wp-content/plugins/bbpress/templates/default/bbpress/form-topic.phptransfer this to your pc and edit
change around line 199
<?php if ( ! bbp_is_single_forum() ) : ?>to
<?php if (isset($_REQUEST['bbp_forum_id'])) : ?> <input type="hidden" name="bbp_forum_id" value="<?php echo $_REQUEST['bbp_forum_id']; ?>" /> <?php elseif ( ! bbp_is_single_forum() ) : ?>and save
create a directory on your theme called ‘bbpress’
ie wp-content/themes/%your-theme-name%/bbpresswhere %your-theme-name% is the name of your theme
Then transfer the file you saved above and put in in the directory called bbpress that you created above, so you end up with
wp-content/themes/%your-theme-name%/bbpress/form-topic.phpbbPress will now use this template instead of the original
then put this in your child theme functions file
add_action ( 'bbp_template_before_single_forum', 'reww_new_topic_button' ) ; function reww_new_topic_button () { $url = $url = get_home_url(); $forum_id = bbp_get_forum_id() ; $url.='/topic-form/?bbp_forum_id='.$forum_id ; $text = 'create new topicc' ; echo '<a class="hello" href ="'.$url.'">'.$text.'</a>' ; }where ‘/topic-form/’ is the page you have the topic form on
that sends a query string to the topic form page, which is then picked up by the amended template above
March 31, 2021 at 11:30 am #219662In reply to: Change user role based on user post count?
Palagrin
ParticipantPotentially something like this, although it isn’t working as far as I can tell:
function bbp_change_user_role_login($user) { $user_id = get_current_user_id($user); $current_user_role = bbp_get_user_role($user_id); $new_role_forum_role="bbp_moderator"; $user_post_count = bbp_get_user_post_count( $user_id ); if (($current_user_role = "bbp_participant") and ($user_post_count > 20)) { bbp_set_user_role( $user_id, $new_forum_role ); } } add_action('wp_login', 'bbp_change_user_role_login');March 31, 2021 at 5:50 am #219655quix8
ParticipantHello, does nobody have an idea or tip for me?
I thought this should be a common use case to link back to the back where the forums shortcode was added.March 30, 2021 at 7:41 am #219645Palagrin
Participantthe topic and reply forms are at the bottom of the forum and topic pages, so there is no need to visit a separate page.
Well, yes, but it would be neat to have the option.
I already link to the bottom of the page form via the html anchor – I’ve coded that into my theme – but I’m trying to have these forms on separate pages entirely, to make the whole thing a bit neater.
March 30, 2021 at 4:39 am #219640Palagrin
ParticipantThat’s exactly what I want – I WANT it to use the template files!
Whilst I can use the short code bbp-new-reply for example, it needs a topic ID to work. I simply don’t understand why BBP core doesn’t generate these pages programmatically – it makes absolutely no sense to me. You would think that would be basic functionality for a forum plugin!
March 29, 2021 at 1:02 pm #219634Topic: Access sidebar on topic page
in forum Troubleshootingvincenzon617
ParticipantHi, how do I access the sidebar of the topics page – where is the file that I can add my code to so it shows up on the sidebar? What I would like to do is get the current number of replies to a topic and then depending on that, execute some shortcode.
The code I have so far is:
<?php $replycount = bbp_get_topic_reply_count( $r['topic_id'], true ); ?> <?php if($replycount > 0) : ?> <?php echo do_shortcode('[adace-ad id="4420"]'); ?> <?php else : ?> <?php if($replycount > 9) : ?> <?php echo do_shortcode('[adace-ad id="4420"]'); ?> <?php echo do_shortcode('[adace-ad id="4420"]'); ?> <?php endif; ?> <?php if($replycount > 14) : ?> <?php echo do_shortcode('[adace-ad id="4420"]'); ?> <?php echo do_shortcode('[adace-ad id="4420"]'); ?> <?php echo do_shortcode('[adace-ad id="4420"]'); ?> <?php endif; ?> <?php endif; ?>My PHP skills aren’t great so I’m not sure if this even works but I would just like to know where abouts the place this code, so it shows up on the sidebar, and so I can test it.
Thanks!
March 29, 2021 at 12:23 pm #219629Palagrin
ParticipantBut that’s using the shortcodes and creating dedicated pages in WP right?
I want BBP to automatically generate these pages, eg. https://mywebsite.blog/forums/login
Pages required would be:
– login
– register
– password reset
– new topic
– new replyMy understanding of the shortcode is that if I wanted a new topic page, I would either have to have a generic one for the whole board or I would have to create individual ones for each forum based on the forum ID.
The solution I’m looking for is for BBP to dynamically generate them as required. Is that possible?
It seems odd to me that BBP doesn’t already do this.
EDIT: would something along these lines work? https://stackoverflow.com/questions/32314278/how-to-create-a-new-wordpress-page-programmatically
-
AuthorSearch Results