Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Resolved] get profile group name


  • kgrondell
    Participant

    @kgrondell

    I am trying to mod the profile loop so that I can render profile groups and group titles even if the user has not entered that data. I want this to show profile progress.

    I’ve tried bp_the_profile_group_name(); echo bp_get_the_profile_group_name(); but they don’t seem to display a profile name if the user does not have data for that group.

    I have moved these function calls outside the if statement that qualifies if the user has data and it still does not return.

    Is there another approach to getting a profile group name? Perhaps by passing a group id?

    Thanks

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

  • danbp
    Participant

    @danbp

    Perhaps you can spare time and use https://wordpress.org/plugins/buddy-progress-bar/ ?


    kgrondell
    Participant

    @kgrondell

    Interesting option but they want to have a link that previews the answers. So in that section I will display “profile group title” and some sort of user friendly “no records found”

    I was hoping it would work like get_title or get_posts and you could pass the id but that’s not how it works.

    I suspect I will do a wp_query of at the top and use the page group id to key the title from the results. I was just wondering if there was a cleaner or more appropriate way to get this.


    kgrondell
    Participant

    @kgrondell

    I figured it out.

    $args = array(
    'profile_group_id'   => $current_profile_group_id
    	);
    $data_groups = BP_XProfile_Group::get( $args );
    echo '<h1>'.$data_groups[0]->name.'</h1>';
    echo '<p>'.'It looks like you have not given any responses here yet.'.'</p>';

    I added a counter var in the loop which initializes to 0 if after passing through the loop its 0 it will execute this.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] get profile group name’ is closed to new replies.
Skip to toolbar