Skip to:
Content
Pages
Categories
Search
Top
Bottom

Displaying a custom field in profile page


  • krialix
    Participant

    @krialix

    I am using Register Plus Redux and i created a custom field for registration page. When people fill in this custom field, i want to display this info under forum role. I searched a bit and i found get_post_meta() but how can i take info from custom field and display in a function?

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

  • Robin W
    Moderator

    @robin-w

    quickest way would be for you to check out the code in the plugin bbp-user-information on my website.

    bbp Profile Information plugin

    This adds 4 fields to the display under the forum role in topics/replies and in the profile (and make those field editable for later on), and you can see how these are set up and used.

    In particular under the /includes folder you’ll find the display.php shows how to create function to add this to the correct area via a filter.

    add_action ('bbp_theme_after_reply_author_details', 'bbp_user_information') ;
    

    and

    add_action ('bbp_template_after_user_profile', 'user_profile_bbp_user_information') ;
    

    and within this you’ll see the code

    $usermeta = get_userdata( $user_id, 'ui_label1' );
    			echo $usermeta->ui_label1;
    

    where ‘ui_label1’ is the metadata field and takes the data from the usermeta table and displays it.


    krialix
    Participant

    @krialix

    Thank you. This is what i am looking for. Worked perfectly.


    Robin W
    Moderator

    @robin-w

    Great glad you’re fixed !


    carterlongbeach
    Participant

    @carterlongbeach

    I have a similar issue but need a little help getting it to work.

    I created a custom profile field (Base, Primary) in bbpress called School, with a dropdown menu to select the school.

    Based on the answer above I tried this, but nothing happened…

    “$usermeta = get_userdata( $user_id, ‘School’ );
    echo $usermeta->School;”

    Obviously I’m missing something. Any ideas?

    Thanks.


    Robin W
    Moderator

    @robin-w

    could be hundreds of reasons – most are to do with small errors in coding.

    That latest version of my profile info is now on wordpress, suggest you crack that open, and see if you can alter it for a dropdown.

    https://wordpress.org/plugins/bbp-profile-information/


    mwason
    Participant

    @mwason

    Is there any way to add in an opt-out function to the profile? Also, is there any way to add a check box that would offer different options of providing information (keep me informed, keep me informed of all events, etc.).

    Thanks for any assistance.

    Here is another way to do custom profile fields:

    https://codex.wordpress.org/Plugin_API/Filter_Reference/user_contactmethods

    bbPress will display any of of these fields you add or remove for a users profile page, as many of few as you like.


    Kalusha
    Participant

    @kalusha

    Hello,

    I need one extra Field where I can put “New Message” with this function:
    <a href="<?php echo fep_query_url('newmessage', array('to' => USER ) ); ?>">Send Message</a>
    CAn anybody help me how and where I must out it in, please.

    Thank you

Viewing 8 replies - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.
Skip to toolbar