BuddyDev

Search

[Resolved] different shortcode in different member type page

  • Participant
    Level: Initiated
    Posts: 3
    Elio on #5379

    Hi
    I’m using BP Member type generator, and I have the directory enabled to show the members of a particular type in a page (such as sitename.com/members/type/student to only show students type).

    Now I would like to insert members search forms different for different member type.

    To create the search forms I’m using BP Profile Search plugin that also allows to use shortcodes ore PHP code to insert the forms, but I don’t know where to insert them (I would like to insert different shortcode/code for different member type page, in order to show different search forms for different member types).

    Can someone help me please?? 🙂
    Thanks!

  • Keymaster
    (BuddyDev Team)
    Posts: 21292
    Brajesh Singh on #5383

    Hi Elio,

    Thank you for asking.

    1. You can create members/index-directory-type-MEMBERTYPE.php for each and put the code there or the easy way is to edit yourtheme/buddypress/members/index.php and use bp_get_current_member_type() to check for your member type and output the correct form.

    Hope that helps.

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 3
    Elio on #5394

    Finally I used the second solution adding in index.php the following code and the solution seem to work fine:

    <?php
    $usertype = bp_get_current_member_type();
    if ($usertype == ‘usertype1’) {

    do_action (‘bps_display_form’, ID);
    }
    elseif ($usertype == ‘usertype2’) {
    do_action (‘bps_display_form’, ID);
    }
    ?>

    Thank you Brajesh!

You must be logged in to reply to this topic.

This topic is: resolved