dominikb (@dominikb-1)

Forum Replies Created

Viewing 16 replies - 1 through 16 (of 16 total)
  • @dominikb-1

    Participant

    in form-reply.php i find this line:

    <input name="bbp_log_reply_edit" id="bbp_log_reply_edit" type="checkbox" value="1" <?php bbp_form_reply_log_edit(); ?> tabindex="<?php bbp_tab_index(); ?>" />

    it does not seem like, i can uncheck the box here.

    I have my subscription boxes auto-checked via:

    function pw_bbp_auto_checK_subscribe( $checked, $topic_subscribed  ) {
    
        if( $topic_subscribed == 0 )
            $topic_subscribed = true;
    
        return checked( $topic_subscribed, true, false );
    }

    is there maybe a way, to turn this around and use it on the log checkbox?

    @dominikb-1

    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.

    @dominikb-1

    Participant

    I put the code into a custom plugin.

    @dominikb-1

    Participant

    ok, resolved.
    It was a conflict with another code, that renames the roles.

    @dominikb-1

    Participant

    *push*

    @dominikb-1

    Participant

    now i added this to functions.php:

    
    //code to add forum-roles
    
    function add_new_roles( $bbp_roles )
    {
        /* Add a role called tutor */
        $bbp_roles['bbp_mentor'] = array(
            'name' => 'Mentor',
            'capabilities' => custom_capabilities( 'bbp_mentor' )
            );
    
        /* Add a role called pupil */
        $bbp_roles['bbp_kursteilnehmer'] = array(
            'name' => 'Kursteilnehmer',
            'capabilities' => custom_capabilities( 'bbp_kursteilnehmer' )
            );
    
        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_mentor' )
            $caps = custom_capabilities( $role );
    
        if( $role == 'bbp_kursteilnehmer' )
            $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 )
        {
    
            /* Capabilities for 'mentor' role */
            case 'bbp_mentor':
                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,
                );
    
                /* Capabilities for 'kursteilnehmer' role */
            case 'bbp_kursteilnehmer':
                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,
                );
    
                break;
    
            default :
                return $role;
        }
    }
    

    it still does not work.

    Any hints, whats wrong here?

    @dominikb-1

    Participant

    @robin-w
    I moved the code to the functions.php file now, still no reaction.


    @casiepa

    Yes, i followed the procedure for adding new names with existing capabilities, but they are not appearing.
    Is it possible, that you cant add an existing capability to multiple roles?

    @dominikb-1

    Participant

    Changing the name of existing roles through MU works.

    But how would you recommend to handle it?

    @dominikb-1

    Participant

    In a custom-functions-file in the mu-plugins folder.

    @dominikb-1

    Participant

    *push* an answer would be nice.

    @dominikb-1

    Participant

    Ok, ignore this, i struggled myself through it.

    @dominikb-1

    Participant

    Whats going on here? Why is it, that nobody reacts to the question?

    @dominikb-1

    Participant

    0 answers? Come on guys, please dont let me die here!

    Thanks
    Dominik

    @dominikb-1

    Participant

    The funcions i named in the OP are not integrated in the plugin, i just used the names, to describe exactly, what i am looking for.

    Is there someone, who can help me on this one?

    I would be realy grateful.

    @dominikb-1

    Participant

    What i am trying to do is, to add “Last reply from:” like its here in the Topic Info, i just want to include the avatar of the latest reply to it.

    @dominikb-1

    Participant

    Hello John,
    thank you for your kind reply.

    My goal is to show the name (including link to user page) and the avatar of the user, who wrote the last reply in an infobox on top of the topic.

    If you want to have a look at it: https://bewusstewelt.de/topic/test-2/.
    Its still in progress at the moment. In the right box i want to include the information about the last reply.

    Looking at it, i just remember, that i still ned to find out, how to get the view count for the 2nd box done.
    If you have some wisdom to share on this one also i would be very thankful.

Viewing 16 replies - 1 through 16 (of 16 total)