Skip to:
Content
Pages
Categories
Search
Top
Bottom

Add Group Name in Member-header

  • Hi,
    I have restricted members to join only one group. Therefore all my users have only 1 group to join..
    I want ti display the name of that group next to the User Name in profile header…
    For Example. Bill Gates (Microsoft)
    Where Bill Gates is the name of member and Microsoft is the name of the group which he is a member of.
    Thanks,
    nasir

Viewing 5 replies - 1 through 5 (of 5 total)
  • Avatar of @mercime
    @mercime
    Keymaster

    @mercime

    If you only have one group, then you can just hardcode the group name in the member-header.php file. Copy over this file from bp-default theme http://buddypress.trac.wordpress.org/browser/tags/1.5.5/bp-themes/bp-default/members/single/member-header.php into your theme i.e., wp-content/themes/YourThemeFolder/members/single/member-header.php

    Open up member-header.php file and right beside
    `<a href="”>` , add `(Microsoft)` for example

    Hi mercime ,
    Sorry i didn’t made my points clear…
    I have for about 25 groups… but each member can join 1 group at most… Therefore i have 125 members and each group have 5 members…
    Therefore i want to show the group name next to the user name of each member’s profile
    thanks :)

    I wrote some custom code which may help you out…..
    `
    $query = mysql_query(“SELECT * FROM bp_groups_members WHERE user_id = $user_id “);
    $numrows = mysql_num_rows($query);
    if ($numrows !=0 ){
    $row = mysql_fetch_Assoc($query);
    $group_id= $row; }
    $query1 = mysql_query(“SELECT * FROM bp_groups WHERE id = $group_id “);
    $numrows1 = mysql_num_rows($query1);
    if ($numrows1 !=0 ){
    $row1 = mysql_fetch_Assoc($query1);
    $group_name= $row1; } `

    and then just used following code to display the group name
    `

    ()

    `

    This is exactly what i was looking for..
    I hope this is the best solution for this feature???

    Avatar of mgunay
    mgunay
    Member

    @mgunay

    @orpatech thanks for the solution. What exactly do we do with the MySQL code? where do I input it?

    Thnks!

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

You must be logged in to reply to this topic.