shpitzyl (@shpitzyl)

Forum Replies Created

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

  • shpitzyl
    Participant

    @shpitzyl

    Bump

    In reply to: PM button in posts

    shpitzyl
    Participant

    @shpitzyl

    @evildon, You’re right. not sure why I copied the code without that

    Here is the working code:

    function ntwb_bbp_bp_pm() {
        if(function_exists('bp_send_private_message_link') && is_user_logged_in() ) {
            global $bp;
            if ($bp->loggedin_user->id !== bbp_get_reply_author_id()){
              $user = get_userdata( bbp_get_reply_author_id()  ); 
    
              if ( !empty( $user->user_nicename ) ) {
                  $user_nicename = $user->user_nicename;
              }
              $compose = bp_loggedin_user_domain() . bp_get_messages_slug() . '/compose/?r=' . $user_nicename;
            
              ?>
              <div class="forum-pm"><a href="<?php echo $compose ?>" title="Private Message">Private Message</a></div>
              <?php
           }
        }
    }
    add_action( 'bbp_theme_after_reply_author_details', 'ntwb_bbp_bp_pm' );
    In reply to: PM button in posts

    shpitzyl
    Participant

    @shpitzyl

    Hey Stephen, I’ve modified your code. With your code, when clicking on the link, it redirects the user to the compose form with the “Send To” field empty. I wanted to fill this field for the user automatically, just the way it works in buddypress user page. So I came up with this code.

    function ntwb_bbp_bp_pm() {
        if(function_exists('bp_send_private_message_link') && is_user_logged_in() ) {
    
            $user = get_userdata( bbp_get_reply_author_id()  ); 
    
            if ( !empty( $user->user_nicename ) ) {
                $user_nicename = $user->user_nicename;
            }
            $compose = bp_loggedin_user_domain() . bp_get_messages_slug() . '/compose/?r=' . $user_nicename;
            
            ?>
            <a>" title="Private Message">Private Message</a>
            <?php
        }
    }
    add_action( 'bbp_theme_after_reply_author_details', 'ntwb_bbp_bp_pm' );

    I’m not a php programmer and I’m not sure that I did it the right way, but hey, it works.


    shpitzyl
    Participant

    @shpitzyl

    This post solved the problem for me:

    Forums index in the same layout as other bb software


    shpitzyl
    Participant

    @shpitzyl

    I made a mistake with the css file, you’re using buddypress right?

    If so, the file that you need is:

    plugins/buddypress/bp-tamplets/bp-legacy/css/buddypress.css

    Put it in:

    themes/[your child theme]/css

    And then add the css rule to the file.


    shpitzyl
    Participant

    @shpitzyl

    The script in the link is working, you probably haven’t closed it with php tags.

    Put this in bp-custom.php in the plugins folders

    <?php
    function bp_exclude_profile_tabs() {
    global $bp;
    
    $bp->bp_nav['forums'] = false;
    }
    add_action( 'bp_setup_nav', 'bp_exclude_profile_tabs', 999 );
    ?>
    

    If you prefer to do it with css, you need to copy bbpress.css from:
    plugins/bbpress/templates/default/css

    And put it in:
    themes/[your child theme folder]/css

    (if you don’t have a css folder in your child theme, create one)
    Then put the css rule mentioned above somewhere in the file.


    shpitzyl
    Participant

    @shpitzyl

    Look at this blog post:
    http://themekraft.com/blog/customize-profile-and-group-menus-in-buddypress/

    I haven’t checked it, so if it doesn’t work, you can always use css.

    put this line in bbpress.css in your child theme:
    #forums-personal-li {display:none;}

    In reply to: PM button in posts

    shpitzyl
    Participant

    @shpitzyl

    Thanks.


    shpitzyl
    Participant

    @shpitzyl

    I’m struggling with this one for a couple of days. Your code solved my problem, Thanks.

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