Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'bbpress'

Viewing 25 results - 17,401 through 17,425 (of 64,535 total)
  • Author
    Search Results
  • #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;
        }
    }
    
    #155841
    spespam
    Participant

    Hello,

    I have a forum which still works with a very old version of fluxbb (1.2.22).

    I tried to convert my forum using the tool inside bbpress 2.5.4 but it doesn’t work at all. No forums is imported, no users, no topics, no replies, nothing at all.

    My question is : which version of fluxbb should I have to make it work ?

    Thank you

    #155836

    Topic: BBpress tinymce

    in forum Showcase
    Hephaestus_Xii
    Participant

    Greeting from Alabama,

    I am completely new BBpress but not so much with wordpress. I would like to add a tinymce editor that mimics the wordpress editor. I search the forum but most of the solutions seem out date or dont work. I have tried a couple plugins but they dont seem to affect the bbpress editor.

    Searching through the examples of bbpress forums i found tamierlfoundry and would like to implement this tinymce editor

    View post on imgur.com

    Is there a tutorial on how this can be done
    (I post this once before but it didnt show up as posted)

    #155834

    In reply to: SMF Import to bbPress

    DeanPnet
    Participant

    Hello all. Just a couple questions, because clearly I’m doing something wrong.

    1) Is SMF.3.php on this page the correct final revision of the file needed to import?
    https://bbpress.trac.wordpress.org/ticket/2380

    2) Is that name of SMF.3.php correct, or should I rename it to SMF.php?

    3) In what directory should I place the file?

    4) In Tools > Forums > Import Forums > Select Platform, I have SMF, SMF.2, and SMF.3 available. I want SMF.3.php correct?

    When I put SMF.3.php in /public_html/wp-content/plugins/bbpress/includes/admin/converters and select “SMF.3” as the platform in the import tool, I get this message:

    Fatal error: Class ‘SMF.3’ not found in /home/dark/public_html/wp-content/plugins/bbpress/includes/admin/converter.php on line 1475

    Would someone please set me straight on all this?

    #155822
    AlexNoob
    Participant

    We have the same problem with bbPress 2.5.4 and WP 4.0.1 and 4.1…There are no answers and topics appear, but we spam messages displayed 🙂

    Did the line 142 commented out in plugins/bbpress/includes/replies/template.php

    from -> ‘s’ => $default_reply_search, // Maybe search

    to -> //’s’ => $default_reply_search, // Maybe search

    What is any good?

    -> $default_reply_search = !empty( $_REQUEST[‘rs’] ) ? $_REQUEST[‘rs’] : false;

    Sry for my english 🙂

    #155804
    Sam Rohn
    Participant

    see this article for info on bbpress test data –

    3 Quick Ways to Create bbPress Test Data

    or just download and import this file –

    https://bbpress.trac.wordpress.org/ticket/2516

    sam

    Robkk
    Moderator

    does the footer do anything important at all in bbpress inherently?

    not really, its just for design really.

    like bbpress.org doesnt even show the footer for the forums , topics , and replies loops.

    and the file loop-forums.php is only for the forum archive page, so it only shows up on that page.

    j0n4h
    Participant

    @robkk Ok, amazing, thanks. So, one more thing (hopefully), does the footer do anything important at all in bbpress inherently? In other words, will I be deleting functionality in parts of the forum? Is there an option to remove its visibility from this page alone? Thanks again, man. I really appreciate your time.

    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>

    Joe Dostie
    Participant

    Is there anywhere to report a potential SPAM account? As a new contributor it would be nice to report and account that I think is SPAM. We could take control as a team.

    This account appears to be SPAMMING with the real information behind it…

    womper (@womper)

    I looked at all their replies and they are all similar with a link in them.

    I’m thinking this would be a good opportunity for a plug in…

    Imagine if several people “voted” that you were a suspected SPAMMER
    Your account could be locked unless you went to a RECATCHA page or something like that.

    Just a thought….

    In my opinion, I wouldn’t take bbPress being SPAMED as a bad sign…that would be like blaming the rape victim because she dressed so pretty…its the SPAMMERS fault, not bbPress.

    #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 -->
    #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.

    j0n4h
    Participant

    @robkk So, that should go in my child theme’s css file? Also, how do I just disable the footer for the forums? Not sure what would go in there anyhow. I can’t seem to find where I can access bbpress footer options in the admin panel. Thanks for the response! 🙂

    Skisma
    Participant

    @j0n4h Oh my bad, you must have posted that link before I refreshed my page. Yea that is strange, did you create a folder within your child theme called bbpress? This is how it’s setup in my directory: child theme>bbpress>loop-forums.php

    Edit: Oh it looks like @Robkk got you.

    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;
    }
    j0n4h
    Participant

    Hi!

    Thanks for stopping in. After creating a child theme to add the https://github.com/robkk/bbPress-Hierarchical-Forum-and-Category-Layout php file, I noticed while it did organize categories, it also created a white space field beneath each one. Why?

    Thanks!

    #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

    #155771
    Robin W
    Moderator
    #155770
    Robkk
    Moderator

    you can use CSS but using this plugin is a whole lot easier

    https://wordpress.org/plugins/bbpress-enable-tinymce-visual-tab/

    #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.

    #155767
    cocoonfxmedia
    Participant

    Using WordPress 4.0
    BBPress 2.5.4

    I am new to BBPress to start with. We moved our site from one host to a new host. We mapped all the users with the posts/forums/replies. Then all of a sudden all Forums/Topics/Replies are all showing as the Default Keymaster (we have 2 one as support and one for our client).

    So Forum public show as Admin but the Creator of the forum in the back end shows the correct person. I have tried repairing the various areas of the forum.

    Is there away to change the Author in bulk say to the default Keymaster to another Keymaster.

    HELP!

    #155765
    siddardha
    Participant

    hello,

    i am new to bbpress and this is new to me

    does the icons look like this or is there an option to change them?

    bbpress new topic

    end users may not be able to understand them easily ( me too)

    how can they be changed?

    thank you.

    #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' );
    
Viewing 25 results - 17,401 through 17,425 (of 64,535 total)
Skip to toolbar