Ok yet again found solution on my own.
Existing script was almost valid, problem was that author had hard coded table prefixes which I changed to use prefixes from WP configuration, now it works like I wanted.
And here I posted my edited script for other user use http://pastebin.com/ANBwipYR
Hello,
I want to show the most recent reply on my home page but when I try to make it with the widget I can only see the related topic name, not reply.
I am using Enfold theme and I repaired the forum one by one but couldn’t success.
I checked all forum pages, any help will be very much appreciated.
http://myboxtr.com
I am getting;
Piroglu on I don t want to see the topic name here
30 minutes ago
I want to see;
Piroglu on This is my reply for this topic
30 minutes ago
Also in form-reply.php & form-topic.php template files (around line 68ish) you need to insert the following code. i would recommend setting up template overrides for this
<?php if ( bbp_allow_topic_tags() && current_user_can( 'assign_topic_tags' ) ) : ?>
<?php do_action( 'bbp_theme_before_reply_form_tags' ); ?>
<p>
<label for="bbp_topic_tags"><?php _e( 'Tags:', 'bbpress' ); ?></label><br />
<?php echo displayTagElements(bbp_get_form_topic_tags(), bbp_get_user_role(get_current_user_id()), 'edit'); ?>
</p>
<?php do_action( 'bbp_theme_after_reply_form_tags' ); ?>
<?php endif; ?>
you’re welcome mate. my code actually changed quite a bit form what I posted here. the tag list is pulled from wp-admin > Topics > Topic tags
updated code below
//change the seclected terms to string and return
function restrict_topic_tags( $terms, $topic_id, $reply_id ) {
if(isset($_POST['bbp_topic_tags'])){
$bbp_topic_tags = filter_input(INPUT_POST, 'bbp_topic_tags', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY);
return returnFormattedTags($bbp_topic_tags, $topic_id);
}else{
return $terms;
}
}
add_filter( 'bbp_new_reply_pre_set_terms', 'restrict_topic_tags' );
//change the seclected terms to string and return
function restrict_new_topic_tags( $topic_data ) {
//$bbp_topic_tags = $data = filter_input(INPUT_POST, 'bbp_topic_tags', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY);
if(isset($_POST['bbp_topic_tags'])){
$bbp_topic_tags = filter_input(INPUT_POST, 'bbp_topic_tags', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY);
$topic_data['tax_input'] = array('topic-tag'=>checkTags($bbp_topic_tags));
}
return $topic_data;
}
add_filter( 'bbp_new_topic_pre_insert', 'restrict_new_topic_tags' );
//change return the correct tag on a form error submission, we might need to go through the spam check here. But lets see how this goes
function loadPostTagArray( $topic_tags ) {
if( $topic_tags == 'Array'){
if ( bbp_is_post_request() && isset( $_POST['bbp_topic_tags'] ) ) {
$bbp_topic_tags = filter_input(INPUT_POST, 'bbp_topic_tags', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY);
$topic_tags = returnFormattedTags($bbp_topic_tags);
}
}
return $topic_tags;
}
add_filter( 'bbp_get_form_topic_tags', 'loadPostTagArray' );
function returnFormattedTags($topicTags){
foreach ($topicTags as $key => $topicTag){
if($key > 0) $terms .= ', ';
$terms .= esc_attr( strip_tags( $topicTag ) );
}
return $terms;
}
function checkTags($selectedTags){
$tags = get_categories( array('hide_empty'=> 0,'taxonomy' => 'topic-tag'));
$toReturn = array();
foreach($tags as $tag){
if (in_array($tag->name, $selectedTags)) {
$toReturn[] = $tag->name;
}
}
return $toReturn;
}
function displayTagElements($selectedTags, $userRole, $task){
$html = array();
$tags = get_categories( array('hide_empty'=> 0,'taxonomy' => 'topic-tag'));
$selectedTagsArray = explode(', ', $selectedTags);
if($userRole != 'bbp_participant' || $task != 'edit'){
$html[] = '<select class="chzn-select" multiple="multiple" name="bbp_topic_tags[]" id="bbp_topic_tags">';
foreach($tags as $tag){
$selected = '';
if (in_array($tag->name, $selectedTagsArray)) {
$selected = 'selected="selected"';
}
$html[] = '<option '.$selected.' value="'.$tag->name.'">'.$tag->name.'</option>';
}
$html[] = '</select>';
}else{
$html[] = $selectedTags;
}
return implode('',$html);
}
Hi. The ending / (trailing slash?) added automaticly if you setup something like /news/%POST_ID%/ on the WordPress permalinks page. And not be added if no slash at the end — /news/%POST_ID%. This works because I use user_trailingslashit() inside the code.
BuddyPress group forums not supported yet. Something hardcoded inside and I not find the solution to this issue right now but I keep digging. 🙂
i find just remowe 'show_none' => __( '(No Forum)', 'bbpress' ), from form-topic.php
If anyone stumbles upon this thread and is interested in a css solution, here is the code I use. It goes in the ‘Appearance’ -> ‘Editor’ section on the wordpress control panel or in ‘~/<your theme folder>/style.css’:
.bbp-template-notice.info { display: none; }
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;
}