Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 9,926 through 9,950 (of 32,511 total)
  • Author
    Search Results
  • #155847
    Ellievant
    Participant

    Hey there,
    after having recently started with bbpress 2.5.4 and WP 4.1, I ran into a “404” problem after having created forum and topic as per the step-by-step directive (using method #2 with shortcode).
    Right from the start, a “404” appeared when startgin from the forum index page (the one with the shortcode). I spent the last 40 hrs reading and trying the various proposed fixes, none worked.
    However, deactivating the installed plugins and trying did point to WooCommerce Multilingual
    being the culprit, since the forums, subforums, categories, topics work fine when WC Mutlilingual is deactivated. If WC ML is activated, the same URL (using “postname”) is crashing to a “404”.

    I somebody has run into similar problem and/or a diagnosis on what the reason is-
    or even better can provide the magic fix, please step up and collect the praise… I myself m at the very end of my wits and carry a dangerous 1/8 knowledge about what I am doing…

    Cheers,
    O.

    #155845
    Robin W
    Moderator

    To change it in the database, you need to

    find out the id of the user – you can look that up in the ‘users’ table – probably called ‘wp_users’, just look for a line with the username in, and the user_id will be in the ID column.

    Then in the usermeta table sort by user_id, and look for your user, then the entry called

    wp_capabilities

    For a keymaster and admin it needs to say

    a:2:{s:13:"administrator";s:1:"1";s:13:"bbp_keymaster";b:1;}

    so FIRST copy what is already in there and save it to notepad or somewhere safe – you’ll want to be able to change it back if it doesn’t work and locks you out !!

    Then edit and put the above in.

    #155844
    Bob1nz
    Participant

    Hi

    This is my third time trying to post here hopefully it sticks this time.

    I am trying to add some custom roles to the bbpress forums and I have followed the Custom Capabilities codex page.

    It doesn’t appear to be working as intended though as I cannot give myself the owner role

    I would like these roles in bbpress to sync with some custom wp roles made with the members plugin.

    sorry for the wall of text below but its an effort to get this topic posted (i had links in the previous topics)

    here is what i have in my child themes functions.php

    // add bbPress Roles********************************************
    
     
    function add_new_roles( $bbp_roles )
    {
        /* Add a role called BlockFusion Owner */
        $bbp_roles['bbp_owner'] = array(
            'name' => 'BlockFusion Owner',
            'capabilities' => custom_capabilities( 'bbp_owner' )
            );
     
        /* Add a role called Co-Owner */
        $bbp_roles['bbp_co_owner'] = array(
            'name' => 'Co-Owner',
            'capabilities' => custom_capabilities( 'bbp_co_owner' )
            );
     
        /* Add a role called Admin */
        $bbp_roles['bbp_admin'] = array(
            'name' => 'Admin',
            'capabilities' => custom_capabilities( 'bbp_admin' )
            );
     
        /* Add a role called Moderator */
        $bbp_roles['bbp_moderator'] = array(
            'name' => 'Moderator',
            'capabilities' => custom_capabilities( 'bbp_moderator' )
            );
     
        /* Add a role called Member */
        $bbp_roles['bbp_member'] = array(
            'name' => 'Member',
            'capabilities' => custom_capabilities( 'bbp_member' )
            );
     
        /* Add a role called Guest */
        $bbp_roles['bbp_guest'] = array(
            'name' => 'Guest',
            'capabilities' => custom_capabilities( 'bbp_guest' )
            );
     
        return $bbp_roles;
    }
     
    add_filter( 'bbp_get_dynamic_roles', 'add_new_roles', 1 );
     
    function add_role_caps_filter( $caps, $role )
    {
        /* Only filter for roles we are interested in! */
        if( $role == 'bbp_owner' )
            $caps = custom_capabilities( $role );
     
        if( $role == 'bbp_co_owner' )
            $caps = custom_capabilities( $role );
     
        if( $role == 'bbp_admin' )
            $caps = custom_capabilities( $role );
     
        if( $role == 'bbp_moderator' )
            $caps = custom_capabilities( $role );
     
        if( $role == 'bbp_member' )
            $caps = custom_capabilities( $role );
     
        if( $role == 'bbp_guest' )
            $caps = custom_capabilities( $role );
     
        return $caps;
    }
     
    add_filter( 'bbp_get_caps_for_role', 'add_role_caps_filter', 10, 2 );
     
    function custom_capabilities( $role )
    {
        switch ( $role )
        {
     
            /* Capabilities for 'BlockFusion Owner' role */
            case 'bbp_owner':
                return array(
    
    				// Keymasters only
    				'keep_gate'             => true,
                    
                    // Primary caps
                    'spectate'              => true,
                    'participate'           => true,
                    'moderate'              => true,
                    'throttle'              => true,
                    'view_trash'            => true,
     
                    // Forum caps
                    'publish_forums'        => true,
                    'edit_forums'           => true,
                    'edit_others_forums'    => true,
                    'delete_forums'         => true,
                    'delete_others_forums'  => true,
                    'read_private_forums'   => true,
                    'read_hidden_forums'    => true,
     
                    // Topic caps
                    'publish_topics'        => true,
                    'edit_topics'           => true,
                    'edit_others_topics'    => true,
                    'delete_topics'         => true,
                    'delete_others_topics'  => true,
                    'read_private_topics'   => true,
     
                    // Reply caps
                    'publish_replies'       => true,
                    'edit_replies'          => true,
                    'edit_others_replies'   => true,
                    'delete_replies'        => true,
                    'delete_others_replies' => true,
                    'read_private_replies'  => true,
     
                    // Topic tag caps
                    'manage_topic_tags'     => true,
                    'edit_topic_tags'       => true,
                    'delete_topic_tags'     => true,
                    'assign_topic_tags'     => true,
                );
     
                /* Capabilities for 'Co-Owner' role */
            case 'bbp_co_owner':
                return array(
                    // Primary caps
                    'spectate'              => true,
                    'participate'           => true,
                    'moderate'              => true,
                    'throttle'              => true,
                    'view_trash'            => true,
     
                    // Forum caps
                    'publish_forums'        => true,
                    'edit_forums'           => true,
                    'edit_others_forums'    => true,
                    'delete_forums'         => true,
                    'delete_others_forums'  => true,
                    'read_private_forums'   => true,
                    'read_hidden_forums'    => true,
     
                    // Topic caps
                    'publish_topics'        => true,
                    'edit_topics'           => true,
                    'edit_others_topics'    => true,
                    'delete_topics'         => true,
                    'delete_others_topics'  => true,
                    'read_private_topics'   => true,
     
                    // Reply caps
                    'publish_replies'       => true,
                    'edit_replies'          => true,
                    'edit_others_replies'   => true,
                    'delete_replies'        => true,
                    'delete_others_replies' => true,
                    'read_private_replies'  => true,
     
                    // Topic tag caps
                    'manage_topic_tags'     => true,
                    'edit_topic_tags'       => true,
                    'delete_topic_tags'     => true,
                    'assign_topic_tags'     => true,
                );
     
                /* Capabilities for 'Admin' role */
            case 'bbp_admin':
                return array(
                    // Primary caps
                    'spectate'              => true,
                    'participate'           => true,
                    'moderate'              => true,
                    'throttle'              => true,
                    'view_trash'            => true,
     
                    // Forum caps
                    'publish_forums'        => false,
                    'edit_forums'           => false,
                    'edit_others_forums'    => false,
                    'delete_forums'         => false,
                    'delete_others_forums'  => false,
                    'read_private_forums'   => true,
                    'read_hidden_forums'    => true,
     
                    // Topic caps
                    'publish_topics'        => true,
                    'edit_topics'           => true,
                    'edit_others_topics'    => true,
                    'delete_topics'         => true,
                    'delete_others_topics'  => true,
                    'read_private_topics'   => true,
     
                    // Reply caps
                    'publish_replies'       => true,
                    'edit_replies'          => true,
                    'edit_others_replies'   => true,
                    'delete_replies'        => true,
                    'delete_others_replies' => true,
                    'read_private_replies'  => true,
     
                    // Topic tag caps
                    'manage_topic_tags'     => true,
                    'edit_topic_tags'       => true,
                    'delete_topic_tags'     => true,
                    'assign_topic_tags'     => true,
                );
     
                /* Capabilities for 'Moderator' role */
            case 'bbp_moderator':
                return array(
                    // Primary caps
                    'spectate'              => true,
                    'participate'           => true,
                    'moderate'              => true,
                    'throttle'              => true,
                    'view_trash'            => true,
     
                    // Forum caps
                    'publish_forums'        => false,
                    'edit_forums'           => false,
                    'edit_others_forums'    => false,
                    'delete_forums'         => false,
                    'delete_others_forums'  => false,
                    'read_private_forums'   => true,
                    'read_hidden_forums'    => true,
     
                    // Topic caps
                    'publish_topics'        => true,
                    'edit_topics'           => true,
                    'edit_others_topics'    => true,
                    'delete_topics'         => true,
                    'delete_others_topics'  => true,
                    'read_private_topics'   => true,
     
                    // Reply caps
                    'publish_replies'       => true,
                    'edit_replies'          => true,
                    'edit_others_replies'   => true,
                    'delete_replies'        => true,
                    'delete_others_replies' => true,
                    'read_private_replies'  => true,
     
                    // Topic tag caps
                    'manage_topic_tags'     => true,
                    'edit_topic_tags'       => true,
                    'delete_topic_tags'     => true,
                    'assign_topic_tags'     => true,
                );
     
                /* Capabilities for 'Member' role */
            case 'bbp_member':
                return array(
                    // Primary caps
                    'spectate'              => true,
                    'participate'           => true,
                    'moderate'              => false,
                    'throttle'              => true,
                    'view_trash'            => false,
     
                    // Forum caps
                    'publish_forums'        => false,
                    'edit_forums'           => false,
                    'edit_others_forums'    => false,
                    'delete_forums'         => false,
                    'delete_others_forums'  => false,
                    'read_private_forums'   => true,
                    'read_hidden_forums'    => false,
     
                    // Topic caps
                    'publish_topics'        => true,
                    'edit_topics'           => true,
                    'edit_others_topics'    => false,
                    'delete_topics'         => true,
                    'delete_others_topics'  => false,
                    'read_private_topics'   => true,
     
                    // Reply caps
                    'publish_replies'       => true,
                    'edit_replies'          => true,
                    'edit_others_replies'   => false,
                    'delete_replies'        => true,
                    'delete_others_replies' => false,
                    'read_private_replies'  => true,
     
                    // Topic tag caps
                    'manage_topic_tags'     => true,
                    'edit_topic_tags'       => true,
                    'delete_topic_tags'     => true,
                    'assign_topic_tags'     => true,
                );
     
                /* Capabilities for 'Guest' role */
            case 'bbp_guest':
                return array(
                    // Primary caps
                    'spectate'              => true,
                    'participate'           => true,
                    'moderate'              => false,
                    'throttle'              => true,
                    'view_trash'            => false,
     
                    // Forum caps
                    'publish_forums'        => false,
                    'edit_forums'           => false,
                    'edit_others_forums'    => false,
                    'delete_forums'         => false,
                    'delete_others_forums'  => false,
                    'read_private_forums'   => true,
                    'read_hidden_forums'    => false,
     
                    // Topic caps
                    'publish_topics'        => true,
                    'edit_topics'           => true,
                    'edit_others_topics'    => false,
                    'delete_topics'         => true,
                    'delete_others_topics'  => false,
                    'read_private_topics'   => true,
     
                    // Reply caps
                    'publish_replies'       => true,
                    'edit_replies'          => true,
                    'edit_others_replies'   => false,
                    'delete_replies'        => true,
                    'delete_others_replies' => false,
                    'read_private_replies'  => true,
     
                    // Topic tag caps
                    'manage_topic_tags'     => true,
                    'edit_topic_tags'       => true,
                    'delete_topic_tags'     => true,
                    'assign_topic_tags'     => true,
                );
     
                break;
     
            default :
                return $role;
        }
    }
    
    #155805

    In reply to: CSS issue

    Robkk
    Moderator

    try this

    add this code anywhere you can put custom css

    li.bbp-body div.hentry {
    margin-bottom: 0;
    overflow: hidden;
    padding: 0px !important;
    }
    Robkk
    Moderator

    the loop-forums.php file you downloaded from github

    and in the same file you can change word Freshness to whatever you want.

    just change this

    <li class="bbp-forum-freshness"><?php _e( 'Freshness', 'bbpress' ); ?></li>

    to something like this for example.

    <li class="bbp-forum-freshness"><?php _e( 'Last Post', 'bbpress' ); ?></li>

    #155789

    In reply to: Import Hung?

    Robkk
    Moderator

    we are not dead :/


    @netweb
    is the bbPress community’s import specialist

    the guy is most likely asleep now because he was working on some bbPress tickets all night… or all day depending on Aussie time??

    as for bbcodes bbcodes is not a default feature for bbPress you would need an additional plugin for that.

    https://wordpress.org/plugins/gd-bbpress-tools/ this plugin comes with a quote feature and more.

    there is another plugin called bbpress 2 bbcode which would also need the whitelist plugin by the same developer.

    Robkk
    Moderator

    well really your suppose to put bbPress plugin CSS in a folder called CSS in your child theme in a file called bbpress.css , more info here

    https://codex.bbpress.org/theme-compatibility/

    but adding the code to your child themes css file is fine
    jetpack’s custom css module is fine too.

    to remove the footer completely

    remove all this code in the file.

    <li class="bbp-footer">
    
    	<div class="tr">
    		<p class="td colspan4">&nbsp;</p>
    	</div><!-- .tr -->
    
    </li><!-- .bbp-footer -->
    j0n4h
    Participant

    @skisma Actually, unrelated, but would you mind telling me where the line of code is located to change “freshness”? I know there’s that plugin, but it seems excessive to use it to change one thing.

    #155786
    Skisma
    Participant

    Sorry to ask such a silly question, but I cannot seem to find info on them other than the http://codex.bbpress.org/shortcodes/ page. I have an idea of what they are, I’m just not sure how exactly to use them. It explains on that page that I just insert them into my desired page, but does not elaborate on that. I was hoping to find an article somewhere that goes over them in detail, but have yet to find it. So, I’ve decided to make a noob post here the bbpress forums.

    Robkk
    Moderator

    its no problem with the file

    its just that the footer is a different color than it should be

    this should make it look better

    #bbpress-forums li.bbp-footer {
    background: #383838;
    border-top: none;
    font-weight: bold;
    padding: 8px;
    text-align: center;
    }
    Skisma
    Participant

    @j0n4h

    Are you talking about the spacing between each group of forums? If so, this is how the code is written and it is part of the desired layout. I just recently used this same code and my forums look great! You can compare to yours and see if there’s a difference?

    http://forgehaven.com/forums/

    #155773
    Angelo Rocha
    Participant

    I need create a query to bring the list of forums and subforums on the homepage of my website, i woudn’t like to use shortcodes cuz i want create a custom style. I did a wp-query but i can’t use functions to show the topic, replies and posts quantity.

    <?php
    	$args = array(
    		'post_type' => 'forum',
    		'order' => 'DESC',
    		'orderby' => 'date'
    	);
    	$query = new WP_Query($args);
    ?>
    Foruns|
    Posts
    <?php if( $query -> have_posts() ): ?>
    	<?php while ($query -> have_posts() ) : $query -> the_post(); ?>
    		<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
    			<?php the_title(); ?>
    		</a>
    		
    		<?php $value = bbp_get_forum_post_count(); echo $value; ?>
    		
    	<?php endwhile; ?>
    	
    	<?php wp_reset_postdata(); ?>
    	
    <?php else: ?>
    	Nothing yet...
    <?php endif; ?>

    Thanks for help.

    #155772
    Robkk
    Moderator

    add this to functions.php in your child theme

    /**
     * Include bbPress 'topic' custom post type in WordPress' search results
     */
    function ntwb_bbp_topic_cpt_search( $topic_search ) {
    	$topic_search['exclude_from_search'] = false;
    	return $topic_search;
    }
    add_filter( 'bbp_register_topic_post_type', 'ntwb_bbp_topic_cpt_search' );
    
    /**
     * Include bbPress 'reply' custom post type in WordPress' search results
     */
    function ntwb_bbp_reply_cpt_search( $reply_search ) {
    	$reply_search['exclude_from_search'] = false;
    	return $reply_search;
    }
    add_filter( 'bbp_register_reply_post_type', 'ntwb_bbp_reply_cpt_search' );

    got the code from here

    https://gist.github.com/ntwb/7363a1de1184d459f0c3

    #155768
    Angelo Rocha
    Participant

    Hi!
    How to make the bbpress content show in wordpress search? I create a custom search:

    <div class="col-md-8 col-md-offset-4 searchform-top" id="searchform-top">
    <form class="input-group" role="search" method="get" id="searchform" action="<?php echo home_url( '/' ); ?>">
        <input class="form-control input-block" id="appendedInputButton" type="text" placeholder="Buscar no site" name="s" id="s">
        <span class="input-group-btn">
            <button class="btn btn-primary" type="submit" id="searchsubmit">Buscar</button>
        </span>
    </form>
    </div>

    But bbpress results not appear when i search it.

    #155764

    In reply to: Remove Separator

    Robin W
    Moderator

    never write code whilst your other half is waiting to go out !

    ok, this works

    function remove_sep ($args) {
    $args['before'] = '' ;
    return $args ;
    }
    
    add_filter ('bbp_before_get_forum_subscribe_link_parse_args', 'remove_sep') ;
    

    On your larger point, there are a lot of resources, but it takes a lot of practice to get good at PHP, and to understand how any plugin works which is the size that bbpress is.

    Generally it is quicker to ask a question on here, than spend hours delving into bbpress. But if you start wanting to really tailor it, then the step by step guides and other documentation will try and get you into how to go about finding code within bbpress.

    I know nothing of php 18months ago (I’m just a humble bbpress user – I didn’t write any of it!), and now have several plugins for bbpress to add functionality, so it is quire do-able.

    I’ve tried to get much of my learning into the documentation, so have a look round

    Codex

    #155762
    derricksmith01
    Participant

    Hello,

    I really needed this feature so I dug into the code and came up with a solution that doesn’t modify core files. The solution hooks the query pre_get_posts and uses the buddypress ‘plugins’ template file to catch and display the group sub forums.

    This probably isn’t the most efficient solution but it seems to work in my environment. I’ll post back if I notice any issues as more subforums are created.

    Here are the functions – place in your theme’s functions.php. I also included my plugins.php file also.

    // functions.php

    
    //Filters bbpress forum permalink if on a group forum page.  Keeps users from being redirected to sitewide forums
    function buddyboss_forum_permalink($link){
    	global $wpdb, $bp;
    	if (strpos($link, "/forums/forum/")){
    
    			$forum = substr($link, strpos($link, "/forum/") + 7);   
    			$forums = explode("/",$forum);
    			$args=array(
    				'post_type' => 'forum',
    				'name' => $forums[0],
    			);
    			$root_forum = get_posts( $args );
    			$group_id = $wpdb->get_var(
    				" SELECT group_id
    				  FROM wp_bp_groups_groupmeta
    				  WHERE meta_key = 'forum_id' AND meta_value = '". serialize(array($root_forum[0]->ID)) ."'"
    			);
    			if (isset($group_id)){
    				$group = groups_get_group( array( 'group_id' => $group_id ) );
    				unset($forums[0]);
    				$forums = implode("/",$forums);
    				$permalink = bp_get_group_forum_permalink($group)."/".$forums;
    			} else {
    				$permalink = $link;
    			}
    			
    	}
    	return $permalink;
    }
    add_filter('bbp_get_forum_permalink','buddyboss_forum_permalink',10,1);
    
    //Filters bbpress topic permalink if on a group forum page.  Keeps users from being redirected to sitewide forums
    function buddyboss_topic_permalink($link){
    	global $wpdb, $bp;
    		if (strpos($link, "/forums/topic/")){
    			$start_topic = substr($link, strpos($link, "/topic/") + 7);   
    			
    			$args=array(
    				'post_type' => 'topic',
    				'name' => $start_topic,
    			);
    			$topic = get_posts( $args );
    			
    			$topic_forums = get_post_ancestors( $topic[0]->ID );
    
    			$root_forum_id = end($topic_forums);
    			$group_id = $wpdb->get_var(
    				" SELECT group_id
    				  FROM wp_bp_groups_groupmeta
    				  WHERE meta_key = 'forum_id' AND meta_value = '". serialize(array($root_forum_id)) ."'"
    			);
    			
    			if (isset($group_id)){
    				
    				$group = groups_get_group( array( 'group_id' => $group_id ) );
    				array_pop($topic_forums);  //Pop group's root forum
    				
    				foreach ($topic_forums as $forum){
    					$post = get_post($forum); 
    					$slug = $post->post_name;
    					$forum_parts .= $slug."/";
    				}
    				$permalink = bp_get_group_forum_permalink($group)."/".$forum_parts."topic/".$start_topic;
    			} else {
    				$permalink = $link;
    			}
    			
    		}	
    			
    	return $permalink;
    }
    add_filter('bbp_get_topic_permalink','buddyboss_topic_permalink',10,1);
    
    //Filters bbpress reply permalink if on a group forum page.  Keeps users from being redirected to sitewide forums
    function buddyboss_reply_permalink($link){
    	if (strpos($link, "/forums/reply/")){
    			$reply = str_replace(site_url()."/forums/reply/","reply/",$link);
    			$forum = str_replace("/forums/forum/".$bp->groups->current_group->slug, "/groups/".$bp->groups->current_group->slug ."/forum", bbp_get_topic_permalink(bbp_get_topic_id()));
    		$permalink = $forum.$reply;
    	}
    	return $link;
    }
    add_filter('bbp_get_reply_permalink','buddyboss_reply_permalink',10,1);
    
    function buddyboss_bbpress_pre_get_posts($query){
    	global $bp;
    
    	if( $query->is_main_query()) {
    		
    		if (bp_current_action() == 'forum'){
    		
    			if (!empty($bp->action_variables) && !in_array("topic", $bp->action_variables) && !in_array("reply", $bp->action_variables)){  //Sub Forum
    				$forum = end($bp->action_variables);
    				
    				$args = array(
    					'post_type' => 'forum',
    					'name' => $forum
    				);
    				$forums = get_posts( $args );	
    				$parent = $query->get('p');
    				$query->set('p','');
    				$query->set('post_parent',$parent);
    	
    				bbpress()->current_forum_id = $forums[0]->ID;
    				bbp_set_query_name( 'bbp_single_forum' );
    				
    				return $query;
    			} 
    			
    			if (empty($bp->action_variables) ) {  //Root Group Forum
    				bbp_set_query_name( 'bbp_single_forum' );
    				
    				return $query;
    				
    			}
    			
    			if (in_array("topic", $bp->action_variables) && !in_array("reply", $bp->action_variables)){  //Topic
    				$topic = end($bp->action_variables);
    				if ($topic == 'edit'){
    					$edit_key == array_search($topic,$bp->action_variables);
    					$topic = $bp->action_variables[$edit_key-1];
    				}
    				
    				$args = array(
    					'post_type' => 'topic',
    					'name' => $topic
    				);
    				$topics = get_posts( $args );	
    
    				$query->set('p','');
    				$query->set('post_parent',$topics[0]->post_parent);
    				
    				bbpress()->current_forum_id = $topics[0]->post_parent;
    				bbpress()->current_topic_id = $topics[0]->ID;
    				bbp_set_query_name( 'bbp_single_topic' );
    				if (end($bp->action_variables) == 'edit'){
    					bbpress()->current_view_id = 'edit';
    				}
    				
    				return $query;
    			}
    			
    			if (in_array("topic", $bp->action_variables) && in_array("reply", $bp->action_variables)){ //Reply
    				$reply = array_search('reply', $bp->action_variables);
    				$reply_id = $bp->action_variables[$reply+1];
    			
    				$reply_post = get_post( $reply_id );
    				$query->set('p',$reply_id);
    				
    				bbpress()->current_topic_id = $reply_post->post_parent;
    				bbpress()->current_reply_id = $reply_id;
    				bbp_set_query_name( 'bbp_single_reply' );
    				if (end($bp->action_variables) == 'edit'){
    					bbpress()->current_view_id = 'edit';
    				}
    				return $query;
    			}
    			
    		}
    	}
    	return $query;
    }
    add_action('pre_get_posts','buddyboss_bbpress_pre_get_posts',10, 1);
    
    function buddyboss_bbpress_is_edit($retval){
    	global $bp;
    	if (end($bp->action_variables) == 'edit') $retval = true;
    	return $retval;
    }
    add_filter('bbp_is_topic_edit','buddyboss_bbpress_is_edit', 10, 1);
    add_filter('bbp_is_reply_edit','buddyboss_bbpress_is_edit', 10, 1);
    
    function buddyboss_bbpress_form_reply_content($retval){
    	global $bp;
    	if (end($bp->action_variables) == 'edit' && in_array('topic', $bp->action_variables) && in_array('reply', $bp->action_variables)) {
    		$post = get_post( bbpress()->current_reply_id );
    		return esc_textarea( $post->post_content );
    	}
    }
    add_filter('bbp_get_form_reply_content','buddyboss_bbpress_form_reply_content', 10, 1);
    
    function buddyboss_bbpress_form_topic_content($retval){
    	global $bp;
    	if (end($bp->action_variables) == 'edit' && in_array('topic', $bp->action_variables) && !in_array('reply', $bp->action_variables)) {
    		$post = get_post( bbpress()->current_topic_id );
    	
    		return esc_textarea( $post->post_content );
    	}
    }
    add_filter('bbp_get_form_topic_content','buddyboss_bbpress_form_topic_content', 10, 1);
    
    function buddyboss_bbpress_form_title(){
    	global $bp;
    	if (end($bp->action_variables) == 'edit' && in_array('topic', $bp->action_variables) && !in_array('reply', $bp->action_variables)) {
    		$post = get_post( bbpress()->current_topic_id );
    		return esc_html( $post->post_title );
    	}
    }
    add_filter('bbp_get_form_topic_title','buddyboss_bbpress_form_title', 10, 1);
    
    //Filters bbpress admin links if on a group forum page.  Keeps users from being redirected to sitewide forums
    function buddyboss_reply_admin_links( $links, $args ) {
    	global $bp;
    	if (bp_current_action() == 'forum'){ 
    	$dom = new DOMDocument;
    		$dom->loadHTML($links);
    		
    		foreach ($dom->getElementsByTagName('a') as $node) {
    			//print_r($node);
    			if ($node->nodeValue == 'Edit'){
    				$forum = str_replace("/forums/forum/".$bp->groups->current_group->slug, "/groups/".$bp->groups->current_group->slug ."/forum", bbp_get_topic_permalink(bbp_get_topic_id()));
    				$reply = str_replace(site_url()."/forums/reply/","reply/",$node->getAttribute( 'href' ));
    				$node->setAttribute('href', $forum.$reply);
    			}
    			
    		}
    		$links = $dom->saveHTML();
    	}
    	return $links;
    }
    add_filter( 'bbp_get_reply_admin_links', 'buddyboss_reply_admin_links', 10, 2 );
    

    /buddypress/groups/single/plugins.php

    
    <?php
    global $bp;
    
    do_action( 'bp_before_group_plugin_template' );
    
    if (bp_current_action() == 'forum'){
    	if (empty($bp->action_variables)){  //Forum
    		$bp->groups->current_group->id;
    				$group_forum = groups_get_groupmeta( $bp->groups->current_group->id, $meta_key = 'forum_id');
    				$group_forum_id = $group_forum[0];
    
    				bbpress()->current_forum_id = $group_forum_id;
    				bbp_get_template_part('content','single-forum');	
    	} elseif (!empty($bp->action_variables) && !in_array("topic", $bp->action_variables) && !in_array("reply", $bp->action_variables)){ 
    		
    				bbp_get_template_part('content','single-forum');
    	} elseif (in_array("topic", $bp->action_variables) && !in_array("reply", $bp->action_variables)){  //Topic
    		if (bbpress()->current_view_id === 'edit'){
    			echo "<div id='bbpress-forums'>";
    			echo "<a href='".bbp_get_topic_permalink()."'><h4><img src='".get_stylesheet_directory_uri()."/images/back_button.png' />Back to Topic</h4></a>";
    			bbp_get_template_part('form','topic');
    			echo "</div>";
    		} else {
    			bbp_get_template_part('content','single-topic');
    		}
    	} elseif (in_array("topic", $bp->action_variables) && in_array("reply", $bp->action_variables)){ //Reply
    		if (bbpress()->current_view_id === 'edit'){
    			echo "<div id='bbpress-forums'>";
    			echo "<a href='".bbp_get_topic_permalink()."'><h4><img src='".get_stylesheet_directory_uri()."/images/back_button.png' /> Back to Topic</h4></a>";
    			bbp_get_template_part('form','reply');
    			echo "</div>";
    		} else {
    			bbp_get_template_part('content','single-reply');
    		}
    		
    	}	
    } else {
    	do_action( 'bp_template_content' ); 
    }
    ?>
    
    <?php do_action( 'bp_after_group_plugin_template' );
    
    Robkk
    Moderator

    you can place this code into your child themes functions.php file

    
    /**
     * Include bbPress 'topic' custom post type in WordPress' search results
     */
    function ntwb_bbp_topic_cpt_search( $topic_search ) {
    	$topic_search['exclude_from_search'] = false;
    	return $topic_search;
    }
    add_filter( 'bbp_register_topic_post_type', 'ntwb_bbp_topic_cpt_search' );
    
    /**
     * Include bbPress 'reply' custom post type in WordPress' search results
     */
    function ntwb_bbp_reply_cpt_search( $reply_search ) {
    	$reply_search['exclude_from_search'] = false;
    	return $reply_search;
    }
    add_filter( 'bbp_register_reply_post_type', 'ntwb_bbp_reply_cpt_search' );

    got the code from here, i see you also commented on it to šŸ™‚

    https://gist.github.com/ntwb/7363a1de1184d459f0c3

    #155760

    In reply to: Page Not Found Error

    Robkk
    Moderator

    why didnt you use the phpbb to bbPress importer in the bbPress plugin.

    https://codex.bbpress.org/import-forums/

    #155757

    In reply to: Remove Separator

    MaxLiao
    Participant

    First of all, thank you for the response. I really appreciate your help.

    Unfortunately, that code did not work; the separator is still there. You indicated that was a possibility, so no worries.

    Since this doesn’t seem like a matter of just finding a | in some code and removing it or adding a display:none; to the CSS to remove it, is there a resource that would better help me understand how this is being accomplished? I would hate to have to ask this same question every time I want to add or remove a separator. My PHP skills exist but they are weak. Anything to help strengthen them in this regard would be fantastic.

    #155754
    Robkk
    Moderator

    if you were here I’d give you a big kiss.

    uhhhhhhhhhhhhhh , your welcome i guess?? haha

    about it not being updated in over a year , the plugin is very simple it basically just outputs a shortcode at the bottom of blog posts.

    and also that this functionality is going to be implemented in the future release of bbPress.

    so when the update comes and says bbPress for WordPress comments in the changelog of the plguin. you can pretty much just remove the topics for posts plugin from there on and just use bbPress.

    #155752

    In reply to: resize bbpress forum

    Robkk
    Moderator

    add this anywhere you can add custom css and see if this works

    .bbpress .container {
    max-width:100%;
    }

    if it doesnt try this also

    .bbpress .container {
    max-width:100% !important;
    }
    #155751
    Robkk
    Moderator

    yeah you shouldnt edit the core files.

    i see there is additional quotation marks in your code maybe replacing it with this will help.

    <span class="bbp-topic-started-by"><?php printf( __( 'Started by: %1$s', 'bbpress' ), bbp_get_topic_author_link( array( 'size' => '90' ) ) ); ?></span>

    #155744
    Robkk
    Moderator

    @skisma

    this topic is for changing the role names background color.

    like for example this site has them with a gray background

    if i use the code snippet above i can have blue for participants , red for keymasters , and yellow for moderators and so on for each role just by applying a little CSS.

    make a new topic and ill check out doing that in the next few days when i setup my custom cpu up all right with a local dev area and not use linux anymore.

    #155743
    Robkk
    Moderator

    @skisma i think that was just a mockup from this website in the link below

    and the author of this topic just stumbled upon it.

    http://www.sitepoint.com/forums/showthread.php?630149-bbPress-theme-project-Design-wireframe-UI/page3

    and since this is from 2009 it is most likely the bbpress standalone version 1.0x and such

    but you could accomplish close to the same result using wp-usersonline plugin and also the inbuilt stats shortcode and just a little bit of CSS.

    create a new topic about this though.

    #155742
    Robkk
    Moderator

    untick topic/reply edit logging in settings>forums to disable the logging of future posts.

    and add this CSS anywhere you can add custom CSS to hide the edit logs on any existing posts.

    #bbpress-forums .bbp-topic-content ul.bbp-topic-revision-log, 
    #bbpress-forums .bbp-reply-content ul.bbp-topic-revision-log, 
    #bbpress-forums .bbp-reply-content ul.bbp-reply-revision-log {
    display: none;
    }
Viewing 25 results - 9,926 through 9,950 (of 32,511 total)
Skip to toolbar