Skip to:
Content
Pages
Categories
Search
Top
Bottom

Display certain profile fields on members profile page

  • Hi, i will like to display some profile field at the members profile page, i know i can do that by adding the following code to members-header.php, but how can i put a link, so that if the field is not filled by the member it will just show let say “add your Country” and when click it will just go to the place where he can fill the field

    `

    Country:

    `

    regards

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

  • Tammie Lister
    Moderator

    @karmatosed

    Could this work with a empty checking or null value on the $data? That would be my first suggestion.

    I think it could be achieved by adding an empty checking which i have no clue. i think something loke “if empty return” could do.

    `


    <?php
    global $bp;
    $data = bp_get_profile_field_data(‘field=Country’);
    $user_status = is_user_logged_in() ;
    $add_data_link = $bp->loggedin_user->domain . ‘/profile/edit/group/1’;
    ?>

    <?php echo '‘. ‘Add Your Coutnry’.’‘; ?>

    `

    Make sure that you change the link in $add_data_link at the end … you can check out the slug and see in what group is the Country field located …

    @Alan, i will try it and if i run into any problem , i will let you know.

    regards

    @Alan, or can someone please help me look at this code to know if something is wrong, have tried it and everything seems ok if the member did not add the “country field” as it shows the link and take you to the edit page, but immediately you input the field “Country” e.g “UK” and save, it breaks both Admin bar and the Sidebar.

    @uloga,or can someone please help me look at this code to know if something is wrong, have tried it and everything seems ok if the member did not add the “country field” as it shows the link and take you to the edit page, but immediately you input the field “Country” e.g “UK” and save, it breaks both Admin bar and the Sidebar. please someone help.


    alfredojp
    Participant

    @alfredojp

    Try this:

    `<?php
    bp_profile_field_data( ‘field=Country’ );

    ?>`

    @alfredojp, thanks for your input, i know i can use that code to get some profile field but if you read my post you will know that what am trying to achieve is more than just profile field.

    thanks anyways

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Display certain profile fields on members profile page’ is closed to new replies.
Skip to toolbar