Skip to:
Content
Pages
Categories
Search
Top
Bottom

members slug


  • B.
    Participant

    @bandonrandon

    So I’ve been working on a plugin and I need to get the url of the sites members page so I can add the logged in members url to the end. I’ve been searching but I can’t seem to be able to find the bp_get_members_slug function anywhere and figured someone here would know. Basicly I want to output http://example.com/users.

    Thanks,
    Brooke

Viewing 5 replies - 1 through 5 (of 5 total)

  • Sofian J. Anom
    Participant

    @lightcapturer


    B.
    Participant

    @bandonrandon

    @Anom, that lets the user set the slug. What I’m trying to do is retrieve the slug. This is my first time writing code for BP but I know with WP they have functions like get_site_url(); I was hoping something like get_member_slug(); was out there so I can use it as part of a default plugin where I won’t know each users member slug url as they set that up themselves. There is probably a way to retrieve the defined member slug, is that the best way to do this?

    BP_MEMBERS_SLUG is a constant defined – so if bp is initialized you can use that.

    bp_core_get_user_domain( $user_id ) will return the member’s url – e.g. http://domain.com/ BP_MEMBERS_SLUG / username / – (also if BP_ENABLE_ROOT_PROFILES is used or not)


    B.
    Participant

    @bandonrandon

    thanks, rich, what happens if BP_ENABLE_ROOT_PROFILES is enabled? Also the problem is that I am setting an option in then db and want to set it to just the http://domain.com/ BP_MEMBERS_SLUG / without the username part as the username will change with each login. I saw `bp_core_get_user_domain( $user_id )` but that requires you to set the $user_id for the user you want the profile url for.

    I think I can do
    if(!defined(BP_ENABLE_ROOT_PROFILES){
    $base_member_url=get_site_url().MEMBER_SLUG;
    } else {
    $base_member_url= get_site_url();
    }

    I was just hoping there would be a function for the base member url without a username attached.

    if BP_ENABLE_ROOT_PROFILES is set then urls do not include the BP_MEMBERS_SLUG (ie, http://whatever.com/username )

    function my_get_members_base()
    global $bp;

    if ( !defined( ‘BP_ENABLE_ROOT_PROFILES’ ) )
    $domain = $bp->root_domain . ‘/’ . BP_MEMBERS_SLUG . ‘/’;
    else
    $domain = $bp->root_domain . ‘/’;

    return $domain;
    }

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘members slug’ is closed to new replies.
Skip to toolbar