Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 1,601 through 1,625 (of 32,481 total)
  • Author
    Search Results
  • #221661
    Marco
    Participant

    Hi Robin,

    thank you very much for the code snippet! I add this to the functions.php of the child theme and it works.

    Yesterday I detect an other strange behavior. If I click on “reply” in the frontend on the first post of a topic, the page also reloads and the reply will not be nested under the replied post. Clicking twice set a relation to the replied post and set it as a nested post.

    Do you have an idea how I can solve this?

    Kind regards
    Marco

    #221626
    Robin W
    Moderator

    I’ve just taken a look at the front end restore.

    The bbpress restore function calls a wordpress function wp_untrash_post which sets the restored status to ‘draft’.

    I’m pretty sure that it didn’t used to do that, so am presuming it’s a wordpress change.

    However if you are using

    bbp style pack

    then I’ve added a fix for this to the ‘bbpress bug fixes’ tab.

    If you want code, then 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

    add_filter ('wp_untrash_post_status', 'rew_correct_untrash_status' , 10, 3) ;
    
    function rew_correct_untrash_status ($new_status, $post_id, $previous_status) {
    	$post_check = get_post( $post_id );
    	//update_post_meta ($post_id , 'rew_type', $post_check->post_type) ;
    	//if it's a reply or topic, then change status back to $previous_status
    	if ($post_check->post_type == bbp_get_reply_post_type() || $post_check->post_type == bbp_get_topic_post_type()) {
    		$new_status = $previous_status ;
    	}
    return $new_status ;
    }
    #221590
    pandex
    Participant

    @ robin-w I saw here that the problem is the Youzify plugin, when I disable it, it works! But the problem is that I need Youzify to run my social network! Is there anything I can do? Delete or include some PHP code?

    #221585
    tijana1234
    Participant

    Hey,

    I hope someone could help me. I used this code from @michent and it works prefectly, except one thing:

    When username is just like: tijana, then it works prefectly.

    But when username has dot, like tijana.medan, then it does’t work, becuase the link than is:
    http://Www.site.com/forums/users/tijana.medan
    and the right link is:
    http://Www.site.com/forums/users/tijana-medan

    Could someone help me, what should I add or change in code so I can reslove this? It means a lot, because all my users have username with dots aka name.lastname

    Thank you!!

    #221583
    Robin W
    Moderator

    The code is in my style pack.

    bbp style pack

    once activated go to

    dashboard>settings>bbp style pack>Topic/Reply Form

    and tick option 18.

    If this does not work, then it may be a theme or other plugin affecting

    #221551
    techinbermudas
    Participant

    Hello.

    So i’m developing a tech website but for some reason i can’t make the created forum roles to appear on users.

    Roles Created:
    Member – Participant rules but can’t create topics, only reply to existent ones.
    GCam Dev – with same permissions as Member but can create threads.
    ROM Dev – with same permissions as Member but can create threads.
    Kernel Dev – with same permissions as Member but can create threads.
    Modder – with same permissions as Member but can create threads.

    I’ve been searching and used this code below for it:

    //code to add tutor role 
     
    function add_new_roles( $bbp_roles )
    {
        $bbp_roles['bbp_gcamdev'] = array(
            'name' => 'GCam Developer',
            'capabilities' => custom_capabilities( 'bbp_gcamdev' )
            );
         $bbp_roles['bbp_romdev'] = array(
            'name' => 'ROM Developer',
            'capabilities' => custom_capabilities( 'bbp_romdev' )
            );
        $bbp_roles['bbp_kerneldev'] = array(
            'name' => 'Kernel Developer',
            'capabilities' => custom_capabilities( 'bbp_kerneldev' )
            );
        $bbp_roles['bbp_modder'] = array(
            'name' => 'Modder',
            'capabilities' => custom_capabilities( 'bbp_modder' )
            );
        $bbp_roles['bbp_member'] = array(
            'name' => 'Member',
            'capabilities' => custom_capabilities( 'bbp_member' )
            );
     
        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_gcamdev' )
            $caps = custom_capabilities( $role );
     
        if( $role == 'bbp_romdev' )
            $caps = custom_capabilities( $role );
     
        if( $role == 'bbp_kerneldev' )
            $caps = custom_capabilities( $role );
    
        if( $role == 'bbp_modder' )
            $caps = custom_capabilities( $role );
    
        if( $role == 'bbp_member' )
            $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_gcamdev':
                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'         => false,
                    'delete_others_topics'  => false,
                    'read_private_topics'   => true,
     
                    // Reply caps
                    'publish_replies'       => true,
                    'edit_replies'          => true,
                    'edit_others_replies'   => false,
                    'delete_replies'        => false,
                    'delete_others_replies' => false,
                    'read_private_replies'  => true,
     
                    // Topic tag caps
                    'manage_topic_tags'     => false,
                    'edit_topic_tags'       => false,
                    'delete_topic_tags'     => false,
                    'assign_topic_tags'     => true,
                );
    
            case 'bbp_romdev':
                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'         => false,
                    'delete_others_topics'  => false,
                    'read_private_topics'   => true,
     
                    // Reply caps
                    'publish_replies'       => true,
                    'edit_replies'          => true,
                    'edit_others_replies'   => false,
                    'delete_replies'        => false,
                    'delete_others_replies' => false,
                    'read_private_replies'  => true,
     
                    // Topic tag caps
                    'manage_topic_tags'     => false,
                    'edit_topic_tags'       => false,
                    'delete_topic_tags'     => false,
                    'assign_topic_tags'     => true,
                );
    
            case 'bbp_kerneldev':
                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'         => false,
                    'delete_others_topics'  => false,
                    'read_private_topics'   => true,
     
                    // Reply caps
                    'publish_replies'       => true,
                    'edit_replies'          => true,
                    'edit_others_replies'   => false,
                    'delete_replies'        => false,
                    'delete_others_replies' => false,
                    'read_private_replies'  => true,
     
                    // Topic tag caps
                    'manage_topic_tags'     => false,
                    'edit_topic_tags'       => false,
                    'delete_topic_tags'     => false,
                    'assign_topic_tags'     => true,
                );
    
            case 'bbp_modder':
                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'         => false,
                    'delete_others_topics'  => false,
                    'read_private_topics'   => true,
     
                    // Reply caps
                    'publish_replies'       => true,
                    'edit_replies'          => true,
                    'edit_others_replies'   => false,
                    'delete_replies'        => false,
                    'delete_others_replies' => false,
                    'read_private_replies'  => true,
     
                    // Topic tag caps
                    'manage_topic_tags'     => false,
                    'edit_topic_tags'       => false,
                    'delete_topic_tags'     => false,
                    'assign_topic_tags'     => true,
                );
     
    
            case 'bbp_member':
                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'        => false,
                    'edit_topics'           => false,
                    'edit_others_topics'    => false,
                    'delete_topics'         => false,
                    'delete_others_topics'  => false,
                    'read_private_topics'   => true,
     
                    // Reply caps
                    'publish_replies'       => true,
                    'edit_replies'          => true,
                    'edit_others_replies'   => false,
                    'delete_replies'        => false,
                    'delete_others_replies' => false,
                    'read_private_replies'  => true,
     
                    // Topic tag caps
                    'manage_topic_tags'     => false,
                    'edit_topic_tags'       => false,
                    'delete_topic_tags'     => false,
                    'assign_topic_tags'     => true,
                );
     
                break;
     
            default :
                return $role;
        }
    }

    The Forum Roles appear on the Users menu but when i select it and Save Changes the role is removed. Am i missing anything?

    Robin W
    Moderator

    I suspect those functions are bbpress version 1

    bbpress 2.x just uses wordpress login, so the standard wordpress function

    is_user_logged_in()

    will tell you if the user is logged in.

    Robin W
    Moderator

    hmm… I would suspect that it is not file related, but rather plugin, theme, role or database.

    I have gone through all the PHP files on the backend,

    That would be several hundred, and given plugins, probably thousands to look through the code of and understand, and would take weeks if not months 🙂

    I would ask what you have looked at, but as I say I suspect that files as such are not the issue

    participants are in the database.

    Without any idea of what you changed to get to this point, it is impossible to advise what to do other than the above.

    Unless you have been changing files, then looking at them is probably pointless.

    Did you do the actions I suggested ?

    Robin W
    Moderator

    I’ve just looked and then code in my style pack is not doing what I would expect – let me look at it again this week

    pandex
    Participant

    Do you know any PHP code I can do this in?

    #221463

    In reply to: bbPress + Elementor

    richietsai
    Participant

    Hi @robin-w,

    I just installed your plugin, but the child page still not works.
    I build a single page template, put the shortcode in the section(boxed), and set the condition as Any child of > my forum page.
    Anything missing?

    #221375
    andreiandronachi95
    Participant

    Hello everyone! I’m working on a online store made with Magento, but it also have a forum created with bbPress and I have to make a modification but it’s the first time when I work with WordPress. After we enter in a discussion, we have the question, the answers and after Similar discussions, topics(topics that are in the same category with the question). Right now we are loading 10, but I need a button bellow and everytime when you press it to load another 10. In content-single-topic.php I have this custom code, that give us the number of similar topics, on the homepage of te category we have 50 discussion on page:

    <?php
    $direct_parent = $post->post_parent;
    if (bbp_has_topics(
        array(
            'author' => 0,
            'show_stickies' => false,
            'order' => 'DESC',
            'post_parent' => $direct_parent,
            'post__not_in' => array($post->ID),
            'posts_per_page' => 10
        )
    ))
    
    bbp_get_template_part('bbpress/loop', 'topics');

    Can someone help me to add more topics on button click with ajax or something like this?

    #221368
    jason4locations
    Participant

    PinkishHue’s post at https://bbpress.org/forums/topic/how-to-get-a-feed-of-all-activity/ might be useful. It has links to shortcode like [display-posts author=”bill”].

    #221367
    jason4locations
    Participant

    I’m also interested in that type of shortcodes (and whether they exist), and if there are other ways to do it besides with shortcodes.

    If the shortcodes for it don’t exist, I’m a little curious about why they don’t exist, though why they don’t exist isn’t a burning question, to me. I couldn’t find anything like it at https://codex.bbpress.org/features/shortcodes/.

    Though, I already asked how to do it, not necessarily with shortcodes, at https://bbpress.org/forums/topic/links-to-what-was-started-created-by-logged-in-users/. I added the tag “alternatives” to let people know that there might be other ways to do it.

    Thanks for your work.

    #221354
    jason4locations
    Participant

    Do the topics at

    https://bbpress.org/forums/topic/user-activity-topics-started-or-replied-to/

    and

    https://bbpress.org/forums/topic/user-activity-topics-started/

    mean that it can only be done with (what is to me) a lot of code? I’ll learn the code if I have to, but right now I’m looking for something easier, even if it doesn’t give me a lot of control. I know I said I found plugins, but I’d trust what I found so much more if they were discussed in places like wpbeginner and this bbPress support forum. How can I tell if I should go with a plugin?

    Adding tags like “user activity”, “activity widget”, and “activity menu” might make this topic helpful for others, unless what I’m looking for is called something else that I don’t know the name of.

    Was it wrong to create this reply, if it is bumping?

    Thank you.

    #221283
    Robin W
    Moderator

    so how is it visible, as a menu item?
    and what method in item 3 of this are you using

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

    #221273
    sk80au
    Participant

    Hi,

    I’d like to modify the reply topic from paragraph <p> to heading <h1> or <h2>. I tried to modify few php files but couldn’t get it working. Also checked few codex content but couldn’t find anything relevant. Wondering if somone done this before or knows how to do it. Thanks.

    #221258
    jason4locations
    Participant

    If all I want to do is have links to the topics started (and replies created) by the user who is logged in, and I want something simpler than ProfileGrid and UsersWP, what words should I be using to search http://www.wpbeginner.com? Is there a better way to find which one to use?

    Do I even need another plugin to do that? Did I fail to see what I need when I was looking through the bbPress and Style Pack widgets, the bbp Style Pack tabs, and the bbPress shortcodes?

    #221232

    In reply to: is_bbpress not working

    Robin W
    Moderator

    there is an action hook on the forums index so

    add_action ('bbp_template_before_forums_index' , 'test_bbpress');

    shoul dwork

    #221224
    bobdobbs
    Participant

    I’m trying to detect requests for the bbpress forum index page.

    Initially I tried ‘bbp_is_forum_archive()’.
    This doesn’t return true from the forum archive page.

    I decided to test if any bbpress conditional tags were working, so I tested ‘is_bbpress’, because the function calls many (maybe all?) of the other conditionals.

    However, ‘is_bbress’ doesn’t return true either.

    However, on any page in my site, whether bbpress is on that page or not, this condition returns true:
    ‘if ( ! is_bbpress() )…’

    What could be happening here?

    This is my function and the hook I’m using:

    add_action('init', 'test_bbpress');
    function  test_bbpress() {
    
        if (  is_bbpress()  ) {
    	wp_die("got to the forums page") ;
        }

    }

    #221214
    Robin W
    Moderator

    so can you post the exact code you tried, and say where you put it

    #221208
    Robin W
    Moderator

    ok, try this

    add_filter ('bbp_get_time_since' , 'rew_time_since_translate' ) ;
    		
    	
    	function rew_time_since_translate ($output) {
    		$output = preg_replace('/years/', 'new word', $output);
    		$output = preg_replace('/year/', 'new word', $output);
    		$output = preg_replace('/days/', 'new word', $output);
    		$output = preg_replace('/day/', 'new word', $output);
    		
    		return $output ;
    	}

    so change ‘new word’ in each case for what you want to show

    you can add as many lines as you need, but always do the plural first so ‘years’ followed by ‘year’

    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

    #221203
    Barry
    Participant

    Is there a way to remove the widget and just have a page for folks to go to instead?

    A potentially quick and easy solution would be to create a page and embed the widget within it. To help with that, you might use this plugin or some other similar one:

    Widget Shortcode

    (I haven’t used it, and can’t vouch for it…and probably there are also block plugins that do much the same.)

    #221202
    Ole
    Participant

    Hi,

    I want to change generally all x days (years, whatever) ago to german like “vor x Tagen”.

    I Have found the code base in inludes/commeons/formatting.php.
    But I’m not so goog in develeoping.
    Can somebaody help me please?

    Kind regards,
    Ole

    jason4locations
    Participant

    The reason I asked Robin W. that question is because if the bbPress Login Widget has more than the following three options

    1. Title: Here you can set the title of the widget as it will be displayed in the sidebar.
    2. Register URI: Link to your custom signup page eg. A WordPress page using the [bbp-register] shortcode.
    3. Lost Password URI: Link to your lost-password page eg. A WordPress page using the [bbp-lost-pass] shortcode.

    then I might be missing out on too much to use a different Login Widget instead, and therefore I should try harder to figure out how to use the bbPress Login Widget, even though I’ve been struggling to figure out how to use it for a very long time.

Viewing 25 results - 1,601 through 1,625 (of 32,481 total)
Skip to toolbar