BuddyDev

Search

Replies

  • Participant
    Level: Initiated
    Posts: 4
    Michael Deinhardt on #18084

    Hi Brajesh,

    a w e s o m e. Thank you so very much. This works perfectly and I can’t thank you enough for taking the time to “whip up” that code.

    And I think/hope this makes a fine addition for others using Member Types Pro as well.

    Thanks again

    Michael

  • Participant
    Level: Initiated
    Posts: 4
    Michael Deinhardt on #18062

    Hi Brajesh,

    >>Is your goal to limit the available visibilities to only certain member types(like only Recruiter is available as a visibility level?)

    Yes, exactly. Sorry for being unclear about this. I did try the code literally though, I had a hunch that I was wrong, but it still didn’t work 🙁

    Cheers,
    Michael

  • Participant
    Level: Initiated
    Posts: 4
    Michael Deinhardt on #18057

    Hi Brajesh,

    Thans you very nmuch for the code and the blog post. Finally I got around to test this, but am failing 🙁

    The only thing I need to change in the first code, i.e. Step 1 is the line
    'label' => $member_type_object->labels['singular_name'],
    correct?

    I replaced “singular_name” with the Singular Label of the respective Member Type, wich is “Recruiter”, so my whole function in functions.php is now:

    function buddydev_add_member_type_profile_visibility( $visibilities ) {
     
        $member_types = bp_get_member_types( array(), 'object' );
        // If there is no registered member type, return the original visibilities.
        if ( empty( $member_types ) ) {
            return $visibilities;
        }
     
        // Add our member type as visibility levels.
        foreach ( $member_types as $member_type => $member_type_object ) {
            $visibilities[ $member_type ] = array(
                'id'    => $member_type,
                'label' => $member_type_object->labels['Recruiter'],
            );
        }
     
        return $visibilities;
    }

    But I still don’t see the new visibility level in the users profiles 🙁
    What am I missing?

  • Participant
    Level: Initiated
    Posts: 4
    Michael Deinhardt on #17985
    This reply has been marked as private.