Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 3,076 through 3,100 (of 32,453 total)
  • Author
    Search Results
  • #208415
    chickencurry
    Participant

    Dear Robin,

    thanks for coming up with a solution but this is not working for me. Because of two reasons, if I create a page for every forum (and subforum I am using), I don’t have real forum overview anymore.

    The second reason is, I am using BuddyPress, where people can create facebook like groups. Those groups will get there own forum, which won’t appear on the site if I do it this way.

    So it looks like I have to do some tweaks to the code that adds topic title to the output. Honestly it’s really weird that bbPress is behaving like this. I’ve never seen a forum that doesn’t show a titles on the front page.

    #208414
    Robin W
    Moderator

    ok it is showing what I would expect.

    topics are shown only when you go into each forum which is standard bbpress behavior.

    If you would like all the forums listed with titles, then create a WordPress page for your firums and put a list of forums in it as shortcode

    [bbp-single-forum id=$forum_id] – Display a single forums topics. eg. [bbp-single-forum id=32]

    so for instance out this on a page

    [bbp-single-forum id=32]
    [bbp-single-forum id=33]
    [bbp-single-forum id=34]

    .

    #208412
    Robin W
    Moderator

    this is theme specific issue, so could be many things.

    you could try

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

    item 3 method 2, that might force your theme to use a page name

    #208406

    In reply to: sub topics not showing

    Robin W
    Moderator

    and this one tends to suggest that your theme or anther plugin is doing stuff with the replies side of bbpress

    //Lead Topic Enable
    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' );
    #208405

    In reply to: sub topics not showing

    Robin W
    Moderator

    looked in pastebin.

    I’m not sure what this function is there for, except possibly to speed up site display if they have not accessed the forum part ?

    function dequeue_bbpress_style() {
        if ( class_exists('bbPress') ) {
          if ( ! is_bbpress() ) {
            wp_dequeue_style('bbp-default');
            wp_dequeue_style( 'bbp_private_replies_style');
            wp_dequeue_script('bbpress-editor');
          }
        }
    }
    add_action( 'wp_enqueue_scripts', 'dequeue_bbpress_style', 99 );

    it does tend to suggest that you have bbp_private_replies enabled ???

    #208404
    Robin W
    Moderator

    The best solution is to clone this widget and then amend.

    so put this in your functions.php

    It creates a duplicate login widget, but you’ll find it in dashboard>appearance>widgets called
    (mat) login Widget. You can then add your code to this version

    function register_mat_login_widget() {
        register_widget("MAT_Login_Widget");
    
    }
    
    add_action('widgets_init', 'register_mat_login_widget');
    
    class MAT_Login_Widget extends WP_Widget {
    
    	/**
    	 * MAT Login Widget amended
    	 *
    	 */
    	public function __construct() {
    		$widget_ops = apply_filters( 'mat_login_widget_options', array(
    			'classname'                   => 'mat_widget_login',
    			'description'                 => esc_html__( 'A simple login form with optional links to sign-up and lost password pages.', 'bbpress' ),
    			'customize_selective_refresh' => true
    		) );
    
    		parent::__construct( false, esc_html__( '(mat) Login Widget', 'bbpress' ), $widget_ops );
    	}
    
    	/**
    	 * Register the widget
    	 *
    	 *
    	 */
    	public static function register_widget() {
    		register_widget( 'MAT_Login_Widget' );
    	}
    
    	/**
    	 * Displays the output, the login form
    	 *
    	 * 
    	 * @param array $args Arguments
    	 * @param array $instance Instance
    	 */
    	public function widget( $args = array(), $instance = array() ) {
    
    		// Get widget settings
    		$settings = $this->parse_settings( $instance );
    
    		// Typical WordPress filter
    		$settings['title'] = apply_filters( 'widget_title', $settings['title'], $instance, $this->id_base );
    
    		// mat filters
    		$settings['title']    = apply_filters( 'mat_login_widget_title',    $settings['title'],    $instance, $this->id_base );
    		$settings['register'] = apply_filters( 'mat_login_widget_register', $settings['register'], $instance, $this->id_base );
    		$settings['lostpass'] = apply_filters( 'mat_login_widget_lostpass', $settings['lostpass'], $instance, $this->id_base );
    
    		echo $args['before_widget'];
    
    		if ( ! empty( $settings['title'] ) ) {
    			echo $args['before_title'] . $settings['title'] . $args['after_title'];
    		}
    
    		if ( ! is_user_logged_in() ) : ?>
    
    			<form method="post" action="<?php bbp_wp_login_action( array( 'context' => 'login_post' ) ); ?>" class="bbp-login-form">
    				<fieldset class="bbp-form">
    					<legend><?php esc_html_e( 'Log In', 'bbpress' ); ?></legend>
    
    					<div class="bbp-username">
    						<label for="user_login"><?php esc_html_e( 'Username', 'bbpress' ); ?>: </label>
    						<input type="text" name="log" value="<?php bbp_sanitize_val( 'user_login', 'text' ); ?>" size="20" maxlength="100" id="user_login" autocomplete="off" />
    					</div>
    
    					<div class="bbp-password">
    						<label for="user_pass"><?php esc_html_e( 'Password', 'bbpress' ); ?>: </label>
    						<input type="password" name="pwd" value="<?php bbp_sanitize_val( 'user_pass', 'password' ); ?>" size="20" id="user_pass" autocomplete="off" />
    					</div>
    
    					<div class="bbp-remember-me">
    						<input type="checkbox" name="rememberme" value="forever" <?php checked( bbp_get_sanitize_val( 'rememberme', 'checkbox' ) ); ?> id="rememberme" />
    						<label for="rememberme"><?php esc_html_e( 'Keep me signed in', 'bbpress' ); ?></label>
    					</div>
    
    					<?php do_action( 'login_form' ); ?>
    
    					<div class="bbp-submit-wrapper">
    
    						<button type="submit" name="user-submit" id="user-submit" class="button submit user-submit"><?php esc_html_e( 'Log In', 'bbpress' ); ?></button>
    
    						<?php bbp_user_login_fields(); ?>
    
    					</div>
    
    					<?php if ( ! empty( $settings['register'] ) || ! empty( $settings['lostpass'] ) ) : ?>
    
    						<div class="bbp-login-links">
    
    							<?php if ( ! empty( $settings['register'] ) ) : ?>
    
    								<a href="<?php echo esc_url( $settings['register'] ); ?>" title="<?php esc_attr_e( 'Register', 'bbpress' ); ?>" class="bbp-register-link"><?php esc_html_e( 'Register', 'bbpress' ); ?></a>
    
    							<?php endif; ?>
    
    							<?php if ( ! empty( $settings['lostpass'] ) ) : ?>
    
    								<a href="<?php echo esc_url( $settings['lostpass'] ); ?>" title="<?php esc_attr_e( 'Lost Password', 'bbpress' ); ?>" class="bbp-lostpass-link"><?php esc_html_e( 'Lost Password', 'bbpress' ); ?></a>
    
    							<?php endif; ?>
    
    						</div>
    
    					<?php endif; ?>
    
    				</fieldset>
    			</form>
    
    		<?php else : ?>
    
    			<div class="bbp-logged-in">
    				<a href="<?php bbp_user_profile_url( bbp_get_current_user_id() ); ?>" class="submit user-submit"><?php echo get_avatar( bbp_get_current_user_id(), '40' ); ?></a>
    				<h4><?php bbp_user_profile_link( bbp_get_current_user_id() ); ?></h4>
    
    				<?php bbp_logout_link(); ?>
    			</div>
    
    		<?php endif;
    
    		echo $args['after_widget'];
    	}
    
    	/**
    	 * Update the login widget options
    	 *
    	 * 
    	 * @param array $new_instance The new instance options
    	 * @param array $old_instance The old instance options
    	 */
    	public function update( $new_instance, $old_instance ) {
    		$instance             = $old_instance;
    		$instance['title']    = strip_tags( $new_instance['title'] );
    		$instance['register'] = esc_url_raw( $new_instance['register'] );
    		$instance['lostpass'] = esc_url_raw( $new_instance['lostpass'] );
    
    		return $instance;
    	}
    
    	/**
    	 * Output the login widget options form
    	 *
    	 * 
    	 * @param $instance Instance
    	 */
    	public function form( $instance = array() ) {
    
    		// Get widget settings
    		$settings = $this->parse_settings( $instance ); ?>
    
    		<p>
    			<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php esc_html_e( 'Title:', 'bbpress' ); ?>
    			<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $settings['title'] ); ?>" /></label>
    		</p>
    
    		<p>
    			<label for="<?php echo $this->get_field_id( 'register' ); ?>"><?php esc_html_e( 'Register URI:', 'bbpress' ); ?>
    			<input class="widefat" id="<?php echo $this->get_field_id( 'register' ); ?>" name="<?php echo $this->get_field_name( 'register' ); ?>" type="text" value="<?php echo esc_url( $settings['register'] ); ?>" /></label>
    		</p>
    
    		<p>
    			<label for="<?php echo $this->get_field_id( 'lostpass' ); ?>"><?php esc_html_e( 'Lost Password URI:', 'bbpress' ); ?>
    			<input class="widefat" id="<?php echo $this->get_field_id( 'lostpass' ); ?>" name="<?php echo $this->get_field_name( 'lostpass' ); ?>" type="text" value="<?php echo esc_url( $settings['lostpass'] ); ?>" /></label>
    		</p>
    
    		<?php
    	}
    
    	/**
    	 * Merge the widget settings into defaults array.
    	 *
    	 * @since 2.3.0 bbPress (r4802)
    	 *
    	 * @param $instance Instance
    	 */
    	public function parse_settings( $instance = array() ) {
    		return bbp_parse_args( $instance, array(
    			'title'    => '',
    			'register' => '',
    			'lostpass' => ''
    		), 'login_widget_settings' );
    	}
    }
    #208401

    In reply to: sub topics not showing

    hydrogriff
    Participant

    If my post cannot be found, here are the custom functions I use – https://pastebin.com/n27s5S9s.
    The only plugin related to bbPress I use is – bbPress Do Shortcode and WP-Avatar.

    Hope this helps.

    #208400

    In reply to: sub topics not showing

    hydrogriff
    Participant

    @robin-w, I typed a reply with plugin information and customization that I have used and submitted. The code format was messed. I am unable to find it or edit it. Guess it should’ve been caught in moderation or spam. Can you please check it? It should be of some help.

    The subforum issue is fixed by adding $args.

    But the other issues like missing stylesheet and missing replies for topics exist.

    #208391
    Robin W
    Moderator

    no, core code does not get changed in child themes

    what did you change?

    #208390
    Matthias
    Participant

    Hi Robin,
    this code works fine, thanks. I put it in functions.php

    After this I changed some code in bbpress/includes/common/widgets.php
    The changes work fine, but it only works when I change the core file.

    When I copy widgets.php into child theme it does not work.
    Is there now way to put core code to child theme?

    Thanks
    Matthias

    #208389
    Robin W
    Moderator

    untested, but try this

    add_filter ('bbp_get_user_profile_link' , 'rew_get_user_name', 10 , 2) ;
    
    function rew_get_user_name ($user_link, $user_id ) {
    	// Validate user id
    		$user_id = bbp_get_user_id( $user_id );
    		if ( empty( $user_id ) ) {
    			return false;
    		}
    
    		$user      = get_userdata( $user_id );
    		$user_link = esc_html( $user->display_name ) ;
    
    		// Filter & return
    		return apply_filters( 'rew_get_user_name', $user_link, $user_id );
    }

    Put this in your child theme’s function file – or use

    Code Snippets

    #208388
    Matthias
    Participant

    <?php bbp_user_profile_link( bbp_get_current_user_id() ); ?>

    How can I change the code above, to show only the name, without the link to bbpress profile?

    Thanks
    Matthias

    #208380
    samtime
    Participant

    Is there any code in buddypress > notifications that we can copy over to bbpress > includes > extend > buddypress > notifications.php (or vice versa), to make bbPress notifications automatically dismiss like Private Message, Friend Request, and other BuddyPress notifications do?

    If it’s not that straight forward, then is there a way to disable this style off bbPress notifications being sent to BuddyPress?

    My users (and I) really love the notification feature, but just find it really time-consuming to have to dismiss these notifications manually.

    Appreciate any help / advice,
    Sam

    #208375
    samtime
    Participant

    Okay, thanks. I think I might have thought it was a bit more scary than it really is.
    As long as those attributes listed above only affect the design of the post, and not allow any sort of strange code to run.

    Here’s one of the posts from the user, looks like it’s just some funky formatting. Not too bad.

    html post

    Oh, and the skills tab he’s talking about in the post is to do with the Youzer plugin for BuddyPress. I think it just allows him to put more text there than neccessary, but not weird code.

    Skills bug

    #208373

    In reply to: Oh no!

    Robin W
    Moderator

    @casiepa

    you need to change this in your toolkit plugin includes/go-functions.php

    lines 55 & 56

    from

    function bbptoolkit_bbpress_list_forums() {
    	$args = array();

    to

    function bbptoolkit_bbpress_list_forums($args) {

    This brings through default values, otherwise under 2.6 sub forums don’t get shown.

    #208368

    In reply to: Oh no!

    Matthias
    Participant

    Thanks to all:
    I changed these senctence directly in feedback-no-forum.php and put it in my child theme.
    I tried this before, but did not know that this sentence has a problem with german special characters. There is an ü in this sentence and it works only if I write it in html
    &uuml; code

    <div class="bbp-template-notice">
    	<ul>
    		<li><strong><?php esc_html_e( 'Dieses Forum ist nur f&uuml;r Dauerbenutzer!', 'bbpress' ); ?></strong></li>
    	</ul>
    </div>

    Thanks all for your suggestions
    Matthias

    #208313

    In reply to: sub topics not showing

    Robin W
    Moderator

    @haddly do you have

    function custom_bbp_sub_forum_list($args)

    or as you pasted

    function custom_bbp_sub_forum_list() {

    #208310

    In reply to: sub topics not showing

    Robin W
    Moderator

    change that to

    function custom_bbp_sub_forum_list($args) {
    $args['separator'] = '';
    return $args;
    }
    add_filter('bbp_after_list_forums_parse_args', 'custom_bbp_sub_forum_list' );

    and it should be fine

    #208303

    In reply to: sub topics not showing

    haddly
    Participant

    @robin-w
    Hi there. I have finally found why this is not displaying. It isn’t the plugins 1 or 2 above but a snippet of code I added to my functions.php file a long while back. I remember adding it because the subforum topics weren’t displaying correctly and were displaying in a horizontal fashion (I think).

    If I remove this piece of code, the subforum topics now appear. The CSS is a little funky and the text a little small, but I can fix this. Sorry for not thinking to check the added snippets to my functions.php sooner.

    function custom_bbp_sub_forum_list() {
    $args['separator'] = '';
    return $args;
    }
    add_filter('bbp_after_list_forums_parse_args', 'custom_bbp_sub_forum_list' );

    #208298
    samtime
    Participant

    Hi, One of my users discovered that they can post potentially malicious HTML into the bbPress reply box.

    I once added the code below to my functions.php file, because users were not able to use Left-align, Centre, and Right-align for text, but I fear maybe it’s now given too many HTML permissions.

    Could anyone please look at this code and let me know if something needs to be changed (maybe some trues switched to falses)?

    Thank you so much, Sam

    add_filter( 'bbp_kses_allowed_tags', 'ntwb_bbpress_custom_kses_allowed_tags' );
    function ntwb_bbpress_custom_kses_allowed_tags() {
    	return array(
    		// Links
    		'a'          => array(
    			'class'    => true,
    			'href'     => true,
    			'title'    => true,
    			'rel'      => true,
    			'class'    => true,
    			'target'    => true,
    		),
    		// Quotes
    		'blockquote' => array(
    			'cite'     => true,
    		),
    		
    		// Div
    		'div' => array(
    			'class'     => true,
    		),
    		
    		// Span
    		'span'             => array(
    			'class'     => true,
                            'style'     => true,
    		),
    		
                    // Paragraph
    		'p'             => array(
    			'class'     => true,
                            'style'     => true,
    		),
    
    		// Code
    		'code'       => array(),
    		'pre'        => array(
    			'class'  => true,
    		),
    		// Formatting
    		'em'         => array(),
    		'strong'     => array(),
    		'del'        => array(
    			'datetime' => true,
    		),
    		// Lists
    		'ul'         => array(),
    		'ol'         => array(
    			'start'    => true,
    		),
    		'li'         => array(),
    		// Images
    		'img'        => array(
    			'class'    => true,
    			'src'      => true,
    			'border'   => true,
    			'alt'      => true,
    			'height'   => true,
    			'width'    => true,
    		),
    		// Tables
    		'table'      => array(
    			'align'    => true,
    			'bgcolor'  => true,
    			'border'   => true,
    		),
    		'tbody'      => array(
    			'align'    => true,
    			'valign'   => true,
    		),
    		'td'         => array(
    			'align'    => true,
    			'valign'   => true,
    		),
    		'tfoot'      => array(
    			'align'    => true,
    			'valign'   => true,
    		),
    		'th'         => array(
    			'align'    => true,
    			'valign'   => true,
    		),
    		'thead'      => array(
    			'align'    => true,
    			'valign'   => true,
    		),
    		'tr'         => array(
    			'align'    => true,
    			'valign'   => true,
    		)
    	);
    }
    #208297
    reedy
    Participant

    Unfortunately, this code didn’t work — it removed the content of all forum posts!

    #208295
    Robin W
    Moderator

    should be

    .bbp-login-form {
    	background: white !important;
    	padding: 10px !important;
    }
    #208293
    pointydrip
    Participant

    When I try to access mysite.com/forums it does not work with my theme so I copied archive-forum.php to my child theme.

    The default archive-forum.php template allows the bbpress content to appear, but not the theme header, so I stripped away the bbpress header items and replaced ‘archive-forum’ with ‘page’ like so:

    <?php
    get_header(); ?>
        <div id="forum-front" class="bbp-forum-front">
            <div class="entry-content">
                <?php bbp_get_template_part( 'content', 'page' ); ?>
            </div>
        </div><!-- #forum-front -->
        <?php do_action( 'bbp_after_main_content' ); ?>
    <?php get_sidebar(); ?>
    <?php
    get_footer();

    This makes the theme header work, but now the bbpress content is broken.
    I am getting the following error:
    Warning: count(): Parameter must be an array or an object that implements Countable in public_html/wp-includes/post-template.php on line 316

    The line in question is:

    if ( $elements['page'] > count( $elements['pages'] ) ) { // if the requested page doesn't exist
    		$elements['page'] = count( $elements['pages'] ); // give them the highest numbered page that DOES exist
    	}

    From what I understand /forums is not a page that ‘exists’, but I’ not comfortable modifying WP core. Any help would be appreciated…

    #208289
    nickds
    Participant

    Hi Clive, gyus from Divi helped me out to sort it:

    add the following CSS code to Custom CSS box in Divi > theme options > general settings:


    @media
    (max-width:980px) {
    div#bbpress-forums {
    overflow: visible !important;
    }
    }

    Maybe it will help you too.
    Nick

    #208263
    pyoil
    Participant

    If you are using SEO Yoast Plugin you can do the following to your functions.php to update the robots meta tags.

    
    function noindex_profile($html) {
      	if (bbp_is_single_user()){
    	  	$html = "noindex,nofollow";
    	} 
    	  return $html;
    }
    add_action( 'wpseo_robots', 'noindex_profile' ); 
    

    If you are not using any plugin or don’t see any robot tags to update in your userprofile, use the below instead and the insertion will be made in the head

    
    function noindex_profile() {
      	if (bbp_is_single_user()){
      	  	echo '<META NAME=”ROBOTS” CONTENT=”NOINDEX, NOFOLLOW” />' ;
      	}
    }
    add_action( 'wp_head', 'noindex_profile' );
    

    Hope this helps.

Viewing 25 results - 3,076 through 3,100 (of 32,453 total)
Skip to toolbar