BuddyDev

Search

[Resolved] Member Directory Template

  • Participant
    Level: Initiated
    Posts: 16
    eGuard on #735

    Hi Brajesh,

    Your member type generator plugin can also have a member directory for each member type.
    What i would like to do is to have a member directory (just like yours) in a navigation tab in the displayed user profile.

    I have adjusted the members-loop.php file to change the layout of the directory.
    Is it possible to reuse the members-loop.php as template. As I am looking to create several directories with the same layout, it would be easier to have one template for the layout, so changes to the layout only have to be made once, instead of multiple times. This way I could keep a uniform layout accross the website

    So basically what i want to do is:

    
    if ( bp_has_members( $args) ) :         
                        while ( bp_members() ) : bp_the_member();                      
                         
                        // CALL A TEMPLATE FOR UNIFORM LAYOUT 
    
                        endwhile; 
    endif;
    }
    

    Is it possible to such? And could you give me a pointer in the right direction?

    Also could you please check my previous question? (https://buddydev.com/support/forums/topic/loop-subnav-function/) I think i didn’t clarify enough what I am exactly after.

    Thanks in advance for your help. It is highly appreciated and already helped me a lot!

  • Keymaster
    (BuddyDev Team)
    Posts: 24149
    Brajesh Singh on #744

    Hi eGuard,
    You can use the template on as many pages as you want. Just use bp_get_template_part() to include this file where you want.

    As you mentioned, the only thing that changes on different pages is the arguements passed to bp_has_members

    There are two ways to handle that. you write a function that returns appropriate arguements for each of these use and pass the returned value to bp_has_members()

    The second approach is to filter

    `bp_before_has_members_parse_args’ or ‘bp_after_has_members_parse_args’ and modify the argument based on the current page.

    Hope that helps.

    Will get back to you on the other topic a little late today.

    Thank you
    Brajesh

  • Participant
    Level: Initiated
    Posts: 16
    eGuard on #776

    Hi Brajesh,

    I can’t seem it to get to work.

    I managed to get the id’s ofthe members i want to display, and I managed to pass the id’s to the query.

    I tried elow to show the avatar (for testing to make sure id’s are passed correctly) it works fine

    
    if ( bp_has_members( ‘include=’ . $ids_implode) ) : ?>
      <?php while ( bp_members() ) : bp_the_member(); ?>
        <?php bp_member_avatar(‘type=full&width=125&height=125′) ?>
      <?php endwhile; ?>
    <?php endif; ?><?
    

    However when i want to call the template it doesn’t seem to work

    
    
    if ( bp_has_members( ‘include=’ . $ids_implode) ) : ?>
    
      <?php while ( bp_members() ) : bp_the_member(); ?>
        <?php bp_get_template_part( ‘members/members-loop’ ); ?>
      <?php endwhile; ?>
    <?php endif; ?><?
    
    

    What am i missing here?

    • This reply was modified 8 years, 5 months ago by eGuard.
  • Keymaster
    (BuddyDev Team)
    Posts: 24149
    Brajesh Singh on #830

    Sorry for the delayed reply. Can you please post the code in ‘members-loop.php’

  • Participant
    Level: Initiated
    Posts: 16
    eGuard on #1331

    I have used another way to include a custom template, topic can be marked as resolved.

The topic ‘ [Resolved] Member Directory Template’ is closed to new replies.

This topic is: resolved