Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'profile fields'

Viewing 25 results - 1,851 through 1,875 (of 3,594 total)
  • Author
    Search Results
  • This sounds like a basic jQuery+WordPress question and not necessarily a BuddyPress-specific question. You will need to do a couple of things to pull this off:

    1) Enqueue jQuery
    2) Write/copy-and-paste a jQuery script that limits the number of characters in a specific field. Then enqueue that script

    Start here (https://codex.wordpress.org/Function_Reference/wp_enqueue_script) and know that there will be a bit of a learning curve!

    Stefan
    Participant

    So no one has used the xProfile fields with Woopra stats?

    Ronnie_Fantastic
    Participant

    Hi @mercime

    So close now…

    Take a look at: http://www.liveanddangerous.co.uk/wptest/members/testy/profile/

    I’d like the background colour for the navigation menus and the profile fields to be either black, or better still, transparent.

    Is this possible? I’ve looked over the style sheet etc, but can’t find the function for this. If I view the source code for the page above, I can see the instruction for the background to be ‘rgb(254, 254, 254)’, but… can’t find that instruction anywhere in the css.

    If I can fix that, then… I believe… we’re done.

    Thanks,

    Ronnie.

    @mercime
    Participant

    == In my profile page (http://www.luchotv.com/miembros/Luciano/profile/) it says “Base Name” with just my name as information, it looks like a group even though groups were disabled. ==

    No, this is not part of a Group/Group Forums at all. /Luciano/profile/edit/group/1/ refers to the first group of Profile Fields. As you can create more profile fields based on your community, you can also create more than one group of Profile Fields to organize profile information – https://codex.buddypress.org/getting-started/configure-buddypress-components/#users-profile-fields
    – Note that all the fields you add in the first group of Profile Fields will also show up in the Registration Form if you have that enabled. Those in the 2nd group or so will only show up in e.g. /Luciano/profile/edit/group/2/ and /Luciano/profile/edit/group/3/ if you have more than one or two groups of Profile Fields.

    @mercime
    Participant

    @ronnie_fantastic Looking good.

    1. Missing BuddyPress styles: Go to Appearance > BP Compatibility. and uncheck “Disable BP Template Pack CSS”
    – you need the BP template pack CSS to properly align the BuddyPress sections.

    2. Enable registration: Go to Settings > General and look for the line where you allow registration (it’s off by default)

    3. “It has what looks like a 2 cell table with ‘Base’ written above it and the name/username within”
    – This is the Profile page and it shows profile fields. BP Codex is your friend https://codex.buddypress.org/getting-started/configure-buddypress-components/

    #144370
    parakeet
    Participant

    Has this changed at all since you last posted?
    I had the same question and got here.
    I am new to BuddyPress. It seems ridiculous that a site admin couldn’t alter profile details of a user on his site.
    In my case, I want to pre-populate a site with an set of guaranteed users whose info I want to enter for them.
    Surely, if BuddyPress was just a part of WordPress alongside it, all BuddyPress user profile info should be accessible and editable under WordPress user profile admin, not just the core WordPress fields?

    #144322
    David Cavins
    Keymaster

    I think a better bet is to collect that info on the BP registration page and then not display it on the user profile (that way you’ll still be able to use it in other ways). With BP 1.6. you can change the visibility of each xprofile field to friends only, logged-in users, or public (and force that level or allow the user to override your selection). (Visible to admin only is coming in BP 1.7, btw, which would totally fix you up.) At the moment, you can modify your theme template file (themes/yourtheme/members/single/profile/profile-loop.php) to hide some fields like this:
    `about line 17:

    <?php $no_display_fields = array( // Enter the field name of any field that you don't want to appear on the user profile.
    ‘E-mail’,
    ‘Name of Field Hide’,
    ‘Another’
    );

    if ( bp_field_has_data() && !in_array( bp_get_the_profile_field_name(), $no_display_fields ) ) : ?>`

    It’s a hack, but it works for me (until BP 1.7).

    #144273
    modemlooper
    Moderator

    Fields are hidden on a profile until a user edits their profile and adds something to that field.

    #144024
    evagorasc
    Participant

    Sure thing @modemlooper. The code below will look for all the custom fields that a user has filled in, compare them to what should be visible for the currently logged-in user and then loop and display the forum reply user’s data. Instead of simply looping the default titles and data of the xprofile fields, I do a custom switch/case so that I can format each field individually for more control.

    `
    $user_strAllFields = get_user_meta( bbp_get_reply_author_id(), bp_get_user_meta_key( ‘bp_xprofile_visibility_levels’ ), true );
    // get all the completed user fields for this poster
    if( $user_strAllFields != null ) :
    $user_arrAllFields = array_keys( $user_strAllFields );
    else :
    $user_arrAllFields = array();
    endif;
    // get all the fields that should not be displayed for this poster
    $user_arrHiddenFields = bp_xprofile_get_hidden_fields_for_user( bbp_get_reply_author_id() );

    // loop through all the poster filled-in fields
    foreach( $user_arrAllFields as $field ) :
    // exclude the ones that should not be displayed
    if( !in_array( $field, $user_arrHiddenFields ) ) :
    // turn the ID of a field into its object
    $obj_field = xprofile_get_field( $field, bbp_get_reply_author_id() ) ;

    // depending on the field name, customize the display
    switch( $obj_field->name ) :

    case ‘Location’ :
    $user_location = xprofile_get_field_data( ‘Location’, bbp_get_reply_author_id() ) ;
    if (strlen($user_location) > 0 ) :
    echo ‘

    Location: ‘ . $user_location . ‘

    ‘;
    endif;
    break;

    endswitch;
    endif; // !in_array( $field, $user_arrHiddenFields ) )
    endforeach; //( $user_arrAllFields as $field )
    `

    #143998
    modemlooper
    Moderator

    Can you can post a code snippet so others that search can find info on this?

    #143996
    evagorasc
    Participant

    @modemlooper thanks! I used a combination of your tips and info I found here https://bpdevel.wordpress.com/2012/03/16/profile-field-visibility-in-bp-1-6/ to make this work for me. I now have any custom field in Buddypress show up in my forums loop and it shows up conditionally as well for the appropriate users only.

    #143991
    #143987

    Are you using the “Multi-line Text Box” or “Text Box” field? The “Multi-line Text Box” supports line breaks.

    #143909
    modemlooper
    Moderator

    You have to pass id # of field a string wont work.

    `$data = xprofile_get_field( 2, bp_displayed_user_id() );

    print_r($data) ;`

    This will not give you a members choice. It will only return the default visibility you set up in admin. to get a users visibility on a field you get from user meta.

    `$user_visib = get_user_meta( bp_displayed_user_id(), bp_get_user_meta_key( ‘bp_xprofile_visibility_levels’ ), true );

    print_r($user_visib) ;`

    #143906
    evagorasc
    Participant

    Aha. Problems.

    So, following the advice of @modemlooper I got this working just fine. Anything created under Buddypress custom user fields can display fine in the bbPress loops, using something like this:

    `
    $user_location = xprofile_get_field_data( ‘Location’, bbp_get_reply_author_id() ) ;
    if (strlen($user_location) > 0 ) :
    echo ‘

    Location: ‘ . $user_location . ‘

    ‘;
    endif;
    `

    However, how do I make sure I follow the custom fields’ restrictions regarding visibility? In BuddyPress we can create a custom field and set its visibility to be either:
    1) Anyone
    2) Logged In Users
    3) My Friends

    Furthermore, these fields’ visibility can be allowed to be changed by each user.

    So, before simply displaying a custom field for just everyone, I need to run the required checks to verify that it should be displayed for the anonymous/logged-in user. I tried getting a reference to the actual field, like this but the var_dump() doesn’t help me much:

    `$user_location_field = xprofile_get_field( ‘Location’, bbp_get_reply_author_id() ) ;`

    This is the var_dump($user_location_field):

    `object(BP_XProfile_Field)[29]
    public ‘id’ => null
    public ‘group_id’ => null
    public ‘parent_id’ => null
    public ‘type’ => null
    public ‘name’ => null
    public ‘description’ => null
    public ‘is_required’ => null
    public ‘can_delete’ => null
    public ‘field_order’ => null
    public ‘option_order’ => null
    public ‘order_by’ => null
    public ‘is_default_option’ => null
    public ‘default_visibility’ => null
    public ‘allow_custom_visibility’ => string ‘allowed’ (length=7)
    public ‘data’ => null
    public ‘message’ => null
    public ‘message_type’ => string ‘err’ (length=3)`

    Even though I see a couple of public methods like “default_visibility()” and “allow_custom_visibility()”, they don’t really help. Their value doesn’t even change even when I change the field properties in the CMS.

    yidamweb
    Participant

    Hi,

    Thanks for your inputs. Hugo’s suggestion of having all user fields merged into the Base group appears more convenient. Paul, thank you for pointing me to the Profile >> Edit tab.

    Paul Wong-Gibbs
    Keymaster

    What screen are you looking at? The registration, or the member profile screens?

    Hugo Ashmore
    Participant

    Why can they not be part of the ‘Base’ group ad thus part of the initial signup?

    If a case of not wanting to have too many signup fields – a bad thing – then best I can think of is you would need to create a function that checks on one of those extended profile fields or all of them against the loggedin_user_id and if any returned an empty value then run a redirect to the users profile edit screen with a message request to complete the mandatory required fields on that page.

    #143868
    evagorasc
    Participant

    @modemlooper thank you for your help.

    #143867
    modemlooper
    Moderator

    When you are not in a BuddyPress loop you can get BP content by using WP author id as it returns same id.

    #143862
    evagorasc
    Participant

    @modemlooper Thank you! That did it.
    get_the_author_id() as well as bbp_get_reply_author_id() seem to both work just fine.
    get_post_author_id() and $bp->displayed_user->id don’t seem to work for me though.

    #143861
    modemlooper
    Moderator

    `$user_id = $bp->displayed_user->id;

    $location = xprofile_get_field_data( ‘Location’, $user_id ) ;
    echo ‘Location: ‘ . $location;

    if that doesnt work try getting the_author_ID(); or get_post_author_id();`

    #143859
    evagorasc
    Participant

    Made some progress with this, but still need help. I figured that I could simply add something like this underneath the avatar:

    Code:
    $location = xprofile_get_field_data( ‘Location’, 10 ) ;
    echo ‘Location: ‘ . $location;

    However, notice the hard-coded “10” there which is an ID. This needs to be the ID of each user in the replies table and it changes with each table row inside the “loop-single-reply.php” file. I don’t mind changing the template file and keeping a record for it when upgrades come, but how do I know the ID of each user in the bbPress posting loop?

    #143852
    Paul Wong-Gibbs
    Keymaster

    Wow. This must a record for oldest resurrected thread.

    Please start a new topic

    #143848
    evagorasc
    Participant

    @johnjamesjacoby i am running the latest version of BuddyPress and bbPress together (running bbPress as site-wide forums integrated with BuddyPress). I would like to add any custom xprofile BuddyPress fields that I created underneath the avatar of a user in the forums.

    The actual code that writes out the replies loop is inside the “loop-single-reply.php” file of the bbPress plugin. But how do I connect to BuddyPress and display any xprofile fields that I want though?

Viewing 25 results - 1,851 through 1,875 (of 3,594 total)
Skip to toolbar