Robin W (@robin-w)

Forum Replies Created

Viewing 25 replies - 2,126 through 2,150 (of 14,246 total)
  • @robin-w

    Moderator
    add_filter ('bbp_get_topic_class', 'rew_author_current' , 100 , 3) ;
    add_filter ('bbp_get_reply_class', 'rew_author_current' , 100 , 3) ;
    
    function rew_author_current ($post_classes, $topic_id, $classes) {
    	$author_id = bbp_get_topic_author_id( $topic_id );
    	$current_id = get_current_user_id() ;
    	if ($author_id == $current_id) {
    		$post_classes[] = 'rew-current-user' ;
    		$post_classes = array_merge( (array) $post_classes);
    	}
    return $post_classes ;
    }

    will give you ‘rew-current-user’ as a style to add css

    Put this in your child theme’s function file –

    ie wp-content/themes/%your-theme-name%/functions.php

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

    or use

    Code Snippets

    In reply to: Remove Separator

    @robin-w

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

      is the code for space, so if you want 2 spaces put

    $args['before'] = '  ' ;

    @robin-w

    Moderator

    ok, let’s just redo the whole thing

    function custom_callback( $args=array()) {
    
            // Parse arguments against default values
            $r = bbp_parse_args( $args, array(
                'select_id'    => 'bbp_topic_status',
                'select_class' => 'my-class',
                'tab'          => false,
                'topic_id'     => 0,
                'selected'     => false
            ), 'topic_open_close_select' );
    
            // Filter & return
            return apply_filters( 'custom_callback', ob_get_clean(), $r, $args );
        }
    	
    
    add_filter( 'bbp_get_form_topic_status_dropdown', 'custom_callback');

    @robin-w

    Moderator

    the ‘,2’ might be the issue, as you only then use 1, but try this

    function custom_callback($args) {
        
            $args['select_class'] = 'my-class' ;
                
           return  $args;
    
    }
    add_filter( 'bbp_get_form_topic_status_dropdown', 'custom_callback');

    @robin-w

    Moderator

    ok, my code does not change any roles, the user will still get the participant role.

    The plugin makes them a member of a group, and as the forum is also a member of that group, they can them see the forum. The forum’s topic permissions then let them see only their topic

    @robin-w

    Moderator

    so are you adding on first visit, or on every visit?

    @robin-w

    Moderator

    @robin-w

    Moderator

    if user creates topic, iit is already assigned them

    If you are creating topics, then you can amend the user in the topic backend

    dashboard>topics>edit topic and you will see the topic author as you and can change.

    @robin-w

    Moderator

    Private groups

    and look at the topic permissions settings, in particular

    Create/Edit/view OWN Topics,

    @robin-w

    Moderator

    ‘Associated Courses and Groups’ has nothing to do with bbpress.

    I’d suspect it is either something in learndash, or something you have called a page in WP where the shiortcode is held, or a name you have given to something.

    @robin-w

    Moderator

    🙂

    @robin-w

    Moderator

    bbpress will not use it, so I’d say the answer is yes you can delete it.

    But I’d suggest you export the table before deleting.

    @robin-w

    Moderator

    no, I need to see what is being downloaded to your browser.

    alternately :

    it could be a theme or plugin issue

    Themes

    As a test switch to a default theme such as twentytwenty, and see if this fixes.

    Plugins

    If that doesn’t work, also deactivate all plugins apart from bbpress and see if this fixes. if it does, re-enable one at a time to see which is causing the error.

    If you cannot do this to your site (say because it is live) then use the ‘troubleshooting’ features of this plugin to let you test without affecting other users

    Health Check & Troubleshooting

    Then come back

    @robin-w

    Moderator

    would need a link to a live example please

    @robin-w

    Moderator

    the only bbpress related settings are the ones I quoted above.

    on my test site

    dashboard>settings>forums>forum user slugs>topics started

    changes the topics list view.

    so if I amend this to ‘dicsussions’ then domain.com/discussions/ works.

    @robin-w

    Moderator

    buddyboss is a paid plugin that ties to the free open source bbpress and buddypress plugins. As such I can’t help further, suggest you contact their support.

    @robin-w

    Moderator

    thanks – I’ll take a look 🙂

    @robin-w

    Moderator

    should be

    dashboard>settings>forums>forum single slugs>topic

    or

    dashboard>settings>forums>forum user slugs>topics started

    @robin-w

    Moderator

    I presume you have ‘anyone can register’ ticked in :

    dashboard>settings>general>membership – that will let anyone join, and at that stage you cannot know if they are real or not, so no automatic way to prevent.

    I’d suggest you move to a closed registration, so that you can manually join people.

    as for getting rid of those in there – you would need some code which would look for all users who have not made a forum post, but this might delete genuine users, so without a forumla to work out who is real or not, it would be hard to code/

    @robin-w

    Moderator

    🙂

    @robin-w

    Moderator

    you could add this to change the wording

    function change_translate_text( $translated_text ) {
    	if ( $translated_text == 'You cannot reply to this topic.' ) {
    	//set limit
    	$limit = 5 ;
    	//get replies for today
    	$user_id = get_current_user_id() ;
    	$reply=bbp_get_reply_post_type() ;
    	$today = getdate();
    	$args = array(
    		'post_type'=> $reply,
    		'order'    => 'ASC',
    		'orderby' => 'ID',
    		'post_status' => 'publish',
    		'posts_per_page' => -1,
    		'post_author' => $user_id,
    		'date_query' => array(
    		array(
    			'year'  => $today['year'],
    			'month' => $today['mon'],
    			'day'   => $today['mday'],
    		),
    		),
    		
    		);              
    
    	$the_query = new WP_Query( $args );
    	$count = $the_query->found_posts;
    	if ($count>=$limit) $translated_text = 'You have exceeded the number of replies you can post in a day' ;
    	}
    	return $translated_text;
    }
    add_filter( 'gettext', 'change_translate_text', 20 );

    @robin-w

    Moderator

    Just written this – should work

    add_filter ('bbp_current_user_can_access_create_reply_form' , 'rew_limit_replies') ;
    
    function rew_limit_replies ($retval) {
    	//set limit
    	$limit = 5 ;
    	//get replies for today
    	$user_id = get_current_user_id() ;
    	$reply=bbp_get_reply_post_type() ;
    	$today = getdate();
    	$args = array(
    		'post_type'=> $reply,
    		'order'    => 'ASC',
    		'orderby' => 'ID',
    		'post_status' => 'publish',
    		'posts_per_page' => -1,
    		'post_author' => $user_id,
    		'date_query' => array(
    		array(
    			'year'  => $today['year'],
    			'month' => $today['mon'],
    			'day'   => $today['mday'],
    		),
    		),
    		
    		);              
    
    	$the_query = new WP_Query( $args );
    	$count = $the_query->found_posts;
    	if ($count>=$limit) $retval = 0 ;
    return $retval ;
    }

    Just amend the line ‘$limit = 5 ;’ to whatever number you want

    Put this in your child theme’s function file –

    ie wp-content/themes/%your-theme-name%/functions.php

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

    or use

    Code Snippets

    @robin-w

    Moderator

    um, not sure this is the same problem.

    can you give a link to an example please

    In reply to: Forum has blank pages

    @robin-w

    Moderator

    great – glad you are fixed !!

    In reply to: Forum has blank pages

    @robin-w

    Moderator

    ok, if this is a block theme then come back, otherwise take a look at

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

    section 8 and look at this link which gives a template

    https://codex.bbpress.org/theme-compatibility/getting-started-in-modifying-the-main-bbpress-template/

Viewing 25 replies - 2,126 through 2,150 (of 14,246 total)