Leave a comment

Remove New Topic Button For Subscribers

If your an admin using BuddyPress and bbpress and you only want
admins to create new topics then use the code below. Place it in
bp-custom.php if you do not want to display the “New Topic Button”
for subscribers. Admins only will see it.

function bphelp_hide_new_topic_button() {
if ( ! current_user_can( 'edit_others_topics' ) ) {
?>

a#new-topic-button {
display: none !important;
}

<?php
}
}
add_action ('bp_head', 'bphelp_hide_new_topic_button');

Advertisements
Leave a comment

BuddyPress Redirect To Profile Trick Using A Landing Page.

Add the below code to bp-custom.php to redirect to profile upon login.Follow the instructions  in comments below:


// PLEASE NOTE FOR THIS TO WORK:
// Before adding this code to bp-custom.php
// http://codex.buddypress.org/developer/customizing/bp-custom-php/
// you will need to create a new page in the dashboard and name it
// something like "Welcome" for example or any name you choose.
// This will be your landing page. Add content and media if you
// like and publish the page. Then go to Dashboard/Settings/Reading.
// Under "Front page displays" select "A static page." Then use the
// "Front page" dropdown menu to select your page. In my example for
// instance I selected "Welcome" for my front page. Done! Now logged
// out visitors get your landing page, and logged in users get
// directed to their profile.

/* Redirects to profile upon login */
function bp_help_redirect_to_profile(){
global $bp;

if( is_user_logged_in() && bp_is_front_page() )
bp_core_redirect( get_option('home') . '/members/' . bp_core_get_username( bp_loggedin_user_id() ) . '/profile' );

}

add_action( 'get_header', 'bp_help_redirect_to_profile',1);