Search Results for 'code'
-
AuthorSearch Results
-
April 26, 2015 at 7:34 pm #161557
In reply to: Limit tags to a pre-defined list?
23creative
Participantyou’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); }April 26, 2015 at 8:50 am #161552In reply to: how to change the post Permalinks?
Nicolas Korobochkin
ParticipantHi. 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 useuser_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. 🙂
April 26, 2015 at 6:33 am #161550Master
Participanti find just remowe
'show_none' => __( '(No Forum)', 'bbpress' ),from form-topic.phpApril 25, 2015 at 8:09 pm #161547In reply to: Removing the Status Bar in Forums
tylersoden
ParticipantIf 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; }April 25, 2015 at 2:09 pm #161538Topic: Manually inserting a topic
in forum Troubleshootings1r0n
ParticipantI 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
April 25, 2015 at 2:38 am #161527In reply to: Limit tags to a pre-defined list?
majecdad
Participanthey @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.
April 24, 2015 at 9:18 pm #161526In reply to: How allow all users create new topick
Master
ParticipantI 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() ) : ?>April 24, 2015 at 7:25 pm #161516In reply to: only paying users can reply topics
Robkk
Moderatoryou 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.
April 24, 2015 at 7:11 pm #161515In reply to: Forum overlapped by sidebar, width problem
Robkk
Moderatorsorry 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.
April 24, 2015 at 7:07 pm #161514Robkk
Moderatorplease read these two guides first , and hopefully they will help you
https://codex.bbpress.org/import-forums/
https://codex.bbpress.org/import-forums/simplepress/April 24, 2015 at 6:54 pm #161513In reply to: Different classes/Id’s for “Subscribe” links?
Robkk
Moderatorshould be very familiar to the other subscription link
span#subscription-toggle a.subscription-toggleApril 24, 2015 at 6:31 pm #161511In reply to: having problem
Robkk
Moderatorbut 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.
April 24, 2015 at 2:48 pm #161502In reply to: Remove Myself from the Forum
mrjarbenne
ParticipantI 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.
April 24, 2015 at 10:52 am #161501Topic: how to mention a user through display_name?
in forum Troubleshootingwenlujon
Participantit 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).
April 23, 2015 at 2:39 pm #161479In reply to: how to change the post Permalinks?
Nicolas Korobochkin
Participant- Create folder
bbpress-permalinks-with-idinwp-content/pluginsdir. - 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
pluginfolder content into thebbpress-permalinks-with-id. - Activate plugin.
- Flush rules by visiting
/wp-admin/options-permalink.phppage.
And after this in all bbpress permalinks for topics and forums will be using ID’s instead of slugs.
April 23, 2015 at 12:02 am #161452In reply to: Forum overlapped by sidebar, width problem
w-sky
ParticipantYes, 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.
April 22, 2015 at 10:11 pm #161446In reply to: Translation doesn't work.
Robkk
Moderatorit 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.
April 22, 2015 at 7:44 pm #161438Robkk
ModeratorYou really are helpful, robkk!
just going down the list haha
span#favorite-toggle a.favorite-toggle
span#subscription-toggle a.subscription-togglemake sure you have favorites and subscriptions activated in settings > forums
April 22, 2015 at 7:28 pm #161437In reply to: Redirect from page to profile url (menu link)
Robkk
Moderatoryou might have to make a copy of the login widget , and customize it to how you want it.
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>April 22, 2015 at 7:16 pm #161436sharongraylac
ParticipantYou 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,
SharonApril 22, 2015 at 7:12 pm #161435In reply to: Sub Forums Styling
Robkk
Moderatortry this
#bbpress-forums ul.bbp-forums-list li.bbp-forum a { display: inline !important; }April 22, 2015 at 2:33 pm #161424Robkk
Moderatorthis should do it
#bbpress-forums #bbp-your-profile fieldset.submit { padding: 0px; }April 22, 2015 at 9:03 am #161412In reply to: Need help finding cause of avatar flicker on firefox
Henrijs Kons
Participantok 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 tagsApril 22, 2015 at 7:34 am #161410In reply to: having problem
Robin W
Moderatorbbpress 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
April 22, 2015 at 5:25 am #161402cirrus123
ParticipantI 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
- Create folder
-
AuthorSearch Results