I need some help. I am trying to manually insert a topic into a forum. I’m doing from a different blog on the network however so I’m assuming I can’t use BBPRESSS functions to do so. anyway the code I have so far looks like this
switch_to_blog(LP_SCHOOL_BLOG);
// Forum
$reply_data = array(
'post_parent' => 0, // topic ID
'post_status' => 'publish',
'post_type' => 'topic',
'post_author' => $current_user->ID,
'post_password' => '',
'post_content' => $post_content,
'post_title' => "New Resource: " . $post->post_title,
'menu_order' => 0,
'comment_status' => 'closed'
);
// Insert reply
$reply_id = wp_insert_post( $reply_data );
update_post_meta( $reply_id, '_bbp_author_ip' , get_user_ip() );
update_post_meta( $reply_id, '_bbp_forum_id' , 2231 );
update_post_meta( $reply_id, '_bbp_topic_id' , 0);
// update_post_meta( $reply_id, '_bbp_topic_id', (int) $topic_id );
restore_current_blog();
This code is correctly posting a topic. I can see the topic at the back end, and it looks exactly like any other topic, from the back end, but it is not appearing in the forum listing at the front end.Is there some additional bit of meta data that I have to insert? to get it to show up at the front end?
TIA
m
hey @23creative Thanks for sharing your code. I’m interested in testing it to see if I can get it to work for my needs. Sorry for what may be a basic question, but where in the code do you place the names of the multiple tags that you want users to be forced choose from?
Is it possible you show it in an example?
Thanks a bunch.
I fixed this problem change from form-topic.php
<?php if ( bbp_current_user_can_access_create_topic_form() ) : ?>
to
<?php if ( is_user_logged_in() ) : ?>
@tonycntr
you could remove some capabilities from some user roles
https://wordpress.org/plugins/members/
this guide will help find the user capabilies ( what they do is self explanatory)
https://codex.bbpress.org/bbpress-user-roles-and-capabilities/
as for a membership plugin s2 member and pmpPRO (its free) with its bbPress addon should be two good candidates.
sorry want on the past day
this looks like the wrong CSS to use if the topic was too wide to me.
.bbp-reply-content p {
width : 580px !important ;
}
remove it so i could check it out.
then i will be able to fix this issue and other one.
should be very familiar to the other subscription link
span#subscription-toggle a.subscription-toggle
@kellygree
but when I try to register it direct me to my wordpress login page
ive looked into this and its normal, its because the register form functionality isnt really finished
https://bbpress.trac.wordpress.org/ticket/2137
you can use the default WordPress registration pages if you want they are fine for user registration for all your users, and you could customize the default WordPress registration pages with some other plugins too.
if you want dedicated front-end forms use a plugin like this
https://wordpress.org/plugins/theme-my-login/
our login shortcode [bbp-login] works fine though.
I found the culprit. I don’t know how I missed it before, but by default a registered user is added as a participant. This toggle was forcing me on the site, even when I removed myself.
I can hack the plugin and set that as false by default. I’ll just need to remember to fix that every time the plugin updates, and I’ll need to let users know that they need to add a forum role to their users (which shouldn’t be a big deal).
Looks like I can do that on bbpress/includes/admin/settings/line 532 changing the true to false.
<input name="_bbp_allow_global_access" id="_bbp_allow_global_access" type="checkbox" value="1" <?php checked( bbp_allow_global_access( true ) ); bbp_maybe_admin_setting_disabled( '_bbp_allow_global_access' ); ?> />
I can understand why it’s set this way. It does make the plugin work “out of the box” in a way that users would otherwise need to sort through what is already a very intricate settings panel.
it seems bbpress uses user_nicename to mention (AT) users, how to modify the code to change it to mention users through display_name (I can make sure each user has a unique display_name during signup).
- Create folder
bbpress-permalinks-with-id in wp-content/plugins dir.
- Download 1.0.3 version github . com / korobochkin/bbpress-permalinks-with-id/releases/tag/v1.0.3 (remove spaces bbPress forum doesn’t allow publish links)
- Unpack archive.
- Put
plugin folder content into the bbpress-permalinks-with-id.
- Activate plugin.
- Flush rules by visiting
/wp-admin/options-permalink.php page.
And after this in all bbpress permalinks for topics and forums will be using ID’s instead of slugs.
Yes, I added CSS code to change the width of two rows of the forum index:
li.bbp-forum-topic-count,
li.bbp-topic-voice-count,
li.bbp-forum-reply-count,
li.bbp-topic-reply-count {
float: left;
text-align: center;
width: 12%;
}
li.bbp-forum-freshness,
li.bbp-topic-freshness {
text-align: center;
float: left;
width: 20%;
}
And also this, because the topic display was to wide too:
.bbp-reply-content p {
width : 580px !important ;
}
Maybe I could fix the problem here by also setting the width to 580px for the edit field, but I have no clue how.
@olivereggertsen
it seems to work find on my end.
i didnt manually add da_DK to the wp-config.php file though i just went to settings > general and changed the language.
are you sure you did it correctly??
make sure to follow these guides
https://codex.bbpress.org/bbpress-in-your-language/
https://codex.bbpress.org/bbpress-in-your-language/danish-dansk-da_dk/
if you need any additional help reply back.
You really are helpful, robkk!
just going down the list haha
span#favorite-toggle a.favorite-toggle
span#subscription-toggle a.subscription-toggle
make sure you have favorites and subscriptions activated in settings > forums
you might have to make a copy of the login widget , and customize it to how you want it.
Layout and functionality – Examples you can use
This part of the guide shows you how to add custom links to their profile and also an edit link.
if you copy the edit link and just change the last slug in the url you could get to most of your profile sections.
so in the end you might have
<p><a href="<?php bbp_user_profile_url( bbp_get_current_user_id() ); ?>edit" >Edit Profile/Change password</a></p>
<p><a href="<?php bbp_user_profile_url( bbp_get_current_user_id() ); ?>" >View Profile</a></p>
<p><a href="<?php bbp_user_profile_url( bbp_get_current_user_id() ); ?>topics" >Topics Created</a></p>
<p><a href="<?php bbp_user_profile_url( bbp_get_current_user_id() ); ?>replies" >Replies Created</a></p>
<p><a href="<?php bbp_user_profile_url( bbp_get_current_user_id() ); ?>subscriptions" >Subscriptions</a></p>
<p><a href="<?php bbp_user_profile_url( bbp_get_current_user_id() ); ?>favorites" >Favorites</a></p>
You really are helpful, robkk! 🙂
I have no idea where they went. I can at least now see where they are suppose to be…
In the second image down, the area is marked #8 on this page:
https://codex.bbpress.org/bbpress-styling-crib/
Do you know what the class/id of this is, so I can see if I accidentally hid it in the css? I can’t imagine why, as I really want these links!
Thanks so much again,
Sharon
try this
#bbpress-forums ul.bbp-forums-list li.bbp-forum a {
display: inline !important;
}
this should do it
#bbpress-forums #bbp-your-profile fieldset.submit {
padding: 0px;
}
ok never mind fixed it by adding
-webkit-animation-duration: 0s; /* Chrome, Safari, Opera */
animation-duration: 0s;
one plugin was adding
animation-duration: 0.0001s
to all img tags
bbpress uses wordpress registration and assigns the default role set in settings>forums upon first user login.
so any wordpress registration will work
bbpress has a shortcodes
[bbp-login] – Display the login screen.
[bbp-register] – Display the register screen.
or you can use sidebar widgets also
I am painstakingly going through the code to fix this issue, and due to the fact that I have no experience with bbpress code, it is way more taxing than it should be.
I will leave crumbs here so anyone more equipped than myself can jump in and repair it before I do and save us all a lot of trouble.
I have discovered that there is a bug with the following function:
bbp_forum_query_last_reply_id
This is called when the update freshness repair is run and is supposed to return the last reply ID for a forum. Right now, it is consistently returning ‘0’.
It is found in includes/forums/functions.php
They work fine.
there is some CSS hiding your content though. i just changed clear:none to clear:left
if you find any other style awkwardness tell me and i could fix it pretty quick.
add this anywhere you can add custom css
#bbpress-forums #bbp-user-wrapper ul.bbp-lead-topic,
#bbpress-forums #bbp-user-wrapper ul.bbp-topics,
#bbpress-forums #bbp-user-wrapper ul.bbp-forums,
#bbpress-forums #bbp-user-wrapper ul.bbp-replies,
#bbpress-forums #bbp-user-wrapper fieldset.bbp-form {
clear: left;
}
its not a widget its the [bbp-forum-index] shortcode
there is a couple of alternatives if you do want it in widget form though..
did you create a custom widget?? it might be better if you did for this because then you could output all of the links to the user profile.
unfortunately not, as i’m using a plugin (jquery-vertical-accordion-menu) for the accordion/dropdown menu widget for that menu, which makes it more complicate, i guess. does the
$id_base = 'dc_jqaccordion_widget';
help with this and if where and what else to put in the code for a custom widget that’s using the accordion/dropdown menu as well?
initially hoped that making a redirect via permalink in functions.php or via page template would be the fastest and easiest solution. am i totally wrong with this?
as i’m not familiar with coding, i see a high risk of having set wrong variables all the time. i’m using default bbpress setting with a nicername/username instead of user’s id in the permalink.
Yes, it does have Woocommerce shortcode.
Here’s the link, in case it helps…
bellynsoul.com/my-account.
Thanks!
Sharon