Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 14 replies - 1 through 14 (of 14 total)
  • @_natty_

    Participant

    ill try to be more specific,

    this works:

    	bp_core_new_nav_item( 
    	    array( 
    		'name' => __('Group management'), 
    		'slug' => '../../groups/', 
    		'parent_slug'=> 'groups',
    		'position' => 70, 
    	 ));

    its showed as main tab of user menu
    but how can I add it as sub tab of the standar groups bp user’s menu?

    @_natty_

    Participant

    I spot the problem few second ago! but before it works!

    this is the fault code:
    add_action( ‘bp_init’, ‘using_mt_register_member_types’ );

    should set to
    add_action( ‘bp_register_member_types’, ‘using_mt_register_member_types’ );

    so bp_init make the mess!
    hi hope that can helps

    @_natty_

    Participant

    thanks a lot but this was already tested with no result!
    or better, same result! same id! on the context! i try to give a full vision of my site conf:

    on bp-custom on buddypress folder ive this:

    function using_mt_register_member_types() {
    	bp_register_member_type( 'Problem solver', array(
    		'labels' => array(
    			'name'          => 'Problem solvers',
    			'singular_name' => 'Problem solver',
    		),
    	) );
    
    	bp_register_member_type( 'Entrepreneur/policy maker', array(
    		'labels' => array(
    			'name'          => 'Entrepreneur/policy makers',
    			'singular_name' => 'Entrepreneur/policy maker',
    		),
    	) );	
    }
    add_action( 'bp_init', 'using_mt_register_member_types' );

    then in my plugins ive active “Member Type Field for Buddypress XProfile”
    and in mine xprofile field ive one setted to select the user type during registration by users. it show my option described above!

    then on the same bp_custom file for building a “conditional menu” ive this snippet of code:

    function add_break_in_tabs() {
    
    if ( !function_exists( 'bp_get_member_type' ) ) { 
        require_once ABSPATH . PLUGINDIR . 'buddypress/bp-members/bp-members-functions.php'; 
    
    } 
    
    $user_id=bp_displayed_user_id();
    $user_id2=get_current_user_id();
    $tipo=bp_get_member_type();
    echo $user_id.$user_id2;---->SAME RESULT SHOWED!
    echo $tipo;--->NOTHING TO SHOW
    var_dump($tipo);---> BOOOL FALSE
    ....

    On the user’s list i can set type for each user.
    On registration i can see and select the type.
    On Xfield definition ive no option to select but the option showed in the registration form are correct!

    thanks a again to any contributor

    @_natty_

    Participant

    this driving me crazy!
    this could be a problem related to xfield_profile id?

    on the table “bp_xprofile_field” the type field got an “id” different from the external key on “bp_xprofile_data” on “field_id”

    in casa no idea to how this happen! and if i manual adjust the id the type field disapper from the profile too!

    @_natty_

    Participant

    my hook

    function using_mt_register_member_types() {
    	bp_register_member_type( 'Problem solver', array(
    		'labels' => array(
    			'name'          => __( 'Problem solvers', 'using-mt' ),
    			'singular_name' => __( 'Problem solver', 'using-mt' ),
    		),
    	) );
    	bp_register_member_type( 'Entrepreneur/policy maker', array(
    		'labels' => array(
    			'name'          => __( 'Entrepreneur/policy maker', 'using-mt' ),
    			'singular_name' => __( 'Entrepreneur/policy maker', 'using-mt' ),
    		),
    	) );	
    }
    add_action( 'bp_init', 'using_mt_register_member_types' );

    the field for the registration form:
    registration field

    @_natty_

    Participant

    update: in the members type loop it works! in the bp-custom.php no!

    @_natty_

    Participant

    @shanebp
    it seems thats works for every users but not for the admin!
    the url thats work for the admin is: site/members/admin instead of site/members/admin username i wonder why!

    thats work, but to me is silly:

    function custom_login_redirect_to($user_login, $user) {
    
    	if($user_login=='breakAdmin'){
    			bp_core_redirect( get_option('siteurl') . '/members/admin' );
    
    	}
    
    	bp_core_redirect( get_option('siteurl') . '/members/'  . $user_login );
    }
    add_action('wp_login', 'custom_login_redirect_to', 10, 2);

    @_natty_

    Participant

    @danbp
    thats the main problem! 🙂 i found that by enabling the debug bar plugin… and browsing the plugin’s file i didn’t find it!

    @_natty_

    Participant

    many thanks I didn’t notice before, its works!

    @_natty_

    Participant

    greetings to all,
    I put the code suggested @danbp on my bp-custom and everything ok but no mapping trough the extra Xfield type… then I add the suggested plugin ( https://github.com/mottolini/buddypress-xprofile-member-type-field ), but I can’t see any setting page or a guide to edit the file from the plugin for mapping the Xfield.
    how can solve it?
    Thanks in advance

    @_natty_

    Participant

    so easy, so for that reason i didn’t find around LOL
    many thanks.
    Here for others user that needs to solve this kind of problem a piece of the code that helps me to solve the problem about showing post-type on sub-nav: This function referring to the first “animal” example goes in “function cats_screen content()

    if ( is_user_logged_in() )
    {
    
    	$autore=bp_displayed_user_id();
    
    	$args = array(
    		'post_type' => array('XXXX','YYYYYY'),
    		'orderby' => 'menu_order',
    		'post_status' => 'publish',
    		'author' => $autore,
    		'order' => 'ASC',
    		'posts_per_page'=> '12'  // overrides posts per page in theme settings
    		);
    
    	$query=new WP_Query( $args );
    
    	if ( $query->have_posts() )
    	{
    
    		while ( $query->have_posts() )
    		{
    			$query->the_post();
    			$id = get_the_ID();
    			echo '<div class="post_prod">';
    			echo '<h3 class="title_prod"><a href="' . get_the_permalink() . '">' . get_the_title() .  '</a></h3>';
    			if(has_post_thumbnail())
    			{
    				echo '<div class="pic_prod">';
    				echo get_the_post_thumbnail($id,'thumbnail').'</div>'; 
    			}else echo '<div class="img"><img height="150" width="150" src="xxxxxxx" ></div>';
    			echo '<div class="exc_prod"><p>'.the_excerpt().'</p></div>';
    			echo '</div>';
    
    		}
    
    	}else{echo wpautop( 'Sorry, no productions found' );}
    	          	
    
    }else{echo wpautop( 'Spiacente, non sei autorizzato' );}
    wp_reset_query();

    @_natty_

    Participant

    Hi, everything now works nice, even for other user I can see the main tab, but not the subnav why?
    The subnav are available just for the current user and not if I visit others people profile.

    I guess that is for this:'user_has_access' => bp_is_my_profile()

    But I can’t find how to correctly configurated it for having access to own sub_nav and others profile’s sub_nav.

    @_natty_

    Participant

    if there is a better and clear stretegy for providing archive of specific type post please give me an advise…otherwise I’ll try to add this feature. thanks

    @_natty_

    Participant

    many thanks to all, ill try before the plugin approach: IdeaStream seem to solve my probs but I need to understand how to integrate it with membersloop etc

Viewing 14 replies - 1 through 14 (of 14 total)
Skip to toolbar