Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 5,201 through 5,225 (of 32,505 total)
  • Author
    Search Results
  • #184158
    Robin W
    Moderator

    yes there is, but basically it needs you to know what your page template is called

    see

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

    item 8 for some more details

    #184157
    thepageman
    Participant

    I am a newbie with WordPress and I have been using a custom menu widget placed at the top of all of my pages to keep a consistent header going. I am now trying to use bbPress and discovered I can create a page called “Forum” and use a page builder to place my menu widget above the forum shortcode widget to achieve the header.

    However, when I select a forum/topic, it goes to a different page, one that is generated by bbPress and as such, doesn’t have a page builder design of which I can place a header.

    It seems like the best solution would be to implement this header into all my pages through editing some php file somewhere but that is a bit beyond my technical ability. Is there a way to add widgets to ALL bbpress pages?

    #184135
    SRD75
    Participant

    Hi. I tried the following code, created a new user, logged in as that user, went to subscriptions, and the user was not subscribed to any forums.

    Was hoping the new user would be subscribed to the single forum that exists.

    Help appreciated.

    Regards,
    Steve

    add_filter( 'bbp_get_user_subscribe_link', 'invert_get_user_subscribe_link', 10, 4 ); //invert forum subscription
    add_filter( 'bbp_is_user_subscribed_to_forum', 'invert_is_user_subscribed_to_forum', 10, 4 ); //invert forum subscription
    add_filter( 'bbp_get_forum_subscribers', 'invert_get_forum_subscribers' ); //invert forum subscription
    add_filter( 'bbp_is_user_subscribed', 'invert_is_user_subscribed', 10, 4 ); //invert forum subscription
    
    function invert_is_user_subscribed($retval, $user_id, $object_id, $subscribed_ids) {
    	if (get_post_type( $object_id ) == bbp_get_forum_post_type())
    		return !$retval;
    	else	
    		return $retval;
    }
    
    function strContains($needle, $haystack) {
    	if (strpos($haystack, $needle) !== false) {
    		return true;
    	} else {
    		return false;
    	}
    }
    
    function invert_get_user_subscribe_link ($html, $r, $user_id, $topic_id) {
    	if (strContains( "bbp_unsubscribe", $html )) {
    		$html = str_replace("bbp_unsubscribe", "bbp_subscribe", $html);
    	} else {
    		$html = str_replace("bbp_subscribe", "bbp_unsubscribe", $html);
    	}
    	return $html;
    }
    
    function invert_get_forum_subscribers( $users ) {
    	$args = array('fields' => 'id');
    	$all_users = get_users($args);
    	$send_to_users    = array_diff($all_users, $users);
    	return $send_to_users;
    }
    
    function invert_is_user_subscribed_to_forum( $retval, $user_id, $forum_id, $subscribed_ids ) {
    	return !$retval;
    }
    #184134
    Chad R. Schulz
    Participant

    I understand why you might want to change the permalinks to “clean” your url. However, this helps distinguish forums from topics from replys. For example somesite.com/forums/forum/some-forum or somesite.com/forums/topic/some-topic.

    You can remove the “forums” part of the permalink in admin settings under forum and Forum Root Slug–Forum Prefix select off. And you can rename the slug for single forum/topic/reply under same menu and Single Forum Slugs. These built-in adjustments are usually harmless and can be changed as needed.

    There are also a few bbPress/WordPress permalink plugins that might help–but they could also make things worse.

    Above all, you want a clean url that both makes sense and remains functional. And I’ve found that messing around too much with permalink settings can often break more than fix.

    And regarding that “Private” issue: Does it display that when you’re not logged in? That’s a curious quirk.

    Chad

    #184133
    blasterspike
    Participant

    Hi Robin,
    thank you for your reply.
    I have tried with

    function tinymce_remove_root_block_tag( $init ) {
        $init['forced_root_block'] = false; 
        return $init;
    }
    add_filter( 'tiny_mce_before_init', 'tinymce_remove_root_block_tag' );
    
    function bbp_enable_visual_editor( $args = array() ) {
        $args['tinymce'] = true;
        $args['quicktags'] = false;
        return $args;
    }
    add_filter( 'bbp_before_get_the_content_parse_args', 'bbp_enable_visual_editor' );

    or with

    function tinymce_remove_root_block_tag( $init ) {
        $init['forced_root_block'] = false; 
        return $init;
    }
    add_filter( 'tiny_mce_before_init', 'tinymce_remove_root_block_tag' );
    
    function bbp_enable_visual_editor( $args = array() ) {
        $args['tinymce'] = true;
        $args['quicktags'] = false;
        $args['forced_root_block'] = false;
        return $args;
    }
    add_filter( 'bbp_before_get_the_content_parse_args', 'bbp_enable_visual_editor' );

    but I’m still getting a new paragraph for each new line.

    #184132
    Robin W
    Moderator

    not my field of expertise, but suggest you have the wp code,

    and try

    function bbp_enable_visual_editor( $args = array() ) {
        $args['tinymce'] = true;
        $args['quicktags'] = false;
        return $args;
    }
    add_filter( 'bbp_before_get_the_content_parse_args', 'bbp_enable_visual_editor' );

    this just does the ‘turn on’ earlier

    may work, may not !!

    #184126
    blasterspike
    Participant

    Hi,
    I have followed this documentation page

    Enable Visual Editor


    to enable TinyMCE. Now I would like to change the default behavior of TinyMCE to not add a paragraph for each new line but use instead <br>.
    For WordPress I have to use this

    function tinymce_remove_root_block_tag( $init ) {
        $init['forced_root_block'] = false; 
        return $init;
    }
    add_filter( 'tiny_mce_before_init', 'tinymce_remove_root_block_tag' );

    But the TinyMCE in bbPress doesn’t get this setting.
    I have tried to do something like

    function bbp_enable_visual_editor( $args = array() ) {
        $args['tinymce'] = true;
        $args['quicktags'] = false;
        $args['forced_root_block'] = false;
        return $args;
    }
    add_filter( 'bbp_after_get_the_content_parse_args', 'bbp_enable_visual_editor' );

    but it doesn’t work.
    How can I pass that “forced_root_block” to the TinyMCE enabled for bbPress?

    Thanks

    Massimo

    #184125
    Young Prodigy
    Participant

    Hi there,

    I have enabled forums on my site, but it seems like my forum URL is here:
    http://www.satdecoded.com/forums/forum/support-clinic/

    It’s set to private, so you may not be able to see it, but I’ve taken screenshots below.

    The Forum Root (which is being used as a prefix slug for all forum related content) is “forums.” I’ve checked yes to the show prefix option.

    Then in the single forum settings, I see that the it shows “forum” (singular, not “forums”).
    Here is a screenshot of my settings: http://prntscr.com/f7m2ca

    The forum I created is called “Support Clinic.” It shows up at a URL that says “/forums/forum/ support-clinic/” Here’s a screenshot of my URL: http://ibb.co/iKJrvk

    How can I get rid of the “forum” in the middle? I just want it to say “/forums/support-clinic/”

    I’ve also set my forum to “Private” (I was logged in as admin when I took the screenshot), so now that gets doubled too: “Private: Private: Support Clinic”

    I only want it to say “Private” once. How can I do that?

    Thank you!

    #184070
    rgilman
    Participant

    Thanks, Robin, that’s helpful.

    In my case I wanted to remove that title and was able to do so with

    #bbpress-forums > h3 {
        display: none;
    }

    But that feels like a workaround and it was a long hunt to find this bit of the UI in what I would think of as core code. I’ll make my suggestion in the trac.

    #184066
    Robin W
    Moderator

    and if you want to suggest code changes, then this is the place

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

    #184065
    Robin W
    Moderator

    I am just a humble user, so can’t comment on changing core code, but is it is styling capability you want you could filter the actual title eg

    add_filter( 'bbp_get_forum_title', 'rew_title');
    
    function rew_title () {
    
    $title = '<span class="rew">.$title.'</span>' ;
    
    return $title ;
    
    }
    rgilman
    Participant

    This is both feedback and a request.

    I’m working on simplifying the UI of a Commmons In A Box site, which means I’m working with both BuddyPress and bbPress. While working on the group/forum page, I found that the forum title is hard coded as a simple h3 with no selectors into wp-content/plugins/bbpress/includes/extend/buddypress/groups.php at line 767. This is just before the content-single-forum template call.

    My request is that the forum title be moved from groups.php and into content-single-forum.php where it can be customized through the normal child theme process. Let me know if there is a better place than here to file this as an issue.

    Thanks!

    #184057
    pre55
    Participant

    Hi,

    Just wanted to share a newly released plugin available called bbPress User Ranks and it allows you to create user ranks, star ranks, RPG ranks, user badges and month badges which display on forums and user profiles. It also has widgets and shortcodes.

    You can view all the features and screenshots here:

    http://pre55.com/downloads/bbpress-user-ranks/

    You see the free lite version here:

    https://wordpress.org/plugins/bbp-user-ranks-lite/

    The plugin was created as I had been using the brilliant bbp user ranks plugin created by Robin W and although this worked great for what I initially wanted I eventually needed something a little more custom.

    I have therefore built my plugin from scratch incorporating lots of great features I think will increase engagement for any bbPress forum.

    Let me know what you guys think, if you have any suggestions please let me know.

    #184056
    Robin W
    Moderator

    ok, closest without code would be :

    1. go into

    dashboard>settings>bbp style pack>breadcrumbs

    Leave Disable all forums breadcrumbs UNTICKED

    but tick disable on 1, 2, & 3

    then put this into

    dashboard>settings>bbp style pack>Custom css

    
    .bbp-breadcrumb-forum {
    
      border-radius: 28px;
      padding: 7px 15px;
      text-decoration: none;
      background: #3498db linear-gradient(to bottom, #3498db, #2980b9) repeat scroll 0 0
    
    }
    
    .bbp-breadcrumb-forum::before {
    
    content: "Back to ";
    
    }

    you may need to play with the background color to get it to suit your website – I’ve given you a blue gradient

    #184004
    Robin W
    Moderator

    seems like that will be fixed in bbpress 2.6

    so 3 fixes

    1. downgrade to a lesser version of php
    2. upgrade to bbpress 2.6beta-2
    3. in bbpress 2.5.12 change line 1851 from

    $meta_query   = $posts_query->get( 'meta_query' );
    

    to

    $meta_query = $posts_query->get( 'meta_query', array() );

    Since the next upgrade will fix that anyway, no issue in changing the bbpress file

    best I can offer I’m afraid

    #183983
    virusek89
    Participant

    I also need something like that.
    Is there any plugin or code?

    Stephen Edgar
    Keymaster

    I was going to suggest renaming you’re plugins folder, you’ve done that already.

    Try renaming the directory of your theme, or the entire themes directory if that doesn’t work

    Strange, I tried hitting some URLs direct, e.g.

    http://restomod101.com/test/wp-admin/edit.php?post_type=page
    http://restomod101.com/test/wp-login.php

    I’d also suggest taking a look at any custom functions you have in a functions.php file

    What about rewrite rules, have you any custom rules in your .htaccess file?

    #183905
    dominikb
    Participant

    I realized, that i used another code mentioned in this forum, to change the original names of the roles, so i deleted this code and afterwards it just worked.

    #183904
    dominikb
    Participant

    I put the code into a custom plugin.

    #183898
    realnsleo
    Participant

    Hi Robin,
    I have just tried your code with BBPress 2.5.12 and I can not see the “trash” links. I hope it’s not a lot to ask, but could you know why it might be broken?

    From what I could test, it has something to do with the lines where the capabilities are given, for example this line:

    //allow any reply to be deleted
    if ($post_type == bbp_get_reply_post_type()) $caps = array('delete_replies');

    I appreciate any response.

    Regards,

    #183896
    xelota
    Participant

    Wordpress : WordPress 4.7.4 avec le thème BlackFyre.
    bbpress : Version 2.5.12
    http://www.vieuxetmechants.com/

    Hello i’ve created custom and i don’t understand the role MembreVetM can’t edit or delete their own post

    function add_new_roles( $bbp_roles )
    {
        $bbp_roles['bbp_gamer'] = array(
            'name' => 'Gamer',
             'capabilities' => custom_capabilities( 'bbp_gamer' )
            );
     
    	$bbp_roles['bbp_membrevetm'] = array(
            'name' => 'MembreVetM',
             'capabilities' => custom_capabilities( 'bbp_membrevetm' )
            );
    		
        $bbp_roles['bbp_veteran'] = array(
            'name' => 'Vétéran',
            'capabilities' => bbp_get_caps_for_role( bbp_get_moderator_role() )
            );
    	
    	$bbp_roles['bbp_officier'] = array(
            'name' => 'Officier',
            'capabilities' => bbp_get_caps_for_role( bbp_get_keymaster_role() )
            );
    	
        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_gamer' )
            $caps = custom_capabilities( $role );
     
        if( $role == 'bbp_membrevetm' )
            $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 )
        {
     
            case 'bbp_gamer':
                return array(
                    // Primary caps
                    'spectate'              => true,
                    'participate'           => true,
                    'moderate'              => false,
                    'throttle'              => false,
                    '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'   => false,
                    'read_hidden_forums'    => false,
     
                    // Topic caps
                    'publish_topics'        => true,
                    'edit_topics'           => true,
                    'edit_others_topics'    => false,
                    'delete_topics'         => false,
                    'delete_others_topics'  => false,
                    'read_private_topics'   => false,
     
                    // Reply caps
                    'publish_replies'       => true,
                    'edit_replies'          => true,
                    'edit_others_replies'   => false,
                    'delete_replies'        => false,
                    'delete_others_replies' => false,
                    'read_private_replies'  => false,
     
                    // Topic tag caps
                    'manage_topic_tags'     => false,
                    'edit_topic_tags'       => false,
                    'delete_topic_tags'     => false,
                    'assign_topic_tags'     => false,
                );
     
    			case 'bbp_membrevetm':
                return array(
                    // Primary caps
                    'spectate'              => true,
                    'participate'           => true,
                    'moderate'              => false,
                    'throttle'              => false,
                    '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'       => false,
                    'delete_topic_tags'     => true,
                    'assign_topic_tags'     => true,
                );
     
                break;
     
            default :
                return $role;
        }
    }
    #183889
    negi15
    Participant

    where did you put that code?

    #183888
    blengine
    Participant

    Another solution for those interested. This makes use of the “Shortcodes in Menus” plugin to easily place the bbpress “View Profile” and “Edit Profile” links in your WordPress nav menus. Instructions:

    1 – Install the free plugin “Shortcodes in Menus”
    2 – Place the following code in your theme’s functions.php file:

    function menu_profile_link() { 
    		$current_user = wp_get_current_user();
    		$profile_menu_item = '<li><a href="' . home_url('forums/users/') . $current_user->user_nicename . '">View Profile</a></li>';
    		return $profile_menu_item;
    }
    add_shortcode('bbp-profile', 'menu_profile_link');
    
    function menu_edit_profile_link() { 
    		$current_user = wp_get_current_user();
    		$profile_menu_item = '<li><a href="' . home_url('forums/users/') . $current_user->user_nicename . '/edit">Edit Profile</a></li>';
    		return $profile_menu_item;
    }
    add_shortcode('bbp-edit-profile', 'menu_edit_profile_link');

    3 – In WordPress go to your Menus and go to the new Shortcodes panel. Type in “View Profile” as the title and underneath that type in [bbp-profile] to place the profile link in your menu. Click “Add to Menu”. Repeat this process using the shortcode [bbp-edit-profile] to add the “Edit Profile” link.

    4 – I’d also recommend the free plug-in “Nav Menu Roles” to restrict your menu items to logged in or logged out users.

    Hope this is useful!

    #183886
    Alex Stine
    Participant

    Hello,

    I’m using a plugin to integrate Amazon CloudSearch on my site. Whenever I exclude private topics from search results or private forums from search results, I might use some code like this.

    function exclude_private_topics_search() {
    	$topic_id = bbp_get_topic_id();
    	if(gdbbx_is_topic_private($topic_id) ) {
    		add_post_meta($topic_id, 'acs_exclude', 1, true );
    	} else {
    		delete_post_meta($topic_id, 'acs_exclude');
    	}
    }
    add_action('bbp_new_topic', 'exclude_private_topics_search' );
    add_action('bbp_edit_topic', 'exclude_private_topics_search' );
    
    function exclude_private_forums_search() {
    	$forum_id = bbp_get_forum_id();
    	if (get_post_status($forum_id) == 'private') {
    		add_post_meta($forum_id, 'acs_exclude', 1, true );
    	} else {
    		delete_post_meta($forum_id, 'acs_exclude');
    	}
    }
    add_action('bbp_new_forum', 'exclude_private_forums_search' );
    add_action('bbp_edit_forum', 'exclude_private_forums_search' );

    The problem is this does not update pagination counts. For example if 2 topics that are private are hidden and there are 5 topics in the forum, it will still display a total of 5 topics instead of 3 topics. How can I update the pagination values if there are less topics displaying AKA private ones?

    Thanks.

    #183885
    Alex Stine
    Participant

    Hello,

    I have a plugin that is used to index search results in to Amazon CloudSearch. I’ve written the below code to exclude private forums from search results. Now I need some code to automatically exclude all topics inside a private forum.

    function exclude_private_forums_search() {
    	$forum_id = bbp_get_forum_id();
    	if (get_post_status($forum_id) == 'private') {
    		add_post_meta($forum_id, 'acs_exclude', 1, true );
    	} else {
    		delete_post_meta($forum_id, 'acs_exclude');
    	}
    }
    add_action('bbp_new_forum', 'exclude_private_forums_search' );
    add_action('bbp_edit_forum', 'exclude_private_forums_search' );

    Is there anyway I can get a list of topic IDs inside a forum ID?

    Running latest version of bbPress and WordPress.

    Thanks.

Viewing 25 results - 5,201 through 5,225 (of 32,505 total)
Skip to toolbar