Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 3,651 through 3,675 (of 32,517 total)
  • Author
    Search Results
  • #201826
    danielleoverman
    Participant

    Solved, found this code snipped from a previous post https://bbpress.org/forums/topic/prevent-users-from-creating-topics-2/ which removed the topic form for everyone but admins and moderators.


    add_filter( 'bbp_current_user_can_access_create_topic_form' , 'rew_only_mods' , 10 , 1) ;
    function rew_only_mods ($retval) {
    // Users need to earn access
    $retval = false;
    //check if admin
    if ( bbp_is_user_keymaster() ) {
    $retval = true;
    }
    //check if moderator
    $role = bbp_get_user_role( get_current_user_id());
    if ($role == 'bbp_moderator') {
    $retval = true;
    }
    // Allow access to be filtered
    return (bool) apply_filters( 'rew_current_user_can_access_create_topic_form', (bool) $retval );
    }

    #201820
    Robin W
    Moderator

    add this to the custom css part of your theme settings

    #bbpress-forums div.bbp-reply-content a {
    	color: #12526f !important;
    }
    
    #bbpress-forums div.bbp-topic-content a {
    	color: #12526f !important;
    }

    Close and re-open your browser

    Please come back and confirm that this works

    #201819
    danielleoverman
    Participant

    I’d like to remove the capability for participants to create and edit topics. They should keep their reply capabilities.

    I’m using this code (along with attempting to use a couple different solutions which did not work), but I haven’t found anything that works. Can someone point me in the right direction? No plugins, i’m just looking for working code.


    add_filter( 'bbp_get_caps_for_role', 'ST_add_role_caps_filter', 10, 2 );

    function ST_add_role_caps_filter( $caps, $role ){
    if( $role == bbp_get_participant_role() ) {
    $caps ['publish_topics']= false ;
    }
    return $caps;
    }

    #201783
    Gomle
    Participant

    I know this is old. And you may never receive this message. But just in case…

    I read your post over at stack, and I saw it was closed for a stupid reason back then.
    The thing is – I am trying to do exactly what you are talking about.

    Everything looks almost good with the code you pasted on stackexchange, but of course the forum which contains subforums doesn’t work as it should..

    If you got this to work, and you still have the code. Can I please ask if you can post it here?
    I believe the only thing I need is the code for loop-forums.php.

    Thanks.

    Gomle
    Participant

    I can confirm this. If you read this and hope to find an answer – this will most likely cheer you up πŸ™‚

    I had just imported 175.000 posts.
    And was at the stage on reparing afterwards: Recalculate the position of each reply

    I changed the server setting to allow 512MB of processes. And time out to 800 seconds.
    I still received MANY server errors during the repair.
    I got no information at all from the script what was going on, and if it kept on going when I just reloaded the page, and pressed “REPAIR”-button everytime I got an error.

    After about 10 tries, it finally got through with a success message.
    Just to be sure, I ran the repair one more time, and it worked for about 30-40 seconds, and I got the same success message.

    All other repairs went smoothly.

    Good luck πŸ™‚

    austex
    Participant

    That they now are mainly doing other things is sad for us, but they have a perfect right to do as they wish, and should feel under no obligation to spend time supporting the code.

    Agree that they have the right to do as they wish, but they should at least publicly announce whether they are going to end bbPress development, or if it’s going to continue to languish for years at a time.

    I understand @johnjamesjacoby is a very busy guy, but we are constantly told to be wary of plugins that are old.

    More importantly, a lot of us have moved on to other software, rather than continue to beta-test bbPress 2.6 (which has been in some form of RC for over 3 years, and the latest RC came out in December of last year).

    I have a big project that I’m putting together for somebody (they want WordPress), and some kind of lightweight/small forums are planned for, and it’s frustrating that I’m having to look elsewhere for forum software, or rigging some kind of fancy comment system (trying to avoid Disqus and Facebook for obvious reasons).

    It’s odd, because bbPress could be a selling point for WordPress in their competition with other platforms. It’s also odd, because they have some very competent people working for them, but then they allow bbPress to kind of just drift along.

    #201725
    Robin W
    Moderator

    sorry, I only do live code, so don’t know what rc7 does

    #201709
    Robin W
    Moderator

    untested, and probably from a purist view not the most elegant solution, but this should work

    add_filter( 'bbp_current_user_can_access_create_topic_form' , 'rew_only_mods' , 10 , 1) ;
    
    function rew_only_mods ($retval) {
    	// Users need to earn access
    	$retval = false;
    	//check if admin
    	if ( bbp_is_user_keymaster() ) {
    		$retval = true;
    	}
    		//check if moderator
    	$role = bbp_get_user_role( get_current_user_id());
    	if ($role == 'bbp_moderator') {
    		$retval = true;
    	}
    // Allow access to be filtered
    	return (bool) apply_filters( 'rew_current_user_can_access_create_topic_form', (bool) $retval );
    }
    

    Also allows keymasters, but I presume you want that.

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

    Code Snippets

    #201703
    DL
    Participant

    So I just setup a whole new test site, installed buddypress and bbpress

    added the dizkusZK converter to the converters list

    Ran it against a copy of the database that contains a dizkus forum.

    got error:

    WordPress database error: [Specified key was too long; max key length is 1000 bytes]
    CREATE TABLE wp_bbp_converter_translator ( meta_id mediumint(8) unsigned not null auto_increment, value_type varchar(25) null, value_id bigint(20) unsigned not null default '0', meta_key varchar(255) null, meta_value varchar(255) null, PRIMARY KEY (meta_id), KEY value_id (value_id), KEY meta_join (meta_key(191), meta_value(191)) ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci;
    
    No data to cleanStarting Conversion
    #201681
    Robin W
    Moderator

    suspect that modern events calander has had an update.

    I agree that ‘adding extra server code without need’ is a good policy, but unless you get modern events calendar to understand the issue and then fix, then the answer is that you need the fix πŸ™‚

    I suspect they will simply say it is a bbpress issue, which in a way it is

    #201675
    asmedej
    Participant

    Robin, thanks for answer, and thanks for the fix, but adding extra server code without need is not always a good thing to do.

    Although, I think I found the problem plugin, and it seems that it is a Modern Events Calendar, so when i disabled it, everything was OK, BUT I don’t understand why all of a sudden there is conflict with bbpress, as I stated before everything was working fine.

    Maybe I should contact Mec calendar …

    #201658

    In reply to: Edit Pagination Range

    Robin W
    Moderator

    ok, the code I gave you was topics in a forum, not replies in a topic.

    try this instead

    add_filter( 'bbp_replies_pagination', 'rew_change_shown' ) ;
    
    function rew_change_shown ($args) {
    	$args['mid_size'] = 8 ;
    return $args ;
    }
    #201652
    John
    Participant

    I’ve been trying to turn off mentions using:

    add_filter( 'bbp_find_mentions', '__return_false' );

    and

    add_filter( 'bp_activity_do_mentions', '__return_false' );

    but it’s not working. Has this changed in v2.6?

    Running bbPress v2.6-rc-7 and buddypress 4.3.0

    I want to turn it off as it’s not required by the site, but mainly that it breaks URLs that happen to contain a username as described here.

    Any ideas on how I can turn off @mentions?

    #201645

    In reply to: Edit Pagination Range

    Robin W
    Moderator

    Right now, It display 1,2,3…722,723,724

    so is this EXACTLY what it displayed without the code ?

    #201642

    In reply to: Edit Pagination Range

    Robin W
    Moderator

    you want ‘snippets’ that is the php code bit

    #201637

    In reply to: Edit Pagination Range

    Robin W
    Moderator

    Additional CSS panel

    ah, this is not css, this is php code, it needs to go in the functions file of your child theme or the code snippets plugin. If it is the latter, that should also give you what then error is – I need to know what that say if it doesn’t work

    #201635

    In reply to: Edit Pagination Range

    armyadarkness
    Participant

    Yes, when I copy that code into the Additional CSS panel, all of those “Red X” appear “unexpected characters on line… ” etc.

    #201631

    In reply to: Edit Pagination Range

    armyadarkness
    Participant

    Thanks a lot Robin, unfortunately, the code didn’t work at all. I copied and pasted it exactly, and even tried that plugin. It just gives errors.

    #201619

    In reply to: Edit Pagination Range

    Robin W
    Moderator

    I can’t remember it ever being asked πŸ™‚

    However after a bit of digging, this will change it

    add_filter( 'bbp_topic_pagination', 'rew_change_shown' ) ;
    
    function rew_change_shown ($args) {
    	$args['mid_size'] = 8 ;
    return $args ;
    }

    8 shows ‘8 +previous and next’ – so 10 – amend the number to whatever you want

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

    Code Snippets

    #201618
    dustineli
    Participant

    looks to me like bbpress-functions.php is not loading the topic.js nor reply.js when using a shortcode to load a topic.

    I commented out this if and then the scripts load:

    /*if ( bbp_is_single_topic() ) {*/

    // Topic favorite/unsubscribe
    $scripts[‘bbpress-topic’] = array(
    ‘file’ => ‘js/topic.js’,
    ‘dependencies’ => array( ‘jquery’ )
    );

    // Hierarchical replies
    if ( bbp_thread_replies() ) {
    $scripts[‘bbpress-reply’] = array(
    ‘file’ => ‘js/reply.js’,
    ‘dependencies’ => array( ‘jquery’ )
    );
    }
    /*}*/

    so similar to the above post it appears that bbp_is_single_topic() is returning false for some reason. I tested this without any other plugins and also with the latest development version and the scripts still do not load unless I comment out that if. I suppose this means these scripts get loaded all the time but everything seems to still work

    mattbru
    Participant

    What is the secret to modifying/changing the query on the topic archive page? I want to list all topics on that page rather than have 16, and i do not want pagination. On normal wordpress post types this is easily done with pre_get_posts filter. But how is it done with bbpress?

    I have tried this:

    
    function bbp_change_topic_archive_query_args( $query = array() ) {
    	$query['order'] = 'asc';
    	$query['orderby'] = 'title';
    	$query['post_count'] = -1;
    	$query['posts_per_page'] = -1;
    	return $query;
    }
    add_filter('bbp_has_topics_query','bbp_change_topic_archive_query_args');

    and this: (but this requires a shortcode to work properly)

    function bbp_my_register_custom_views() {
    	bbp_register_view( 
    		'asc', __( 'A-Z' ), 
    		array(
    			'orderby' => 'title',
    			'order' => 'ASC',
    			'post_count' => '-1',
    			'posts_per_page' => '-1',
    			'hide_empty' => false,
    		), false );
    }
    add_action( 'bbp_register_views', 'bbp_my_register_custom_views' );

    What else can be done?
    This has to be possible.

    wp v5.2.2, bbp 2.5.14
    site is a pw protected site. I can give access privately if necessary.

    Thanks!

    #201586
    Robin W
    Moderator

    This is because in the bbpress plugin there is a template called content-search.php. Many themes also now have a template file called content-search.php. Since the bbPress templates don’t necessarily need to be in a bbPress folder, the bbPress plugin is choosing the template from your theme before the template that is actually in bbPress.

    To fix copy content-search.php from the bbPress plugin templates and place it in a child theme in a folder called bbpress.

    Functions files and child themes – explained !

    So create a directory on your child theme called ‘bbpress’
    ie wp-content/themes/%your-theme-name%/bbpress

    where %your-theme-name% is the name of your theme

    find
    wp-content/plugins/bbpress/templates/default/bbpress/content-search.php
    Make a copy of this file, and put in in the directory called bbpress that you created above, so you end up with
    wp-content/themes/%your-theme-name%/bbpress/content-search.php
    bbPress will now use this template instead of the original

    #201530
    #201512
    mjthehunter
    Participant

    Hi,

    Over the past few weeks I’ve been customizing bbress to my liking using the live css editor in wordpress.
    I tried moving it all to a stylesheet within my child theme in a folder called css.
    I’ve named the file bbpress.css.

    Everything was working fine in the wordpress editor, but after moving it to bbpress.css a lot of things no longer work.
    Even when I try !important, a lot of things still don’t to work.

    I should note that some of the code does work which is why this confuses me.
    Any suggestions?

    WordPress 5.2.2
    BBPress 2.5.14
    https://flippednormals.com/forums

    #201494
    andreasyeah
    Participant

    where can i paste this code? i have the same problem

Viewing 25 results - 3,651 through 3,675 (of 32,517 total)
Skip to toolbar