Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'custom activity page'

Viewing 25 results - 201 through 225 (of 831 total)
  • Author
    Search Results
  • #261851
    vidalpaulo
    Participant

    Hey guys. I’m building a social media focusing on educational matters but I’m having some problems (as I’m not a dev and have never tried to build anything so complex):

    1) How can I change labes like “following”, “followers”, “follow”, “friends”, etc. sitewide?

    2) How can I make the BuddyPress Login widget for non-logged users I’m using in redirect to a page other than wp-login? (And the same with the Activity widget for logged users)

    3) How can I customize the tabs on the Activity page? (I want to hide some options)

    Thank you very much!

    #261682
    sweeneytodd94
    Participant

    (Latest version of WP/BP; non-bundled custom theme, using child theme.)

    When adding a custom index & members-loop to /members/ in my child-theme, to make some adjustments to the members directory layout, individual profile pages break completely, I think defaulting to the pages.php but loaded without any content.

    childtheme/members/members-loop.php

    <?php 
    //global $members_template;
    //$reset_members_template = $members_template;
    
    do_action( 'bp_before_members_loop' ); ?>
    
    <?php if ( bp_has_members( bp_ajax_querystring( 'members' ) . '&per_page=21&type=alphabetical' ) ) : ?>
    
    	<div id="pag-top" class="pagination">
    		<div class="pag-count" id="member-dir-count-top"><?php bp_members_pagination_count(); ?></div>
    		<div class="pagination-links" id="member-dir-pag-top"><?php bp_members_pagination_links(); ?></div>
    	</div>
    
    	<?php do_action( 'bp_before_directory_members_list' ); ?>
    
    	<ul id="members-list" class="item-list" role="main">
    
    	<?php while ( bp_members() ) : bp_the_member(); ?>
    
    		<li>
    			<div class="item-avatar">
    				<a href="<?php bp_member_permalink(); ?>"><?php bp_member_avatar('type=full&width=80&height=80'); ?></a>
    			</div>
    			<div class="item">
    				<div class="item-title"><a href="<?php bp_member_permalink(); ?>"><?php bp_member_name(); ?></a></div>
    				<div class="item-meta"><span class="activity"><?php bp_member_last_active(); ?></span></div>
    				<?php do_action( 'bp_directory_members_item' ); ?>
    			</div>
    			<div class="action">
    				<?php do_action( 'bp_directory_members_actions' ); ?>
    			</div>
    			<div class="clear"></div>
    		</li>
    
    	<?php endwhile; ?>
    
    	</ul>
    
    	<?php do_action( 'bp_after_directory_members_list' ); ?>
    
    	<?php bp_member_hidden_fields(); ?>
    
    	<div id="pag-bottom" class="pagination">
    		<div class="pag-count" id="member-dir-count-bottom"><?php bp_members_pagination_count(); ?></div>
    		<div class="pagination-links" id="member-dir-pag-bottom"><?php bp_members_pagination_links(); ?></div>
    	</div>
    
    <?php else: ?>
    	<div id="message" class="info"><p><?php _e( "Sorry, no members were found.", 'buddypress' ); ?></p></div>
    <?php endif; 
    
    //$members_template = $reset_members_template;
    ?>
    
    <?php do_action( 'bp_after_members_loop' ); ?>

    childtheme/members/index.php

    <?php
    
    /**
     * BuddyPress - Members Directory
     *
     * @package BuddyPress
     * @subpackage bp-default - SSSMG
     */
    
    get_header( 'buddypress' ); ?>
    
    	<?php do_action( 'bp_before_directory_members_page' ); ?>
    
    <div class="container">
    <div class="row">
    <div id="primary" class="col-md-10">
    
    	<div id="content" role="main" class="<?php do_action( 'content_class' ); ?>">
    		<div class="padder">
    		<div class="buddypress">
    
    		<?php do_action( 'bp_before_directory_members' ); ?>
    		
    	<form action="" method="post" id="members-directory-form" class="dir-form">
    	
    	<?php do_action( 'bp_before_directory_members_content' ); ?>
    
    	<div id="members-dir-search" class="dir-search" role="search">
    		<?php bp_directory_members_search_form(); ?>
    	</div><!-- #members-dir-search -->
    
    	<?php do_action( 'bp_before_directory_members_tabs' ); ?>
    
    		<div class="item-list-tabs" role="navigation">
    			<ul>
    				<li class="selected" id="members-all"><a href="<?php bp_members_directory_permalink(); ?>"><?php printf( __( 'All Members %s', 'buddypress' ), '<span>' . bp_core_get_total_member_count() . '</span>' ); ?></a></li>
    
    				<?php if ( is_user_logged_in() && bp_is_active( 'friends' ) && bp_get_total_friend_count( bp_loggedin_user_id() ) ) : ?>
    					<li id="members-personal"><a href="<?php echo bp_loggedin_user_domain() . bp_get_friends_slug() . '/my-friends/'; ?>"><?php printf( __( 'My Friends %s', 'buddypress' ), '<span>' . bp_get_total_friend_count( bp_loggedin_user_id() ) . '</span>' ); ?></a></li>
    				<?php endif; ?>
    
    				<?php do_action( 'bp_members_directory_member_types' ); ?>
    
    			</ul>
    		</div><!-- .item-list-tabs -->
    
    		<div id="members-dir-list" class="members dir-list">
    			<?php //bp_get_template_part( 'members/members-loop' );
    				locate_template( array( 'members/members-loop.php' ), true );
    			?>
    		</div><!-- #members-dir-list -->
    
    		<?php do_action( 'bp_directory_members_content' ); ?>
    
    		<?php wp_nonce_field( 'directory_members', '_wpnonce-member-filter' ); ?>
    
    		<?php do_action( 'bp_after_directory_members_content' ); ?>
    
    	</form><!-- #members-directory-form -->
    
    	<?php do_action( 'bp_after_directory_members' ); ?>
    
    </div><!-- #buddypress -->
    </div><!-- .padder -->
    	</div><!-- #content -->
    
    </div><!-- primary -->
    <?php get_sidebar( 'buddypress' ); ?>
    </div><!-- row -->
    </div><!-- container -->
    
    	<?php do_action( 'bp_after_directory_members_page' ); ?>
    
    <?php get_footer( 'buddypress' ); ?>

    bp-custom.php

    <?php
    // bp-custom.php - BP hacks and mods will go here
    /**
     * Include bbPress 'topic' custom post type in WordPress' search results */
     
    function ntwb_bbp_topic_cpt_search( $topic_search ) {
    	$topic_search['exclude_from_search'] = false;
    	return $topic_search;
    }
    add_filter( 'bbp_register_topic_post_type', 'ntwb_bbp_topic_cpt_search' );
    
    /**
     * Include bbPress 'forum' custom post type in WordPress' search results */
    
    function ntwb_bbp_forum_cpt_search( $forum_search ) {
    	$forum_search['exclude_from_search'] = false;
    	return $forum_search;
    }
    add_filter( 'bbp_register_forum_post_type', 'ntwb_bbp_forum_cpt_search' );
    
    /**
     * Include bbPress 'reply' custom post type in WordPress' search results  */
    
    function ntwb_bbp_reply_cpt_search( $reply_search ) {
    	$reply_search['exclude_from_search'] = false;
    	return $reply_search;
    }
    add_filter( 'bbp_register_reply_post_type', 'ntwb_bbp_reply_cpt_search' );
    
    /**
     * Ensure that multiselect boxes have trailing brackets in their 'id' and 'name' attributes.
     *
     * These brackets are required for an array of values to be sent in the POST
     * request. Previously, bp_get_the_profile_field_input_name() contained the
     * necessary logic, but since BP 2.0 that logic has been moved into
     * BP_XProfile_Field_Type_Multiselectbox. Since bp-default does not use the
     * BP_XProfile_Field_Type classes to build its markup, it did not inherit
     * the brackets from their new location. Thus this workaround.
     */
    function bp_dtheme_add_brackets_to_multiselectbox_attributes( $name ) {
    	global $field;
    
    	if ( 'multiselectbox' === $field->type ) {
    		$name .= '[]';
    	}
    
    	return $name;
    }
    add_filter( 'bp_get_the_profile_field_input_name', 'bp_dtheme_add_brackets_to_multiselectbox_attributes' );
    
    // add the custom column headers to BP manage signups
    function philopress_modify_user_columns($column_headers) {
            $column_headers['extended'] = 'Extended';
            return $column_headers;
    }
    add_action('manage_users_page_bp-signups_columns','philopress_modify_user_columns');
    
    // dump all the pending user's meta data in the custom column
    function philopress_signup_custom_column( $str, $column_name, $signup_object ) {
    	if ( $column_name == 'extended' ) 
                 return print_r( $signup_object->meta, true );
            return $str;
    }
    add_filter( 'bp_members_signup_custom_column', 'philopress_signup_custom_column', 1, 3 );
    
    //* Redirect WordPress Logout to Home Page
    add_action('wp_logout',create_function('','wp_redirect(home_url());exit();'));
    
    //add @mentions to bbpress forum
    function custom_bbpress_maybe_load_mentions_scripts( $retval = false ) {
    	if ( function_exists( 'bbpress' ) && is_bbpress() ) {
    		$retval = true;
    	}
    	return $retval;
    }
    add_filter( 'bp_activity_maybe_load_mentions_scripts', 'custom_bbpress_maybe_load_mentions_scripts' );
    
    function bphelp_dpioml(){
    	$bphelp_my_profile_field_1='Profession';
    	$bphelp_my_profile_field_2='Primary Institution';
           if( is_user_logged_in() && bp_is_members_component() ) { ?>
            <div class="bph_xprofile_fields">
                              <?php if(bphelp_my_profile_field_1<>"") echo bp_member_profile_data( 'field='.$bphelp_my_profile_field_1 );  ?><br />
    						  <?php if(bphelp_my_profile_field_2<>"") echo bp_member_profile_data( 'field='.$bphelp_my_profile_field_2 );  ?><br />
                    </div><?php
           }
    }
    add_action('bp_directory_members_item', 'bphelp_dpioml');
    
    ?>

    I’ve tried all sorts of different combinations but whatever I do, the only way to get both the profile pages and the members directory to display is to remove the index and members-loop customizations. Then everything works fine, but without the adjustments to the members directory that I want (removing recent updates, for instance). Any pointers would be brilliant!

    #261369

    In reply to: Facebook plugin

    Venutius
    Moderator

    I’m not sure about integrating fb into the activity feed but you can display the FB page activity in a widget with Custom Facebook Feed, also there are a couple of Social Login plugins to allow FB users to log in to your site using their fb credentials.

    #261262
    wuteng
    Participant

    Hello!
    I have searched for such similar solution and tried to figure out how this would be possible, but could not come up with anything usefull.

    The point is:
    1. I have two CPT.
    2. Both look like profile page.
    3. I want on both of them the default activity form (extended with rtMedia and some geolocation).
    4. I want to be able to add with this form activities that will say i.e. “John posted a link in [cpt title].
    5. All activities posted to that CPT should be listed under it.

    What would be the best way to do this? I have thought about filtering activity by some custom variable – ok, I could do this in the activity loop BUT hot to assign the form and make it post/save the activity as an actual activity of given CPT?
    Something like comments but preserving activity abilities.

    I know it may be hard to do or even not possible but any feedback that could even partially help me accomplish this is great!

    Pea Lutz
    Participant

    I’m developing a plugin that adds a custom group home page (groups/single/front.php. The page will display the latest activity for each component that as active for the group. In the template, I’m checking with bp_is_active( {component} ).

    The problem is that some of the components return false even though they are active, a tab is displayed for them.

    Only xprofile, activity, docs and members return true.

    global $bp; returns

    
    ["loaded_components"]=>
     ["loaded_components"]=>
      array(8) {
        ["forums"]=>
        string(6) "forums"
        ["members"]=>
        string(7) "members"
        ["profile"]=>
        string(8) "xprofile"
        ["activity"]=>
        string(8) "activity"
        ["groups"]=>
        string(6) "groups"
        ["settings"]=>
        string(8) "settings"
        ["events"]=>
        string(4) "bpeo"
        ["docs"]=>
        string(7) "bp_docs"
      }
    
    
    
    ["active_components"]=>
      array(6) {
        ["xprofile"]=>
        string(1) "1"
        ["settings"]=>
        string(1) "1"
        ["activity"]=>
        string(1) "1"
        ["groups"]=>
        string(1) "1"
        ["members"]=>
        string(1) "1"
        ["bp_docs"]=>
        string(1) "1"
      }
    
    

    In the template:

    
    <?php if ( bp_is_active( 'xprofile' ) ) : ?>
        <div class="buddypress-module xprofile intro">Intro</div>
    <?php endif; ?>
    <?php if ( bp_is_active( 'activity' ) ) : ?>
        <div class="buddypress-module activity">Activity</div>
    <?php endif; ?>
    <?php if ( bp_is_active( 'forums' ) ) : ?>
        <div class="buddypress-module forums replies">Replies</div>
        <div class="buddypress-module forums topics">Topics</div>
    <?php endif; ?>
    <?php if ( bp_is_active( 'blogs' ) ) : ?>
        <div class="buddypress-module blogs">Blogs</div>
    <?php endif; ?>
    <?php if ( bp_is_active( 'events' ) ) : ?>
        <div class="buddypress-module events">Events</div>
    <?php endif; ?>
    <?php if ( bp_is_active( 'bp_docs' ) ) : ?>
        <div class="buddypress-module docs">Docs</div>
    <?php endif; ?>
    <?php if ( bp_is_active( 'members' ) ) : ?>
        <div class="buddypress-module members">Members</div>
    <?php endif; ?>`
    
    

    Confirmed with twentysixteen
    WordPress 4.6.1
    BuddyPress 2.7.2

    arnezami
    Participant

    Hi everyone!

    We are using on our website Buddypress and want to make more SEO frendly profile urlโ€™s

    example.com/{City}/{Instrument}/{Firstname-Lastname}
    example.com/{City}/{Style}/{Band-Or-Ensemble name}

    it posible with standart post types with hierarchical categories, but I didnโ€™t found posibility to add taxonomy to activity and groups.

    ust small clarification:

    I have urlโ€™s:
    example.com/members/{user}
    I want them to be more SEO friendly such as:
    example.com/{City}/{Instrument}/{Firstname-Lastname}
    example.com/{City}/{Style}/{Band-Or-Ensemble name}

    I have found the way, how to update urlโ€™s structure:
    in functions.php

    add_filter( 'bp_get_member_permalink', 'custom_bp_get_member_permalink' );
    
    function custom_bp_get_member_permalink(){
    	global $members_template;
    
    	$url = get_site_url();
    	$city = xprofile_get_field_data('City', $members_template->member->id);
    	$instrument = xprofile_get_field_data('Instrument', $members_template->member->id);
    	$full_name = $members_template->member->fullname;	
    	return $url.'/members/'.convert_to_url_ready($city).'/'.convert_to_url_ready($instrument).'/'.convert_to_url_ready($full_name);
    }

    but I need to rewrite urlโ€™s to get userโ€™s pages.
    Wating for any ideas. Thanks in advance.

    #260968
    danbp
    Participant

    @masoud1111,

    You’re talking about 2 different things: profile and groups. Let me explain you a little…

    On the buddy nav bar, navigation looks similar but doesn’t work the same way on profile and on group page. While profile navigation use nav and sub-nav, the group navigation use only sub-nav.

    Also, as documented on codex, define('BP_DEFAULT_COMPONENT', '...' ); is a constant related to a component, not a sub-nav tab. It let you define the default landing component, but not the one or other sub-nav tab. For example on profiles, the component Activity has 4 sub-nav attached to it: personnal, mentions, favorites, friends, groups

    To get one of them, you need to specify a new default tab, not another component. ๐Ÿ™‚

    Buddybar main nav items on profile page
    Activity Profile Friends Groups Forums (if you use group forums)

    Default tab is Activity/personnal. To change it for “Friends” you use the constant:
    define('BP_DEFAULT_COMPONENT', 'friends' );

    To change the default landing tab from (Component/sub-tab). For example Activity/personnal to Activity/mentions, you define a new nav default tab with a function like this one:

    function bpex_set_member_default_nav() {
     
        bp_core_new_nav_default (
            array(
                'parent_slug'       => buddypress()->activity->id,
    	   // other "activity" sub_nav slugs : personal favorites friends groups
                'subnav_slug'       => 'mentions',
                'screen_function'   => 'bp_activity_screen_mentions'
            )
        );
    }
    add_action( 'bp_setup_nav', 'bpex_set_member_default_nav', 20 );

    For groups, it’s a similar technique, but a different syntax. The following example is a bit sophisticated, as it let you change the landing tab differently for each defined group.
    Depending each group activity or target, you can choose a different default tab.
    In this example, the kill bill group has Forum as landing tab, while Leon’s group use the group member directory.

    function bpex_custom_group_default_tab( $default_tab ){
    	/**
    	 * class_exists() is recommanded to avoid problems during updates 
    	 * or when Groups Component is deactivated
    	 */
    	if ( class_exists( 'BP_Group_Extension' ) ) : 
    	
    	$group = groups_get_current_group();//get the current group
    	
    	if( empty( $group ) ) {
    	 return $default_tab;
    	}
    		switch($group->slug){
    			
    			case 'kill-bill': // group name (use slug format)
    			$default_tab='forum';
    			break;
    			
    			case 'leon':
    			$default_tab='members';
    			break;
    			
    			default:		
    			$default_tab='home';// the default landing tab
    			break;
    			
    		}
    	
    	return $default_tab;
    	
    	endif; // end if ( class_exists( 'BP_Group_Extension' ) )
    }
    add_filter('bp_groups_default_extension','bpex_custom_group_default_tab');

    All this tested and working with BP 2.7.2 / Twenty Sixteen

    #260962
    Masoud
    Participant

    hi @danbp
    and many thanks for your answer.

    i’ve read the docs already. but i read them again as you said.

    according to the docs, you can

    //Change the default tab opened when looking at a group (default is home):
    define( 'BP_GROUPS_DEFAULT_EXTENSION', 'members' );

    but i want to Change the default tab opened when looking at a Activity (default is Personal):

    so i put some codes (in bp-custom), to override :

    —-
    i’ve tried this (in bp-custom):
    <?php define( 'BP_ACTIVITY_DEFAULT_EXTENSION', 'mentions' ); ?>
    but i got 500 internal error.
    —-
    i’ve also tried this one (in bp-custom):

    <?php
     if ( !defined( 'BP_DEFAULT_COMPONENT' ) ) {
     if ( bp_is_active( 'activity' ) && isset( $bp->pages->activity ) )
     $bp->default_component = 'mentions' ;
    }
    ?>

    but i got error 500 internal again.
    —-
    and i’ve tried this one too (in bp-custom):

    function change_activity_default_tab()
    {
    global $bp;
    set[$bp->activity(current_action)]->mentions
    }
    

    and 500 internal error again.
    —-

    as i’ve read in the docs before, and i realized that it might be possible to change the Activity default extension too. (activity default tab is Personal (when you browse the prof , or click on switch from another tab to activity tab (when you click on activity tab) ) )

    so i came here for detail and get more help to solve it.

    i’d be grateful if you help me with this one too.

    thanks for your time and help.

    #260892
    Masoud
    Participant

    hi.
    i am using latest versions of both wordpress and buddypress.and working on a food website.
    in this website , i wanted to allow only authors to post activity updates .
    (because it will be much easier for users to track their favorite chef recipes in the activity page.)
    so i’ve hide the ” personal ” submenu of activity tab : Activity > Personal (where people can post updates)
    with the help of following code in bp-custom.php :

    function bpfr_hide_tabs() {
    global $bp;
    if ( bp_is_user() && ( !current_user_can(author) || !current_user_can(administrator) ) ) {		
     bp_core_remove_subnav_item($bp->activity->slug, 'just-me');	}
    }
    add_action( 'bp_setup_nav', 'bpfr_hide_tabs', 15 );

    but now when i go to my profile (as a subscriber)
    i will see a 404 page.
    i’ve searched a lot and i noticed that , now that i’ve removed the default activity stream tab , i have to point it to another tab. so when a user profile is loading (or if a user clicks on activity tab),
    instead of default activity> personal . it load activity > mentions / OR / favorites / OR / … (some other submenu than personal )

    so my question is:

    how can i change the default activity stream tab
    from
    Activity > Personal
    To
    Activity > Mentions – Or to – Activity > Favorites – …

    thanks a lot for any help.

    #260732
    MatrixMedia
    Participant

    sorry, I have not explained well, the second point, I Repeat:

    I also tried to customize the Post Types default โ€˜postโ€™, following this guide: https://codex.buddypress.org/plugindev/post-types-activities/

    this is my function:

    add_post_type_support( 'post', 'buddypress-activity' );
    function customize_page_tracking_args() {
        // Check if the Activity component is active before using it.
        if ( ! bp_is_active( 'activity' ) ) {
            return;
        }
        bp_activity_set_post_type_tracking_args( 'post', array(
            'component_id'             => buddypress()->blogs->id,
            'action_id'                => 'new_blog_post', // or 'new_post'
            'bp_activity_admin_filter' => __( 'Published a new post', 'emt-buddypress' ),
            'bp_activity_front_filter' => __( 'Posts', 'emt-buddypress' ),
            'contexts'                 => array( 'activity', 'member' ),
            'activity_comment'         => true,
            'bp_activity_new_post'     => __( '%1$s shared a new <a href="%2$s">post</a>', 'emt-textbuddypress' ),
            'bp_activity_new_post_ms'  => __( '%1$s sahred a new <a href="%2$s">post</a>, on the site %3$s', 'emt-textbuddypress' ),
            'position'                 => 100,
        ) );
    }
    add_action( 'bp_init', 'customize_page_tracking_args' );

    but when I publish a post on activity stream, is not displayed. If I remove the function or use a new custom_post_type, in this function, it works.

    MatrixMedia
    Participant

    Hello
    I would exclude automatically, some categories of the blog post, in the activity stream. It’s possible?

    I saw that the same problem was seen here: https://buddypress.org/support/topic/possible-to-exclude-post-categories-in-activity-stream-and-make-a-user-profile-private-like-with-pri/

    But applying the same function with the latest version of BuddyPress, it does not work. is possilibe?

    I also tried to customize the Post Types default ‘post’, following this guide: https://codex.buddypress.org/plugindev/post-types-activities/

    changing fields as well:

    add_post_type_support( 'post', 'buddypress-activity' );
    function customize_page_tracking_args() {
        // Check if the Activity component is active before using it.
        if ( ! bp_is_active( 'activity' ) ) {
            return;
        }
        bp_activity_set_post_type_tracking_args( 'post', array(
            'component_id'             => buddypress()->blogs->id,
            'action_id'                => 'new_blog_post', // or 'new_post'
            'bp_activity_admin_filter' => __( 'Published a new post', 'emt-buddypress' ),
            'bp_activity_front_filter' => __( 'Posts', 'emt-buddypress' ),
            'contexts'                 => array( 'activity', 'member' ),
            'activity_comment'         => true,
            'bp_activity_new_post'     => __( '%1$s shared a new <a href="%2$s">post</a>', 'emt-textbuddypress' ),
            'bp_activity_new_post_ms'  => __( '%1$s sahred a new <a href="%2$s">post</a>, on the site %3$s', 'emt-textbuddypress' ),
            'position'                 => 100,
        ) );
    }
    add_action( 'bp_init', 'customize_page_tracking_args' );

    Finally I tried to customize the content of the post, in activity stream, as always suggested in this post:
    guide:https://codex.buddypress.org/plugindev/post-types-activities/
    or this:
    https://buddypress.org/support/topic/custom-activity-new-post-content-not-broken-after-update-the-post/

    This is my function:

    function record_cpt_activity_content( $cpt ) {		
        if ( 'new_post' === $cpt['type'] ) {
            $cpt['content'] = '<a href="' . get_permalink( $post->ID ) . '" class="activity-content-title" >' $post->ID). '</span><br />' 
    		. get_the_post_thumbnail( $post->ID, '') . '<br /> <br />'
    		. get_post_field('post_content', $post->ID);
        }
        return $cpt;	
    }
    add_filter('bp_before_activity_add_parse_args', 'record_cpt_activity_content');

    The problem is that the added HTML

    <a href="' . get_permalink( $post->ID ) . '" class="activity-content-title" >' $post->ID). '</span><br />

    tags are not preserved when the post is published. Solutions?

    Thanks for your attention and assistance

    #259959
    livingflame
    Participant

    I know that Buddypress is a good growing project, but, needs very Important Native (by Default) features.

    1) Buddypress Block User (allow users to block other users โ€“โ€“ really allow to hide your info, activities, etc. for a specific @user-1 e.g, auto-unfriend, no more messages from the blocked. This feature integrated with rtMedia too).
    OR FOR NOW: Buddypress Report User (with Custom Motives, p. ej. “@user-1 is sending me hateful messages”, “@user-2 published an annoying activity”). So, Admin can to impose a Sanction for @user-1, e. eg. 7 days without Post, 15 days without Sending Messages… or Community Expulsion -โ€“> Block, Delete, Banned Email). Admin can too, to Sent a Message (previously edited for auto ms saying: @user-1 you are banned for…. 30 days. Sincerely the Admins).

    * Buddypress CONFIRM Account immediately after Sign Up.

    A Social or Community without this Function is Nothing. PLEASE!!

    2) Buddypress Chat (too, Message Template, to read Messages in a specific page).

    3) Buddypress Message with Attachments.

    4) Buddypress Global Search.

    5) Buddypress Custom Menu with Account Alerts (e. g. https://goo.gl/reojsE ). Yes. I know, if you go to WP Menus, you can add to your Navbar or Menu โ€“ Profile, Activity, Notifications, etc. BUT WITHOUT Bubbles or Account Alerts… That is very very Impractical.

    6) Buddypress Media (yes I know, we have rtMedia, but its add-ons are very expensive. The complete pack = US$500 more or less).

    7) Buddypress Follow/er Native.

    8) Buddypress Share (from activity).

    9) Buddypress Autocomplete Fields (for a specific text area, e. g. City: New York, Fruits: Apple, etc.), Range Fields (e. g. I’m searching friends from 20 to 21). Buddypress Birthdate normal, but, with an option to show only the Age! 10) Buddypress Advance Search. With this you can create an advance Form with Fields for Show on Members Page or in a Widget.

    11) Buddypress with Ads Area (inside Activity, Groups, Members and Forums). (Optional from Buddypress Option Panel)

    12) Buddypress More Customizable. >> A button over Cover Profile for Easy Photo Change (yes, like Facebook has)… The CPanel with MORE Options… MORE Options for: Profile / Settings / Profile Visibility and PRIVACY!!

    For now is all. Thanks!


    @johnjamesjacoby


    @djpaul


    @boonebgorges


    @imath


    @mercime


    @hnla


    @tw2113

    wolfpup64
    Participant

    I posted up on this a little while ago, and danbp was a boss and helped me out, and I thought I could get it to work, but the end fix ended up unfortunately not really fixing the problem.

    I’m having difficulty with a profile tab that is supposed to link to a separate forums profile (wpForo) via a dynamic link that recognizes the displayed user’s page. danbp set me up with something like the below, I changed a bit to make it work better…

    function tab_custom_link_to_page() {
    
    	if ( bp_is_page( 'BP_MEMBERS' ) ||  bp_is_activity_component() || bp_is_profile_component () || bp_is_groups_component () || bp_is_notifications_component () || bp_is_messages_component () || bp_is_settings_component () || bp_is_following_component () || bp_is_followers_component () ) {
    		
    		$link = bp_get_root_domain() . '/community/profile/'. bp_get_displayed_user_username();
    		echo '<li><a href="'. $link .'">Community</a></li>'; 
    	}  
    }
    add_action( 'bp_member_options_nav', 'tab_custom_link_to_page', 10 );

    but I couldnt change the location of the tab, using code or BuddyBoss Reorder Tabs plugin, which is an issue because the theme I’m using (BuddyBoss Boss.) hides the tabs at the end under a clickable “…”. I spoke to someone at BuddyBoss and they told me I wouldn’t be able to move the tab unless it was registered as a “bp_core_new_nav_item( array(“, which requires an array like:

    function add_communityprofile_tab() {
    	global $bp;	
    	bp_core_new_nav_item( array(
    		'name'                  => 'Community',
    		'slug'                  => 'community',
    		'parent_url'            => $bp->displayed_user->domain,
    		'parent_slug'           => $bp->profile->slug,		
    		'position'              => 200,
    		'default_subnav_slug'   => 'community'
    	) );
    }
    add_action( 'bp_setup_nav', 'add_communityprofile_tab', 100 );

    which works fine until I have to link it, apparently I can’t use the tab array/slug thing to reach a dynamic link without the same “$bp->displayed_user->domain”. The link I’m trying to reach is currently at:

    http://localhost/wordpress/community/profile/*displayeduser*/

    from:

    http://localhost/wordpress/users/*displayeduser*/

    If nobody has any helpful suggestions otherwise, I’m thinking the best route might be to have the page

    http://localhost/wordpress/users/*displayeduser*/community/

    redirect to

    http://localhost/wordpress/community/profile/*displayeduser*/

    via a dynamic redirect…I’m trying to figure out how to do that.

    If anyone has any helpful advice it would be super appreciated. My boss wants me to take the site live this week and I think I’m just about there…aside from this huge disconnect between the two separate user profiles…not too bad for someone who has barely any idea what they’re doing. but yeah, sorry for the super long post. thanks for reading and hopefully you can throw me a line.

    – Andrew

    #259891

    In reply to: Please, Help Me!

    Venutius
    Moderator

    If you go to Customize>>menus you will see there are buddyPress pages there you can add to menus, but these are the user specific menu items i.e. My Activity etc. To add the global pages you just need to create a link to the page in question, i.e. http://www.yoursite.com/activity

    #259830
    notapplicable
    Participant

    WP ver 4.6.1
    BuddyPress ver 2.6.2

    Members, activity, profile, are all empty…. Register redirects to something that doesn’t exist, despite setting a known page in the dropdown. Attempted to redirect to known page, via bp-custom.php -this moved it to the page, but it rendered entirely blank. Attempted re-install of buddypress – somehow it claims there’s everything deleted but magically retains all settings when installed again – tried several themes, See mention of “bp template pack” plugin in forum that’d reset it all up, but unable to locate it as an installable plugin…

    #259693
    r083r7
    Participant

    I’m trying to edit BP theme and to figure out which files control what. Would appreciate if someone could go over a couple of basics:

    I’m looking in the folder: plugins/buddypress/bp-templates/bp-legacy/buddypress

    1) What does the /activity folder control?
    2) There’s another instance of activity related file in /members/single/activity.php
    what’s the difference?

    3) What’s the difference between
    plugins/buddypress/bp-templates/bp-legacy/ and
    plugins/buddypress/bp-templates/bp-themes/

    4) Which file controls the header? Where the cover photo and avatar image are displayed towards the top.

    5) I would like to add a custom BP page/tab. I’ve found instructions to add pages through the function.php file (located in my child-theme), is that the best way?

    #259541
    danbp
    Participant

    Ok, i misunderstood the whole… The initial question was:
    what I am trying to link to is
    http://localhost/wordpress/community/profile/<displayed_user>/

    Try this:

    function tab_custom_link_to_page() {
    
    	if ( bp_is_activity_component() || bp_is_page( BP_MEMBERS_SLUG ) ) {
    
    		// link to what you want		
    		$link = bp_get_root_domain() . '/community/profile/'. bp_get_displayed_user_username();
    		echo '<li><a href="'. $link .'">Community</a></li>'; 
    	}  
    }
    add_action( 'bp_member_options_nav', 'tab_custom_link_to_page' );
    mbfit
    Participant

    Hello posting this question again, hopefully all is well and I’m informative as much as I can be.

    WP 4.6.1
    bbpress 2.5.10
    buddypress 2.6.2
    rtmedia 4.1.6

    WP installed as directory in root, no sub-directory
    Tested with no plugins other then the ones listed above.
    Custom theme SweetDate
    No core files changed other than a landing page changed in wp-config.php
    which was this:

    /**
     * Change BuddyPress default Members landing tab.
     */
    define('BP_DEFAULT_COMPONENT', 'profile' );

    I use bluehost version that has an installed WP

    I’ve inquired this issue with the SweetDate Theme support forum and they told me to ask
    about it here.

    My site is not live yet.

    I hope that these two questions are at the right place.

    I just have 2 concerns:

    1. When creating a Group there is the option to post texts, pics, etc. If it is a long post and then it is submitted, the post comes with a ‘Read More’. When I click on it it opens up to a new page. From there if I hit the back button the post is gone. If I remove the Read More using:

    .activity-read-more {
        display: none !important;
    }

    then the text field is limited to about 30 words. Is there a way to remove the Read More and just have it as an open regular forum where there isn’t a need to expand or have it go to another page?
    I’ve shared images labeled GroupPost 1to4

    2. The other concern I have is in regards to uploading a Cover Photo for the User Group. If I post an intro text and it winds up being lengthy, the text expands the image. That seems odd. Wondered if this is how it is or on my end. Is there a way to have the text separate and not laid out on the Cover Photo? Would rather have the Cover Photo as a stand alone.
    I’ve added an image COVER-TEXT

    Thanks.

    I realize the photos are a little small.

    davidtuttle
    Participant

    Hi,

    I am using WP 4.6.1 in a network site, directory install using a Divi child theme. I have BuddyPress 2.6.2 with BuddyBlock, BuddyPress Cover Photo, BuddyPress Group Email Subscription and BuddyPress Group Tags. No bbPress.

    I would like to make all posts and comments in a group visible to anyone who joins the group. At the moment group members can only see the posts and comments of their friends.

    This implies that if a new member wants to see all the activity in a group, they have to send friend requests to everyone in the group.

    I believe this should be done in bp-custom.php with code something like the following. I don’t know if I should be using the ‘has_groups’ or ‘has_activites’ loop or some other loop. I confirmed that bp_is_group_single does target the page in question because I could change the per_page entries successfully.

    function make_all_group_comments_visible( $loop ) 
    {
     if ( bp_is_group_single() ) {
    		 $loop['??????'] = '????';
    	 }
      return $loop;
    }
    add_filter( 'bp_after_has_activities_parse_args','make_all_group_comments_visible');

    Thanks for any suggestions,

    David Tuttle

    #259214
    Antonio
    Participant

    If an admin of a group (not admin of the site), try to delete a own post from activity page of the group, it is succesfully deleted in ajax.

    But if he try to delete a post related to another user, then he is redirected to a page like this:
    http://www.example.com/activity/delete/699/?_wpnonce=d8a012dd00 that show a page 404 and the activity item is not deleted at all.

    I am using my custom theme, (I already tested with a standard theme and it works), I tried to debug the code but I can’t find nothiing different from the 2015 theme.

    Can you please let me know to understand why this happens?

    bikerwp000
    Participant
    <?php
    /**
     * Plugin Name:       BP Loop Filters
     * Plugin URI:        https://codex.buddypress.org/add-custom-filters-to-loops-and-enjoy-them-within-your-plugin
     * Description:       Plugin example to illustrate loop filters
     * Version:           1.0
     * Author:            imath
     * Author URI:        http://imathi.eu
     * License:           GPL-2.0+
     * License URI:       http://www.gnu.org/licenses/gpl-2.0.txt
     */
    
    // Exit if accessed directly
    if ( !defined( 'ABSPATH' ) ) exit;
    
    class BP_Loop_Filters {
    
    	/**
    	 * Constructor
    	 */
    	public function __construct() {
    		$this->setup_actions();
    		$this->setup_filters();
    	}
    
    	/**
    	 * Actions
    	 *
    	 * @uses bp_is_active()
    	 * @uses is_multisite()
    	 */
    	private function setup_actions() {
    		/**
    		 * Adds the random order to the select boxes of the Members, Groups and Blogs directory pages
    		 */
    		// Members component is core, so it will be available
    		add_action( 'bp_members_directory_order_options', array( $this, 'random_order' ) );
    
    		// You need to check Groups component is available
    		if ( bp_is_active( 'groups' ) ) {
    			add_action( 'bp_groups_directory_order_options',  array( $this, 'random_order' ) );
    		}
    
    		// You need to check WordPress config and that Blogs Component is available
    		if ( is_multisite() && bp_is_active( 'blogs' ) ) {
    			add_action( 'bp_blogs_directory_order_options',   array( $this, 'random_order' ) );
    		}
    
    		/**
    		 * Registers the Activity actions so that they are available in the Activity Administration Screen
    		 */
    		// You need to check Activity component is available
    		if ( bp_is_active( 'activity' ) ) {
    
    			add_action( 'bp_register_activity_actions', array( $this, 'register_activity_actions' ) );
    
    			// Adds a new filter into the select boxes of the Activity directory page,
    			// of group and member single items activity screens
    			add_action( 'bp_activity_filter_options',        array( $this, 'display_activity_actions' ) );
    			add_action( 'bp_member_activity_filter_options', array( $this, 'display_activity_actions' ) );
    
    			// You need to check Groups component is available
    			if ( bp_is_active( 'groups' ) ) {
    				add_action( 'bp_group_activity_filter_options', array( $this, 'display_activity_actions' ) );
    			}
    
    	        // You're going to output the favorite count after action buttons
    			add_action( 'bp_activity_entry_meta', array( $this, 'display_favorite_count' ) );
    		}
    
    	}
    
    	/**
    	 * Displays a new option in the Members/Groups & Blogs directories
    	 *
    	 * @return string html output
    	 */
    	public function random_order() {
    		?>
    		<option value="random"><?php _e( 'Random', 'buddypress' ); ?></option>
    		<?php
    	}
    
    	/**
    	 * Registering the Activity actions for your component
    	 *
    	 * The registered actions will also be available in Administration
    	 * screens
    	 *
    	 * @uses bp_activity_set_action()
    	 * @uses is_admin()
    	 */
    	public function register_activity_actions() {
    		/* arguments are :
    		- 'component_id', 'component_action_type' to use in {$wpdb->prefix}bp_activity database
    		- and 'caption' to display in the select boxes */
    		bp_activity_set_action( 'bp_plugin', 'bpplugin_action', __( 'BP Plugin Action' ) );
    
    		/* Activity Administration screen does not use bp_ajax_querystring
    		Moreover This action type is reordering instead of filtering so you will only
    		use it on front end */
    		if ( ! is_admin() ) {
    			bp_activity_set_action( 'bp_plugin', 'activity_mostfavs', __( 'Most Favorited' ) );
    		}
    	}
    
    	/**
    	 * Building an array to loop in from our display function
    	 *
    	 * Using bp_activity_get_types() will list all registered activity actions
    	 * but you need to get the ones for your plugin, and this particular function
    	 * directly returns an array of key => value. As you need to filter activity
    	 * with your component id, the global buddypress()->activity->actions will be
    	 * more helpful.
    	 *
    	 * @uses buddypress()
    	 * @return array the list of your plugin actions.
    	 */
    	private function list_actions() {
    
    		$bp_activity_actions = buddypress()->activity->actions;
    
    		$bp_plugin_actions = array();
    
    		if ( !empty( $bp_activity_actions->bp_plugin ) ) {
    			$bp_plugin_actions = array_values( (array) $bp_activity_actions->bp_plugin );
    		}
    
    		return $bp_plugin_actions;
    	}
    
    	/**
    	 * Displays new actions into the Activity select boxes
    	 * to filter activities
    	 * - Activity Directory
    	 * - Single Group and Member activity screens
    	 *
    	 * @return string html output
    	 */
    	public function display_activity_actions() {
    		$bp_plugin_actions = $this->list_actions();
    
    		if ( empty( $bp_plugin_actions ) ) {
    			return;
    		}
    
    		foreach ( $bp_plugin_actions as $type ):?>
    			<option value="<?php echo esc_attr( $type['key'] );?>"><?php echo esc_attr( $type['value'] ); ?></option>
    		<?php endforeach;
    	}
    
    	/**
    	 * Displays a mention to inform about the number of time the activity
    	 * was favorited.
    	 *
    	 * @global BP_Activity_Template $activities_template
    	 * @return string html output
    	 */
    	public function display_favorite_count() {
    		global $activities_template;
    
    		// BuddyPress < 2.0 or filtering bp_use_legacy_activity_query
    		if ( ! empty( $activities_template->activity->favorite_count ) ) {
    			$fav_count = $activities_template->activity->favorite_count;
    		} else {
    			// This meta should already have been cached by BuddyPress :)
    			$fav_count = (int) bp_activity_get_meta( bp_get_activity_id(), 'favorite_count' );
    		}
    
    		if ( ! empty( $fav_count ) ): ?>
    			<a name="favorite-<?php bp_activity_id();?>" class="button bp-primary-action">Favorited <span><?php printf( _n( 'once', '%s times', $fav_count ), $fav_count );?></span></a>
    		<?php endif;
    	}
    
    	/**
    	 * Filters
    	 */
    	private function setup_filters() {
    		add_filter( 'bp_ajax_querystring',              array( $this, 'activity_querystring_filter' ), 12, 2 );
    		add_filter( 'bp_activity_get_user_join_filter', array( $this, 'order_by_most_favorited' ),     10, 6 );
    		add_filter( 'bp_activity_paged_activities_sql', array( $this, 'order_by_most_favorited'),      10, 2 );
    
    		// Maybe Fool Heartbeat Activities!
    		add_filter( 'bp_before_activity_latest_args_parse_args', array( $this, 'maybe_fool_heartbeat' ), 10, 1 );
    	}
    
    	/**
    	 * Builds an Activity Meta Query to retrieve the favorited activities
    	 *
    	 * @param  string $query_string the front end arguments for the Activity loop
    	 * @param  string $object       the Component object
    	 * @uses   wp_parse_args()
    	 * @uses   bp_displayed_user_id()
    	 * @return array()|string $query_string new arguments or same if not needed
    	 */
    	public function activity_querystring_filter( $query_string = '', $object = '' ) {
    		if ( $object != 'activity' ) {
    			return $query_string;
    		}
    
    		// You can easily manipulate the query string
    		// by transforming it into an array and merging
    		// arguments with these default ones
    		$args = wp_parse_args( $query_string, array(
    			'action'  => false,
    			'type'    => false,
    			'user_id' => false,
    			'page'    => 1
    		) );
    
    		/* most favorited */
    		if ( $args['action'] == 'activity_mostfavs' ) {
    			unset( $args['action'], $args['type'] );
    
    			// on user's profile, shows the most favorited activities for displayed user
    			if( bp_is_user() ) {
    				$args['user_id'] = bp_displayed_user_id();
    			}
    
    			// An activity meta query :)
    			$args['meta_query'] = array(
    				array(
    					/* this is the meta_key you want to filter on */
    					'key'     => 'favorite_count',
    					/* You need to get all values that are >= to 1 */
    					'value'   => 1,
    					'type'    => 'numeric',
    					'compare' => '>='
    				),
    			);
    
    			$query_string = empty( $args ) ? $query_string : $args;
            }
    
            return apply_filters( 'bp_plugin_activity_querystring_filter', $query_string, $object );
    	}
    
    	/**
    	 * Ninja Warrior trick to reorder the Activity Loop
    	 * regarding the activities favorite count
    	 *
    	 * @param  string $sql        the sql query that will be run
    	 * @param  string $select_sql the select part of the query
    	 * @param  string $from_sql   the from part of the query
    	 * @param  string $where_sql  the where part of the query
    	 * @param  string $sort       the sort order (leaving it to DESC will be helpful!)
    	 * @param  string $pag_sql    the offset part of the query
    	 * @return string $sql        the current or edited query
    	 */
    	public function order_by_most_favorited( $sql = '', $select_sql = '', $from_sql = '', $where_sql = '', $sort = '', $pag_sql = '' ) {
    		if ( apply_filters( 'bp_use_legacy_activity_query', false ) ) {
    			preg_match( '/\'favorite_count\' AND CAST\((.*) AS/', $where_sql, $match );
    
    			if ( ! empty( $match[1] ) ) {
    				$new_order_by = 'ORDER BY '. $match[1] .' + 0';
    				$new_select_sql = $select_sql . ', '. $match[1] .' AS favorite_count';
    
    				$sql = str_replace(
    					array( $select_sql, 'ORDER BY a.date_recorded' ),
    					array( $new_select_sql, $new_order_by ),
    					$sql
    				);
    			}
    
    		// $select_sql is carrying the requested argument since BuddyPress 2.0.0
    		} else {
    			$r = $select_sql;
    
    			if ( empty( $r['meta_query'] ) || ! is_array( $r['meta_query'] ) ) {
    				return $sql;
    			} else {
    				$meta_query_keys = wp_list_pluck( $r['meta_query'], 'key' );
    
    				if ( ! in_array( 'favorite_count', $meta_query_keys ) ) {
    					return $sql;
    				}
    
    				preg_match( '/\'favorite_count\' AND CAST\((.*) AS/', $sql, $match );
    
    				if ( ! empty( $match[1] ) ) {
    					$sql = str_replace( 'ORDER BY a.date_recorded', 'ORDER BY '. $match[1] .' + 0', $sql );
    				}
    			}
    		}
    
    		return $sql;
    	}
    
    	/**
    	 * Cannot pass the favorite data for now so just fool heartbeat activities
    	 */
    	public function maybe_fool_heartbeat( $r = array() ) {
    		if ( empty( $r['meta_query'] ) ) {
    			return $r;
    		}
    
    		$meta_query_keys = wp_list_pluck( $r['meta_query'], 'key' );
    
    		if ( ! in_array( 'favorite_count', $meta_query_keys ) ) {
    			return $r;
    		} else {
    			$r['since'] = '3000-12-31 00:00:00';
    		}
    
    		return $r;
    	}
    }
    
    // 1, 2, 3 go !
    function bp_loop_filters() {
    	return new BP_Loop_Filters();
    }
    
    add_action( 'bp_include', 'bp_loop_filters' );
    
    
    HDcms
    Participant

    Hello,

    The ultimate goal is to mask the content and selector when a member arrives on the page of a public group to which it has not acceded. In fact he will see just the top of the page, and description button to join group

    screenshot:
    https://framapic.org/j4FYWFvZmHVI/sOyIzEz0Gl7F.png

    The idea is to reach over activities and other menu group visited oblige to register if he sees that description, avatar and the button to join

    I found bp_group_is_member to test ()
    http://buddypress.wp-a2z.org/oik_api/bp_group_is_member/
    If I do not put any argument, I understand that it will test whether the member is party group (and I add the condition to be displayed in a group?

    I have an error message:
    ยซ Fatal error: Call to undefined function bp_group_is_member() in /var/www/../wp-content/plugins/bp-custom.php on line 3 ยป

    What I found to achieve the goal:

    if ( !bp_group_is_member() || bp_is_active('groups') )
     {add_filter( 'bp_after_has_activities_parse_args', 'my_bp_activity_types_non-membre' );}
     
    function my_bp_activity_types_non-membre( $retval ) {
        $retval['action'] = array(        
            //'activity_comment',
    	//'activity_update',
    	//'created_group',
    	//'friendship_created', nouv relation entre membre
    	//'joined_group',
    	//'last_activity',
    	//'new_avatar',
    	//'new_blog_comment',
            //'new_blog_post',
    	//'new_member',
    	//'updated_profile',
    	//'rtmedia_update'       
        ); 
        return $retval;

    Regards

    #258955
    danbp
    Participant

    Hi @tronix-ex,

    Give this a try. Read more will only appear again if you use more than 500 000 characters…
    Add to bp-custom.php

    function bpfr_excerpt_length( $length ) {	
    
    $length = 500000; // adjust the length to desired number of characters 
    
    // Is the current page a user's activity stream page ?
    	if( bp_is_user_activity() ) {
    	  return $length;
    	}
    }
    add_filter( 'bp_excerpt_length', 'bpfr_excerpt_length', 11, 1 );
    danbp
    Participant

    Hi @rezbiz,

    in brief, you want to add some status dependent custom link to the BuddyBar.

    I’ll ignore Kleo (premium theme) and Visual Composer (third party plugin).

    Following examples let you add an external link to a non BP page on almost any menus (except BP usermenu).

    How it works ?
    – create a test page and call it Book.
    – the page slug must be /book/
    – the link (tab/button) will be displayed to logged-in users only.

    I made also a snippet which add such a link to the WordPress Main Menu. This menu is the one you see in WP’s menu customizer by default. Depending the theme you use, you have always a main menu and X others. This can vary and it’s to you to find how it can/should work eventually. See theme documentation and WP Codex if you get in trouble with it.
    Note that it should work with all Twenty themes at least.

    Add the snippets to bp-custom.php and see the result. After that, read through the code and modify the page name/ID and slug to your need. Leave anything else untouched.

    
    // add Custom tab on site wide activity and members directory pages
    function tab_custom_link_to_page() {
    
    	if ( bp_is_activity_component() || bp_is_page( BP_MEMBERS_SLUG ) ) {
    
    		if ( !is_user_logged_in() )
    			return false;
    
    		// link to what you want
    		$link = bp_get_root_domain() . '/book';
    
    		echo'<li><a href="'. $link .'">My Book</a></li>'; 
    	}
      
    }
    add_action( 'bp_activity_type_tabs', 'tab_custom_link_to_page' ); // site wide activity page
    add_action( 'bp_members_directory_member_types', 'tab_custom_link_to_page' ); // members directory page
    
    // add Custom tab on Profile Nav
    function add_profiles_link_to_page(){
    
    	if ( bp_is_profile_component() || bp_is_user() ) {
    
    	if ( !is_user_logged_in() )
    		return false;
    
    	$link = bp_get_root_domain() . '/book/';
    
    	?>
    		<li><a href="<?php echo $link; ?>"><?php printf( 'My Book' ); ?></a></li>
    	<?php  
    	}
    }
    add_action( 'bp_member_options_nav', 'add_profiles_link_to_page' );
    
    // add Custom tab on Groups Nav
    function add_groups_link_to_page(){
    
    if( bp_is_active( 'groups' ) ) {
    
    	if ( !is_user_logged_in() )
    		return false;
    
    	$link = bp_get_root_domain() . '/';
    
    	bp_core_new_subnav_item( array(
    		'name'			=> 'My Book',
    		'slug'			=> 'book',
    		'parent_slug'		=> bp_get_current_group_slug(),
    		'parent_url'		=> $link,
    		'screen_function'	=> true, 
    		'position'		=> 40 ) );
    	}
    }
    add_action( 'bp_setup_nav', 'add_groups_link_to_page' );
    
    // add Custom tab on Groups Directory
    function add_groups_directory_link_to_page() {
    
    	if( bp_is_active( 'groups' ) ) {
    
    	if ( !is_user_logged_in() )
    		return false;
     
        if ( bp_is_current_action( 'custom' ) ) 
            return;
     
    	$link = bp_get_root_domain() . '/book';
    
        $button_args = array(
            'id'         => 'my-books',
            'component'  => 'groups',
            'link_text'  => 'My Book',
            'link_title' => 'My Book',
            'link_class' => 'my-books no-ajax',
            'link_href'  => $link,
            'wrapper'    => false,
            'block_self' => false,
        );  
       
        ?>
    		<li><?php echo bp_get_button( apply_filters( 'bp_get_group_custom_button', $button_args ) ); ?></a></li>
        <?php
    	}	
    }
    add_action( 'bp_groups_directory_group_filter', 'add_groups_directory_link_to_page' );
    
    // add Custom tab on WP Main Menu ( after Home, About, etc )
    function main_menu_custom_link_to_page( $menu ) { 
         
    	if ( !is_user_logged_in() )
    			return $menu;
    	else
     	// link to what you want
    	$link = bp_get_root_domain() . '/book';
    
    	$grouplink = '<li><a href="'. $link . '">My Book</a></li>';
    
    	$menu = $menu . $grouplink;
    	return $menu;
    }
    add_filter( 'wp_nav_menu_items', 'main_menu_custom_link_to_page' );

    Yes, it looks complicated, but it isn’t. Simply it’s not homogeneous ! ๐Ÿ™‚

    danbp
    Participant

    @fearthemoose, @rezbiz,

    Here “the best guarded secret” finally revealed !
    But it’s not a secret, is part of Codex and a multi handled topic subject on this forum.

    What we want to do: remove access possibility.
    Where: on BuddyBar navigation menu (the one below the profile header).
    Specifics: make the activity and forum tabs only visible to the logged in user.

    NOTE: The activity tab is shown by default when you visit a profile.

    As we are going to hide/remove this tab to visitors, we need to define as first another default tab. If we won’t do that, the visitor will get a Page not found error. Which is not exactly the case here, the page exist but the visitor can’t access it.

    Let’s define arbitrary Profile as the new default tab. You can of course define what ever other existing tab on your BuddyBar as default.

    Add this line to bp-custom.php
    define( 'BP_DEFAULT_COMPONENT','profile' );

    Now the mega “open secret” !

    The folowing snippet contains almost any BP menu items you can have on a BuddyBar, and includes also the Forum item, in case you use bbPress.
    You can remove or comment out those you don’t want to use.
    Note also that it is only an example – you have to play with it to fit your need. But at least you have the right syntax to use.
    Note also that some profile menu items are user only, such as message or notice. In other words, these are always private.

    This function goes preferably to bp-custom.php

    function bpfr_hide_tabs() {
    global $bp;
    	 /**
    	 * class_exists() & bp_is_active are recommanded to avoid problems during updates 
    	 * or when Component is deactivated
    	 */
    
    	if( class_exists( 'bbPress' ) || bp_is_active ( 'groups' ) ) :
            
            /** here we fix the conditions. 
            * Are we on a profile page ? | is user site admin ? | is user logged in ?
            */
    	if ( bp_is_user() && !is_super_admin() && !is_user_logged_in() ) {
    
            /* and here we remove our stuff ! */
    		bp_core_remove_nav_item( 'activity' );
    		bp_core_remove_nav_item( 'friends' );
    		bp_core_remove_nav_item( 'groups' );
    		bp_core_remove_nav_item( 'forums' );
    	}
    	endif;
    }
    add_action( 'bp_setup_nav', 'bpfr_hide_tabs', 15 );

    Some other hints for privacy
    if you want to allow only the profile owner to view some tabs, replace
    !is_user_logged_in by !bp_is_my_profile() – this scenario doesn’t need a check for logged in users as it is made by bp_is_my_profile.

    If you want only to make a profile private, read here.

    If you want to remove a sub-nav item (ie. View on Profile), you use something like:
    bp_core_remove_subnav_item( 'profile', 'view' );

    Many other possibilities for navigation are also available, including for groups. Several examples are given on Codex, here.

    And if not enough, RTFM and search the forum ! ๐Ÿ™‚

    Have fun !

Viewing 25 results - 201 through 225 (of 831 total)
Skip to toolbar