Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 3,776 through 3,800 (of 32,481 total)
  • Author
    Search Results
  • Mayeenul Islam
    Participant

    @robin-w
    Thank you for the feedback.

    It’s good that the issue is already addressed.

    But the question is not about dequeuing, but about enqueuing.
    Why not the bbPress core, enqueue the stylesheet only when is_bbpress() is true?

    #199238
    lucju04
    Participant

    Hi everybody,

    I made a custom display of topics for a specific forum. Like this:

    <?php $args = array( 'post_type' => 'topic', 'posts_per_page' => 10, 'post_parent' => '410' );
    					$loop = new WP_Query( $args );
    					while ( $loop->have_posts() ) : $loop->the_post(); ?>
    						<div class="bbp-forum-table__content--grid ">
    					
    							<div class="topic-title"><a href="<?php bbp_topic_permalink(); ?>"><?php the_title(); ?></a></div>
    					
    							<div class="replies-counter"><?php bbp_topic_voice_count(); ?></div>	
    					
    							<div class="posts-counter"><?php bbp_topic_post_count(); ?></div>
    						
    							<div class="user-freshness"></div>	
    						
    						</div>
    				<?php endwhile;?>

    But it’s seems that counter isn’t correct… Did I need to add something to count correctly the voice_count and post_count ?

    I already try the repair tools πŸ™

    Thanks a lot πŸ˜‰

    #199233
    lucju04
    Participant

    Hi,

    Based on my content-archive-forum.php.

    I would like to creat a custom WP_Query like:

    <?php $args = array( 'post_type' => 'topic', 'posts_per_page' => 10, 'post_parent' => '410' );
    				$loop = new WP_Query( $args );
    				while ( $loop->have_posts() ) : $loop->the_post();
    				the_title();
    					
    				endwhile;
    		?>

    to list topic of forum with ID=410 and also message counter and freshness if it’s possible .. But I didn’t find the way to do this… Do you have a tips or exemple ? This will be very helpfull because It can solve many issue I have ahah

    #199219
    Robin W
    Moderator

    sure it’s in

    \bbpress 2.5.13\includes\common\shortcodes.php

    #199218
    lucju04
    Participant

    Sadly no it’s on my local wamp. But I can explain you of course (my bad it’s blur !).

    I just tried to analyse what’s happend to explain to you. And I realize that
    <?php echo do_shortcode( β€˜[bbp-single-forum id=123]β€˜ ); ?> did the same template content-archive-forum.php but with the [bbp-single-forum id=123] at the end.

    It seems like there is something wrong with a loop or something. Do you know where I can learn what [bbp-single-forum id=123] did exactly ?

    #199216
    Robin W
    Moderator

    But when I try to use <?php echo do_shortcode( β€˜[bbp-single-forum id=123]β€˜ ); ?> it’s a mess.

    without knowing what ‘it’s a mess’ means, not sure I can help – do you have a link to the site?

    #199212
    lucju04
    Participant

    Hi everybody,

    I’m actually developing a Forum for a WordPress site.

    My Home is composed by 3 sections. Each section is a Forum who list child forum (I’m ok with that it’s already ok). But the last section need to be a Forum who list topics of this Forum.

    But when I try to use <?php echo do_shortcode( ‘[bbp-single-forum id=123]‘ ); ?> it’s a mess.

    my content-archive-forum.php looks like:

    
    <div id="bbpress-forums">
    
    	<div class="bbpress-header">
    		<div class="bbpress-header__image">
    			<img src="image.png" alt="Illustration sabre - Forum">
    		</div>
    		<div class="bbpress-header__headline"><h1>Welcome</h1></div>
    		<div class="bbpress-header__lead-paragraphe">
    			<p>
    				Lorem ipsum dolor sit amet, consectetur adipiscing elit. <span>Donec vel auctor diam.</span> 
    				Nulla odio diam, maximus ut libero ut, <span>pharetra ullamcorper</span> orci. Sed magna nisl, 
    				pellentesque at ligula nec, condimentum viverra. Petit texte d’intro sur le forum (juste une idΓ©e)?
    			</p>
    		</div>
    	</div>
    
    	<?php bbp_get_template_part('user', 'bar'); ?>
    
    	<?php bbp_breadcrumb(); ?>
    
    	<?php bbp_forum_subscription_link(); ?>
    
    	<?php do_action( 'bbp_template_before_forums_index' ); ?>
    
    	<?php if ( bbp_has_forums() ) : ?>
    
    		<?php bbp_get_template_part( 'loop','forums'); ?>
    
    	<?php else : ?>
    
    		<?php bbp_get_template_part( 'feedback', 'no-forums' ); ?>
    
    	<?php endif; ?>
    
    	<?php do_action( 'bbp_template_after_forums_index' ); ?>
    
    </div>

    How I can just add a section who display juste the list of the topic for a specific forum ?

    Best regards ! πŸ™‚

    #199194
    Robin W
    Moderator

    The problem is that themes do not use the wordpress template standards – in many cases for good reasons, but bbpress cannot understand every theme.

    I presume you have been here

    Step by step guide to setting up a bbPress forum – Part 1

    ukutabs
    Participant

    Hi everyone,

    Hopefully someone can help me decipher this error (with WP_DEBUG). Without WP_DEBUG simply getting a blank page. Front index and viewing topics works fine, but for some reason the forums (where you see a list of topics) don’t work.

    Tried disabling all plugins, besides bbPress of course. Running the latest WordPress version 5.1.

    Kind regards,
    Jonas.

    
    Fatal error: Uncaught Error: [] operator not supported for strings in /var/www/ukuworld/wp-content/plugins/bbpress/includes/forums/functions.php:1800 Stack trace: #0 /var/www/ukuworld/wp-includes/class-wp-hook.php(286): bbp_pre_get_posts_normalize_forum_visibility(Object(WP_Query)) #1 /var/www/ukuworld/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters(NULL, Array) #2 /var/www/ukuworld/wp-includes/plugin.php(531): WP_Hook->do_action(Array) #3 /var/www/ukuworld/wp-includes/class-wp-query.php(1736): do_action_ref_array('pre_get_posts', Array) #4 /var/www/ukuworld/wp-includes/class-wp-query.php(3387): WP_Query->get_posts() #5 /var/www/ukuworld/wp-includes/class-wp.php(622): WP_Query->query(Array) #6 /var/www/ukuworld/wp-includes/class-wp.php(739): WP->query_posts() #7 /var/www/ukuworld/wp-includes/functions.php(1105): WP->main('') #8 /var/www/ukuworld/wp-blog-header.php(16): wp() #9 /var/www/ukuworld/index.php(17): require('/var/www/ukuwor...') #10 {main} thrown in /var/www/ukuworld/wp-content/plugins/bbpress/includes/forums/functions.php on line 1800
    #199084
    Robin W
    Moderator

    there is, but it is in the code, but in core code that does not have a filter to change.

    I could re-write the widget as a new one in a plugin for you, but that would be paid work !

    #199082
    Robin W
    Moderator

    as stated above

    You should note that this just magnifies the image, so it will be less defined the bigger you make it.

    best I can do without code (I’m just a bbpress user!)

    #199068
    Robin W
    Moderator

    fix is to add this to your custom css

    .bbp-logged-in img.avatar {
    	height: 80px !important;
    	width: 80px !imprtant;
    }

    and play with the number. You should note that this just magnifies the image, so it will be less defined the bigger you make it.

    the size is hard coded, so can’t be changed

    #199041
    rngeer
    Participant

    Hello,

    BBPress is running great on this site but if a visitor is a guest and clicks a topic to view the content, they are redirected to the home page. We are using WordPress pages with shortcodes to manage the forum.

    If you view the sample forum and click the I’m In topic it goes to the home page as guests. We need guests to be able to see the topic info to decide if they want to join.

    Any info would be great, here is the page:

    <a href=”http://www.raptureintheairnow.com/forums/main-forum/&#8221;

    Thank you.

    #199038

    In reply to: Layout for Categories

    pixelzen
    Participant

    This code came with the theme, I dont know how to modify it so that works with specfic categories and/or forums . It Currently shows all categories and forms and sub forums.

    #199037

    In reply to: Comments Blacklist

    Robin W
    Moderator

    ok, try this plugin

    bbp blacklist checker

    once activated go to tools>bbp blacklist checker

    This lets you switch off the code that is causing the issue.

    It’s just a bit of testing code, not intended for permanent live use, but may help confirm if it’s bbpress or something behind that is causing the issue.

    Try it for both anew post and an edited one

    #199003

    In reply to: Layout for Categories

    pixelzen
    Participant

    Yes I got that far, not sure how to use modify the following code just for that sepecific category/forum This is the code for the discussion page

    <?php
    /**
    * [g1_bbp_forums] shortcode callback function.
    *
    * @param array $atts
    * @param string $content
    * @return string
    */
    function g1_bbp_forums_shortcode( $atts, $content ) {
    /* We need a static counter to trace a shortcode without the id attribute */
    static $counter = 0;
    $counter++;
    extract( shortcode_atts( array(
    ‘id’ => ”,
    ‘class’ => ”
    ), $atts, ‘g1_bbp_forums’ ) );
    // Compose final HTML id attribute
    $final_id = strlen( $id ) ? $id : ‘g1-bbp-forums-‘ . $counter;
    // Compose final HTML class attribute
    $final_class = array(
    ‘g1-bbp-forums’,
    );
    $final_class = array_merge( $final_class, explode( ‘ ‘, $class ) );
    // Note: private and hidden forums will be excluded via the
    // bbp_pre_get_posts_normalize_forum_visibility action and function.
    $query = new WP_Query( array(
    ‘post_type’ => bbp_get_forum_post_type(),
    ‘post_parent’ => $settings[‘parent_forum’],
    ‘post_status’ => bbp_get_public_status_id(),
    ‘posts_per_page’ => get_option( ‘_bbp_forums_per_page’, 50 ),
    ‘ignore_sticky_posts’ => true,
    ‘no_found_rows’ => true,
    ‘orderby’ => ‘menu_order title’,
    ‘order’ => ‘ASC’
    ) );
    if ( ! $query->have_posts() ) {
    return ”;
    }
    // Start output buffer
    ob_start();
    ?>
    <div class=”<?php echo implode( ‘ ‘, array_map( ‘sanitize_html_class’, $final_class ) ); ?>”>
    <div class=”g1-collection g1-collection–grid g1-collection–one-third g1-collection–simple”>

      <?php while ( $query->have_posts() ) : $query->the_post(); ?>
      <li class=”g1-collection__item”>
      <article>
      <?php if ( has_post_thumbnail() ): ?>
      <figure class=”entry-featured-media”>

      post->ID ); ?>”>
      <?php the_post_thumbnail( ‘g1_one_third’ ); ?>

      </figure>
      <?php else: ?>
      <?php echo do_shortcode( ‘[placeholder icon=”camera” size=”g1_one_third”]’ ); ?>
      <?php endif; ?>
      <div class=”g1-nonmedia”>
      <div class=”g1-inner”>
      <header class=”entry-header”>
      <h3 class=”entry-title”>
      post->ID ); ?>”><?php bbp_forum_title( $query->post->ID ); ?>
      </h3>
      <p class=”entry-meta g1-meta”>
      <span><?php _e( ‘Topics’, ‘bbpress’ ); ?>: <?php bbp_forum_topic_count( $query->post->ID ); ?></span>
      <span><?php bbp_show_lead_topic() ? _e( ‘Replies’, ‘bbpress’ ) : _e( ‘Posts’, ‘bbpress’ ); ?>: <?php bbp_show_lead_topic() ? bbp_forum_reply_count( $query->post->ID ) : bbp_forum_post_count( $query->post->ID ); ?></span>
      </p>
      </header>
      <div class=”entry-summary”>
      <?php the_excerpt(); ?>
      </div>
      </div>
      </div>
      </article>

      <?php endwhile; ?>

    </div>
    </div>
    <?php
    // Reset the $post global
    wp_reset_postdata();
    // Return and flush the output buffer
    return ob_get_clean();
    }
    add_shortcode( ‘g1_bbp_forums’, ‘g1_bbp_forums_shortcode’ );

    #198995
    Robin W
    Moderator

    for anyone finding this topic

    I kicked this code around to improve it and also stop the 404 error when a participant trashes a topic, so latest version is

    /*Customize the BBPress roles to allow Participants to trash topics*/
    add_filter( 'bbp_get_caps_for_role', 'ST_add_role_caps_filter', 10, 2 );
    
    function ST_add_role_caps_filter( $caps, $role ){
        // Only filter for roles we are interested in!
        if( $role == bbp_get_participant_role() ) {
    			//only change delete topics 
    			$caps ['delete_topics']= true ;
    	}
    	return $caps;
    }
    /*then only allow participants to trash their own topics*/
    add_filter( 'bbp_map_topic_meta_caps', 'ST_tweak_trash_meta_caps', 11, 4 );
    
    function ST_tweak_trash_meta_caps( $caps, $cap, $user_id, $args ){
    	// apply only to delete_topic
    	if ( $cap == "delete_topic" ){
    		// Get the post
    		$_post = get_post( $args[0] );
    		if ( !empty( $_post ) ) {
    
    			// Get caps for post type object
    			$post_type = get_post_type_object( $_post->post_type );
    			
    			// Add 'do_not_allow' cap if user is spam or deleted
    			if ( bbp_is_user_inactive( $user_id ) ) {
    				$caps[] = 'do_not_allow';
    
    			// Moderators can always edit forum content
    			} elseif ( user_can( $user_id, 'moderate' ) ) {
    				$caps[] = 'moderate';
    
    			// User is author so allow edit if not in admin
                } elseif ( user_can( $user_id, 'participate' ) && ( (int) $user_id === (int) $_post->post_author ) ) {
                    $caps      = array();
    				
    			// Unknown so do not allow
    			} else {
    				$caps[] = 'do_not_allow';
    			}
    		}
    	}	
    	// return the capabilities
    	return $caps;
    	}
    
    //then redirect to the forum after trashing topic
    add_action('bbp_template_redirect', 'ST_trash_topic_check', 8);
    
    //check if topic has been trashed by author and show forum if it has
    function ST_trash_topic_check() {
    	$topic_slug = get_option( '_bbp_topic_slug') ;
    	//quick check if we need to do this function, so bail if not a topic
    	if (strpos($_SERVER['REQUEST_URI'], $topic_slug) == FALSE) return ;
    	$forum_slug = bbp_get_root_slug() ;
    	//if check is set (ie we prefix forums with the forum slug) then part 1 will be forum slug and part 2 will be topic slug, if not part 1 will be topic slug
    	$check = bbp_include_root_slug() ;
    	$link = explode('/',$_SERVER['REQUEST_URI']);
    	//next we need the topic id (post id) of the topic so we need to check if it is a topic and if so, find the topic id
    	if (is_user_logged_in() && $check && $link[1] == $forum_slug && $link[2] == $topic_slug ) {
    		$post = bsp_get_page_by_slug( $link[3], OBJECT, 'topic' );
    		$login_check=1 ;
    		} 
    	elseif (is_user_logged_in() && empty($check) && $link[1] === $topic_slug) {
    		$post = bsp_get_page_by_slug( $link[2], OBJECT, 'topic' );
    		$login_check=1 ;
    	}
    	//now we need to check if the topic has been trashed by author
    	if (!empty ($login_check) && $post->post_status == 'trash' && $post->post_author == get_current_user_id() ) {
    		$topic_id =  $post->ID;
    		//then redirect to the forum we came from
    		$forum = bbp_get_forum_permalink (bbp_get_topic_forum_id (  $topic_id )) ;
    		wp_redirect ($forum) ;
    		exit ;
    	}
    	else return ;
    					
    }

    I’ll add this function into my style pack plugin shortly

    bbp style pack

    #198994
    Robin W
    Moderator

    I kicked this code around to improve it and also stop the 404 error when a participant trashes a topic, so latest version is

    /*Customize the BBPress roles to allow Participants to trash topics*/
    add_filter( 'bbp_get_caps_for_role', 'ST_add_role_caps_filter', 10, 2 );
    
    function ST_add_role_caps_filter( $caps, $role ){
        // Only filter for roles we are interested in!
        if( $role == bbp_get_participant_role() ) {
    			//only change delete topics 
    			$caps ['delete_topics']= true ;
    	}
    	return $caps;
    }
    /*then only allow participants to trash their own topics*/
    add_filter( 'bbp_map_topic_meta_caps', 'ST_tweak_trash_meta_caps', 11, 4 );
    
    function ST_tweak_trash_meta_caps( $caps, $cap, $user_id, $args ){
    	// apply only to delete_topic
    	if ( $cap == "delete_topic" ){
    		// Get the post
    		$_post = get_post( $args[0] );
    		if ( !empty( $_post ) ) {
    
    			// Get caps for post type object
    			$post_type = get_post_type_object( $_post->post_type );
    			
    			// Add 'do_not_allow' cap if user is spam or deleted
    			if ( bbp_is_user_inactive( $user_id ) ) {
    				$caps[] = 'do_not_allow';
    
    			// Moderators can always edit forum content
    			} elseif ( user_can( $user_id, 'moderate' ) ) {
    				$caps[] = 'moderate';
    
    			// User is author so allow edit if not in admin
                } elseif ( user_can( $user_id, 'participate' ) && ( (int) $user_id === (int) $_post->post_author ) ) {
                    $caps      = array();
    				
    			// Unknown so do not allow
    			} else {
    				$caps[] = 'do_not_allow';
    			}
    		}
    	}	
    	// return the capabilities
    	return $caps;
    	}
    
    //then redirect to the forum after trashing topic
    add_action('bbp_template_redirect', 'ST_trash_topic_check', 8);
    
    //check if topic has been trashed by author and show forum if it has
    function ST_trash_topic_check() {
    	$topic_slug = get_option( '_bbp_topic_slug') ;
    	//quick check if we need to do this function, so bail if not a topic
    	if (strpos($_SERVER['REQUEST_URI'], $topic_slug) == FALSE) return ;
    	$forum_slug = bbp_get_root_slug() ;
    	//if check is set (ie we prefix forums with the forum slug) then part 1 will be forum slug and part 2 will be topic slug, if not part 1 will be topic slug
    	$check = bbp_include_root_slug() ;
    	$link = explode('/',$_SERVER['REQUEST_URI']);
    	//next we need the topic id (post id) of the topic so we need to check if it is a topic and if so, find the topic id
    	if (is_user_logged_in() && $check && $link[1] == $forum_slug && $link[2] == $topic_slug ) {
    		$post = bsp_get_page_by_slug( $link[3], OBJECT, 'topic' );
    		$login_check=1 ;
    		} 
    	elseif (is_user_logged_in() && empty($check) && $link[1] === $topic_slug) {
    		$post = bsp_get_page_by_slug( $link[2], OBJECT, 'topic' );
    		$login_check=1 ;
    	}
    	//now we need to check if the topic has been trashed by author
    	if (!empty ($login_check) && $post->post_status == 'trash' && $post->post_author == get_current_user_id() ) {
    		$topic_id =  $post->ID;
    		//then redirect to the forum we came from
    		$forum = bbp_get_forum_permalink (bbp_get_topic_forum_id (  $topic_id )) ;
    		wp_redirect ($forum) ;
    		exit ;
    	}
    	else return ;
    					
    }

    I’ll add this function into my style pack plugin shortly

    bbp style pack

    #198981
    Antipole
    Participant

    Yes AsynCRONousbbPress Subscriptions works out of-the-tin as described. But it turns a single email with 123 Bcc addressees into 123 single addressee emails, which breaks my ISP’s limit of 100 emails/hour. Sigh!

    I have finally achieved my own plugin which hooks onto wp_mail() and which chops up outgoing emails into multiple emails with a configured maximum Bcc addressee limit. So with my ISP’s limit of 10 addressees, my 123 notifications get sent in 12 emails each with 10 addressees plus 1 with the last 3.

    It works with all outgoing emails that supply the Bcc addresses in an array (as does bbPress) or a flat list (as does Subscribe2 for WP post notifications).

    Code here.

    #198970
    Robin W
    Moderator

    not an easy option.

    yes favorites are stored against a user.

    This gives the difficulty that you either:

    a) count favorites on then fly – ie on every page load you would cycle through each user and log the topics they have favorited and count them into an array – this will slow the site and it has to happen on every page load. you’d then store these into post meta.
    b) create some code that will count these using cron every so often, and update post meta
    c) link to the favorite button. So it would need to add when favorited and deduct when unfavorited. then you would need to allow for topics being trashed etc.

    a) is the easiest, but still a chunk of code and has site implications
    b) is probably the most practical, but will only be as current as you run cron, so could be say an hour out of date
    c) is a real bunch of code I suspect, but would be the best solution on a big website.

    aidan1387
    Participant

    I’m trying to import IPB database to bbPress with “Tools>Forums>Import Forums”.
    But I always get a log that nothing is converted:

    
    Conversion Complete
    
    No reply_to parents to convert
    
    No replies to convert
    
    No tags to convert
    
    No super stickies to stick
    
    No stickies to stick
    
    No topics to convert
    
    No forum parents to convert
    
    No forums to convert
    
    No passwords to clear
    
    No users to convert
    
    Starting Conversion
    

    Select Platform == Invision.
    IP.Board version is v3.4.6.
    How I could troubleshoot this? Where should I start at least?.

    #198935
    byzane
    Participant

    Sorry I misspoke. I was unable to run the code through my functions.php file, but it seems to be functioning through a snippet plugin:

    Code Snippets

    My bad.

    #198933
    byzane
    Participant

    I’ve been doing a lot of research and I am wondering the same thing. The closest I have found was this:

    Allow Participants to Trash / own Topics and Posts

    However, that was posted 2 years ago and it seems the code doesn’t work anymore. Ironically, @robin-w it’s your modification xD. Would you mine dropping some insight as to why the code isn’t functioning properly anymore, please. πŸ™

    #198932
    Robin W
    Moderator

    put this in your child theme’s functions file

    function rew_breadcrumbs ($args) {
    	
    	$args['home_text'] = 'your new words here';
    	return $args ;
    	
    }
    
    add_filter('bbp_before_get_breadcrumb_parse_args', 'rew_breadcrumbs');

    or use

    bbp style pack

    once activated go to

    dashboard>settings>bbp style pack>Breadcrumbs

Viewing 25 results - 3,776 through 3,800 (of 32,481 total)
Skip to toolbar