Search Results for 'code'
-
AuthorSearch Results
-
September 18, 2015 at 7:38 am #166827
In reply to: My replies and my topics: Detected by the user’s IP?
project_subdomain
ParticipantUPDATE: sorry, thought code is causing the browser’s title as ” ‘s” on all non-bbpress-related pages. need to find the reason which does not seem to be in relation to this topic.
September 17, 2015 at 11:08 pm #166825Topic: Is it possible to loop bbp_register_view ?
in forum Troubleshootingwpman
ParticipantI have a taxonomy:location
I try to register views for all terms.but it doesn’t work.
function taxonomy_custom_views() {
$args = array('orderby'=>'asc','hide_empty'=>true);
$terms = get_terms(array('location'), $args);
foreach($terms as $term){
$location_term=$term->slug ;
$location_name=$term->name ;
bbp_register_view( $location_term , __( $location_name ),array('tax_query' => array(array('taxonomy' => 'location','field' => 'slug','terms' => $location_term,),),), false );
}
}
add_action( 'bbp_register_views', 'taxonomy_custom_views' );
September 17, 2015 at 6:12 pm #166820In reply to: Groups and Forums
Robkk
Moderator[bbp-topic-form forum_id=$forum_id] – Display the ‘New Topic Form’ for a specific forum ID.
September 17, 2015 at 5:59 pm #166819In reply to: Recently edited replies to the top
project_subdomain
Participantto prevent showing all users’ replies in ‘my replies’ this code works instead, which robkk wrote:
function custom_bbp_has_replies( $args ) { if ( bbp_is_single_topic() && !bbp_is_single_user() ) { $args['orderby'] .= 'post_modified'; $args['order'] .= 'DESC'; } return $args; } add_filter('bbp_before_has_replies_parse_args', 'custom_bbp_has_replies' );September 17, 2015 at 5:59 pm #166818Topic: displaying all topics from a category
in forum Showcaselfeddern
ParticipantHi,
I have a catagory with several different forums in it. I would like to display the most recent topics from the category. Am I right in thinking there is no shortcode that allows this?
Could I achieve this by just getting them to display some how by forum id? If I have to query the latest topics from certain forums which function would I have to use? I have looked at the docs but the functions don’t seem to be documented.
Thanks for any help;
September 17, 2015 at 5:46 pm #166817In reply to: My replies and my topics: Detected by the user’s IP?
project_subdomain
Participantgreat, it’s working! thank you so much – really saved my day (night already)! just had to change some brackets. so this is working:
function custom_bbp_has_replies( $args ) { if ( bbp_is_single_topic() && !bbp_is_single_user() ) { $args['orderby'] .= 'post_modified'; $args['order'] .= 'DESC'; } return $args; } add_filter('bbp_before_has_replies_parse_args', 'custom_bbp_has_replies' );September 17, 2015 at 5:23 pm #166816In reply to: Groups and Forums
chigoziekyrian
ParticipantThanks for your reply, please where can i get the forum specific topic form short code, do you have or know it? because i haven’t seen it before.. thanks
Robkk
ModeratorMoved your reply to here since it is related to the topic you created earlier.
You cannot move additional replies to a subforum by default or with a plugin I know. You may need to consider hiring a developer for to create this for you.
Since I think you basically said the topic gets hidden in all the replies. You can use this function to always display the topic no matter what page you are on like how these forums have by default.
function custom_bbp_show_lead_topic( $show_lead ) { $show_lead[] = 'true'; return $show_lead; } add_filter('bbp_show_lead_topic', 'custom_bbp_show_lead_topic' );September 17, 2015 at 4:11 pm #166807Robkk
ModeratorWell there are these if you do not have show topic lead enabled.
add_action( 'bbp_theme_before_reply_content', 'function_name' ); add_action( 'bbp_theme_after_reply_content', 'function_name' );You may need to use a conditional to only display your value on the first reply/topic if they have the same ID.
if ( bbp_get_reply_id() == bbp_get_topic_id() ) {September 17, 2015 at 3:54 pm #166805In reply to: Html tags showing up in topics & replies
Robkk
ModeratorDoes this PHP function help any?? Place this code in your child theme or funcitonality plugin.
function bbp_tinymce_paste_plain_text( $plugins = array() ) { $plugins[] = 'paste'; return $plugins; } add_filter( 'bbp_get_tiny_mce_plugins', 'bbp_tinymce_paste_plain_text' );September 17, 2015 at 3:49 pm #166803In reply to: My replies and my topics: Detected by the user’s IP?
project_subdomain
Participant@Robkk
thanks again for your effort!
Just had several tries after looking into the conditional tags also, it’s always saying that the user doesn’t have any replies to topics created yet.
Also made sure now the code of the related topic-link is causing displaying all user’s replies.September 17, 2015 at 3:20 pm #166798In reply to: My replies and my topics: Detected by the user’s IP?
Robkk
ModeratorI think this is somewhat related to your other topic here.
I guess you have to make sure the reply sorting is only working on the single topics and not the user profile pages.
You can try something like this to see if it works. You may not even need the second conditional bbp_is_single_user() but I was making sure.
function custom_bbp_has_replies( $args ) { if ( bbp_is_single_topic{} && !bbp_is_single_user() ) { $args['orderby'] .= 'post_modified'; $args['order'] .= 'DESC'; } return $args; } add_filter('bbp_before_has_replies_parse_args', 'custom_bbp_has_replies' );' );Since I am not 100% sure that I have the right conditionals since I haven’t tested this you can double check here.
September 17, 2015 at 3:05 pm #166795In reply to: Installed but no editor visible
Robkk
ModeratorIt is missing on the frontend of your site on the topic and reply forms right??
Did you make sure you have the Post Formatting enabled in Settings > Forums?
You can also see if it is a plugin issue by trying some troubleshooting. You can also see if you have some code snippet in your theme by switching to a default theme temporarily to see if it fixes the issue.
September 17, 2015 at 12:24 pm #166791In reply to: Setting New Role Upon Login with iMember360 Plugin
davellan
ParticipantStackoverflow came to the rescue, and I have this question to thank for it.
If you read all the comments, it gets to the solution, which in my case was this code.
function i4w_authenticated_remote_login_action($user, $contact) { global $SESSION; IF ($arrTAGS = explode(',', $SESSION['i4wuser']['Groups'])) : IF (in_array(38181, $arrTAGS) || in_array(38185, $arrTAGS) || in_array(38193, $arrTAGS)) : $user_id = get_current_user_id(); $new_role_forum_role="bbp_participant"; bbp_set_user_role( $user_id, $new_role_forum_role ); $wp_user_capabilities_arr = array("subscriber" => true, "bbp_participant" => true, "bbp_spectator" => false); update_user_meta($user_id, "wp_capabilities", $wp_user_capabilities_arr); ELSEIF (in_array(38177, $arrTAGS) || in_array(38195, $arrTAGS) || in_array(38183, $arrTAGS) || in_array(38187, $arrTAGS) || in_array(38189, $arrTAGS)) : $user_id = get_current_user_id(); $new_role_forum_role=”bbp_spectator”; bbp_set_user_role( $user_id, $new_role_forum_role ); $wp_user_capabilities_arr = array("subscriber" => true, "bbp_spectator" => false); update_user_meta($user_id, "wp_capabilities", $wp_user_capabilities_arr); ENDIF; ENDIF; } add_filter('i4w_authenticated_remote_login', 'i4w_authenticated_remote_login_action', 1, 2);I am a bit confused as to why I needed to use the update_user_meta to remove the additional capabilities (or why I would have had additional capabilities generated from the bbp_set_user_role function). If someone could answer that it would be greatly appreciated, as I am sure this code is not 100% efficient.
September 17, 2015 at 2:47 am #166755In reply to: My replies and my topics: Detected by the user’s IP?
project_subdomain
ParticipantSolved it, maybe it’s helping others as well.
It’s been caused by a custom code in my functions that did sort the replies and with which I had no problems so far. As bbpress now has this reply order feature integrated, it has not only become redundant but conflicting. First appearing when I star to use bbpress’ integrated reply order feature, resulting in showing all replies of a users as “my replies” instead of the user’s only.So without looking into the code I’m assuming it’s detected by the user’s ID as usual.
September 16, 2015 at 1:11 pm #166740In reply to: Forum not recognizing logged-in members
Robkk
ModeratorIt could be a caching plugin or just cache in general. You may need to clear the cache on your site to see if everything works out well. Just deactivating a cache plugin will not clear whatever cache is still saved on your site.
September 16, 2015 at 1:09 pm #166739Robkk
ModeratorTry to see if it could be a plugin issue, like a spam plugin scanning a reply before it is posted or something.
It could also be the bbPress subscriptions hogging everything down. This plugin will hopefully help things out.
https://wordpress.org/plugins/asyncronous-bbpress-subscriptions/
Robkk
ModeratorTry to see if it is a plugin issue, a code snippet in your child theme causing the issue.
September 16, 2015 at 12:53 pm #166733In reply to: members cannot reply to topics
Robkk
ModeratorTry a default theme, disable all plugins except bbPress, and hopefully you didn’t try to modify the roles and permissions.
September 16, 2015 at 12:47 pm #166731In reply to: bbPress tweaks – questions
Robkk
Moderator1) Are Private forums visible to all logged in users? I thought for sure it restricted access to only moderators and keymasters, but when I did some testing I noticed they’re very much visible. I didn’t see anything about it in the Layout and Funcionality article, so any tips on having a truly private forum for me and my forum staff?
Hidden Forums are only seen by Mods and Keymasters. Layout and Functionality article is basically a code snippet collection not something explaining how bbPress works.
The information you need to know are somewhat in here.
2) I wanted to prevent users changing their display name, so they would be forced to display themselves as whatever their username is, however, when editing form-user-edit.php they still had access to do so in the WP-Admin. Following the steps in Restricting access to WP Admin did nothing. The WP Admin Bar was still visible, and Participants or lower still have access to it.
September 16, 2015 at 12:42 pm #166730In reply to: [bbp-topic-tags] not displaying all topic tags
Robkk
ModeratorYou can use the tag cloud widget, select the taxonomy to be topic tags, then use this PHP function in your child theme or in a functionality plugin.
add_filter('widget_tag_cloud_args','set_tag_cloud_sizes'); function set_tag_cloud_sizes($args) { $args['smallest'] = 12; $args['largest'] = 19; return $args; }September 16, 2015 at 12:38 pm #166729In reply to: Change font size range for tag cloud
Robkk
ModeratorYou can use the tag cloud widget, select the taxonomy to be topic tags, then use this PHP function in your child theme or in a functionality plugin.
add_filter('widget_tag_cloud_args','set_tag_cloud_sizes'); function set_tag_cloud_sizes($args) { $args['smallest'] = 12; $args['largest'] = 19; return $args; }September 16, 2015 at 12:08 pm #166727In reply to: Link to latest reply in a topic
Robkk
ModeratorUse this PHP Function. Add it to your child themes function.php file or in a functionaility plugin.
function rkk_last_reply_link() { ?> <a class="rkk-last-reply-link" href="<?php bbp_topic_last_reply_url(); ?>">Go to latest post</a> <?php } add_action( 'bbp_template_before_replies_loop', 'rkk_last_reply_link' );September 16, 2015 at 11:44 am #166725In reply to: I can’t create a new topic in bbPress front-end
Robkk
ModeratorTry to see if there is a plugin issue also.
September 16, 2015 at 5:55 am #166722In reply to: Link to latest reply in a topic
leo-l
ParticipantOk so not sure this is the best approach but it seems to work well.
// Run query to get all the published replies for the topic $widget_query = new WP_Query( array( 'post_type' => bbp_get_reply_post_type(), 'post_parent' => bbp_get_topic_id(), 'ignore_sticky_posts' => true, 'no_found_rows' => true, 'post_status' => 'publish', ) ); // Get the replies per page setting value and the count of the total replies + 1 for the initial topic $posts_per_page = get_option('_bbp_replies_per_page'); $total_posts = $widget_query->post_count + 1; // if the total replies is greater than the per page setting pagination is used so need to structure url with page number if($total_posts > $posts_per_page) { // Work out last page number and build url using topic link and last reply id $total_pages = ceil($total_posts/$posts_per_page); $url = bbp_get_topic_permalink()."page/".$total_pages."/#post-".$widget_query->posts[0]->ID; }else{ // Same url as above but without page number as not needed $url = bbp_get_topic_permalink()."#post-".$widget_query->posts[0]->ID; }I then added the following where i wanted to place the link
if ( $widget_query->have_posts() ) { echo "<a href=\"".$url."\">Go to latest post</a>"; } -
AuthorSearch Results