Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 1,551 through 1,575 (of 32,435 total)
  • Author
    Search Results
  • #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.

    Mike Witt
    Participant

    @robin-w,

    … and anyone who happens to look at this and is running MemberPress.

    Yes, there is more to do with MP. MP Members may or may not have actual “Subscriptions.” They can also just have memberships without what MP calls subscriptions. These membership can go “inactive.” But, unfortunately, that can happen *temporarily* if their credit card needs to be updated.

    None-the-less, your code examples are quite valuable!

    In the unlikely event that anyone else here is running MP and is interested in this, please chime in here (or otherwise contact me). I would love to compare notes on this and related things.

    -Mike

    sino27
    Participant

    Thanks for your input but don’t waste time. I contacted some developers and they were able to provide me the code. It worked and I moved on to another project, I don’t even remember it. Anyway it was possible.

    All the best to you and stay healthy.

    Cheers

    bjornwebdesign
    Participant

    Well, as you can see, the code posted here is almost 5 years old. So it’s understandable it doesn’t work anymore ;-). Also, I don’t think a 404 means it’s a “serious privacy issue”. Something isn’t working correctly, so my first step would be to check the logs and see what is causing the 404 and go from there.

    Very busy atm and currently don’t have a BP test setup running. If you still need a solution maybe I can find some time in the coming days.

    bobdobbs
    Participant

    After installing bbpress I have a set of forums.

    Every forum is presented using a php template in my child theme.
    The php template has the filename bbpress.php.

    I’d like to create a php template that applies *just* to the individual forum pages. Not the forum topics or singles. Or anything else.

    I’ve been looking at this:

    Template hierarchy in detail

    The heirarchy seems to suggest that you can use ‘single-[forum].php’, which suggests that ‘[forum]’ needs to be substituted with the name of the forum.

    … which is great. But I want one template to be applied to all forum singles and nothing else.

    Just to test, I copied my existing bbress.php to a file called ‘single-forum.php’.
    bbpress did pick this up and use it for my forum singles.
    But the page didn’t present the actual forum. Where the forum should have been, there was just empty space.

    So… how do I create a template that gets applied to all forums and nothing else?

    #221109
    bobdobbs
    Participant

    I’ve set up a set of discussion forums on a site. Now I want to the purpose of each forum to be clear.

    One forum is called ‘Introductions’.
    I’d like to have a message on the page saying something like “Hi. This is where we get to know each other”.

    I guess I could hack up something with ACF and put some logic in the page template that shows the forums. But I’m wondering if there’s a faster option.

    Is there an inbuilt way to make add non-hardcoded content to the forum pages?

Viewing 25 results - 1,551 through 1,575 (of 32,435 total)
Skip to toolbar