Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'hide xprofile fields'

Viewing 25 results - 51 through 75 (of 104 total)
  • Author
    Search Results
  • #175772
    Shmoo
    Participant

    It’s my theme and I code WordPress themes for like 5 years now but I don’t see myself as a Developer it’s more a hobby ๐Ÿ™‚

    I’m solid at HTML-CSS and can read PHP when I see it happen but I can’t write PHP it out of the box.

    This error shows up when I try to hide a complete xProfile-group-ID or just an unique xProfile-field-ID from the loop.

    This is what I did.
    Inside: my-theme/buddypress/members/single/profile/profile-loop.php
    I found the start of the loop

    
    <?php if ( bp_has_profile() ) : ?>
    ....
    

    My first thought was, maybe there are default options here to control the output of which ID’s will be visible so I started the search how the bp_has_profile() was build and looked into plugins/buddypress/bp-xprofile/bp-xprofile-template.php and found this at line 150:

    
    ....
    
    $defaults = array(
    	'user_id'             => bp_displayed_user_id(),
    	'profile_group_id'    => false,
    	'hide_empty_groups'   => true,
    	'hide_empty_fields'   => $hide_empty_fields_default,
    	'fetch_fields'        => true,
    	'fetch_field_data'    => true,
    	'fetch_visibility_level' => $fetch_visibility_level_default,
    	'exclude_groups'      => false, // Comma-separated list of profile field group IDs to exclude
    	'exclude_fields'      => false  // Comma-separated list of profile field IDs to exclude
    );
    

    This looks very familiar to bbPress so my first thoughts was lets try to add one of those Array’s to the loop and overwrite the default value.
    Just like this.

    
    <?php if ( bp_has_profile( array ( 'exclude_groups' => 1 ) ) ) : ?>
    ...
    

    This works perfect, it hides all xProfile-fields from the first Base primary Tab (back-end). Just like I wanted it because I didn’t want all the fields to show up front-end, I’ve got a few xProfile-fields that I use for user-customization of the profile-page. Each user can add color-codes to change the default menu-color and add background-images to their profile-page to make each profile a little more unique.
    Those field-ID’s are just urls or color-codes and don’t have to be visable to the public, thats why I try to hide them front-end.

    buddypress member pofile tab

    #167792
    nobodymove
    Participant

    @bphelp. I think I have discovered the culprit to this little mystery.. I have been using the Buddypress Members Import plugin: http://www.youngtechleads.com/buddypress-members-import/

    For some reason when I import my database, the plugin does not seem to process the xProfile Field visibility settings properly.. The profile fields are still listed as “Admins Only” But for some reason they are still visible to all users.

    Earlier, I manually added some new test profile fields and they worked fine. I also discovered, that if I edit, and re-save a user’s profile field after import, all profile fields for that user will then revert to the proper visibility settings.

    I have contacted the plugin author to make him aware of the issue, hopefully he can fix it. If you have any suggestions that might be a quick fix for this I’m all ears! ๐Ÿ™‚

    #167443
    nobodymove
    Participant

    Thanks @bphelp. Info listed below:

    1. Which version of WordPress are you running?

    3.5.2

    2. Did you install WordPress as a directory or subdomain install?

    Directory

    3. If a directory install, is it in root or in a subdirectory?

    root

    4. Did you upgrade from a previous version of WordPress? If so, from which version?

    3.5

    5. Was WordPress functioning properly before installing/upgrading BuddyPress (BP)? e.g. permalinks, creating a new post, commenting.

    Wordpress seems to be working fine

    6. Which version of BP are you running?

    1.7.2

    7. Did you upgraded from a previous version of BP? If so, from which version?

    1.7

    8. Do you have any plugins other than BuddyPress installed and activated? If so, which ones?

    Yes, a lot. ๐Ÿ™‚

    Allow Multiple Accounts
    amr users + buddypress
    buddypress group email subscription
    buddypress member import
    buddypress message attachement
    Buddypress Toolbar
    Buddypress Xprofile custom fields type
    comprehensive google map
    contact form manager
    events manager pro
    easy table
    form lightbox
    GRAND Flash Album Gallery
    Lightbox Galleries EWSEL
    Mass Messaging in Buddypress
    Online Backup for WordPress
    Peter’s Login Redirect
    SHortcode Widget
    User Switching
    WP Full Calendar
    WP Wunderground

    9. Are you using the standard BuddyPress themes or customized themes?

    I’m using Razor 1.1.3 from Themeforest/Parallelus

    10. Have you modified the core files in any way?

    No

    11. Do you have any custom functions in bp-custom.php?

    No

    12. If running bbPress, which version? Or did your BuddyPress install come with a copy of bbPress built-in?

    13. Please provide a list of any errors in your serverโ€™s log files.

    14. Which company provides your hosting?

    Network Solutions

    15. Is your server running Windows, or if Linux; Apache, nginx or something else?

    VPS hosting package

    #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).

    #140405
    johndavis84
    Member

    I need to be able to show / Hide XProfile groups based on select value during the registration phase. I’m a newbie to all this so could someone please help on how accomplish this.

    Is that possible with buddypress? Has this plugin been created?

    Roger Coathup
    Participant

    @natetheaverage

    an outline solution (there are lots of areas where you’d have to work to implement it):

    When a group is created, you could write a hook that creates a corresponding xprofile field group (remember to hook on delete group as well to remove the profile field group)
    In the member’s profile screens, you would hide that xprofile field group if the member is not a member of the group
    In a hook on Join Group, you’d want to display an additional screen that prompts for the user fields, and when that is submitted use the xprofile API to write the data to the user’s profile
    I guess finally, you’d also want to modify the members loop inside the group to show that information

    There’s a lot of code for you to trawl through

    Hugo Ashmore
    Participant

    You’ll need to do something like wrap the custom xprofile loop section in a check for a specific field name ‘birthdate’ and do something like ‘if not’ ‘birthdate’ go ahead and display field item or display if is_admin if you want to be able to see users data as a site admin.

    To remove a field you could do:
    `

    <tr>

    `
    in the profile loop; equally if you wanted to remove a complete field group you can copy the approach seen in the file for ensuring that the base group is not shown `if ( 1 != bp_get_the_profile_group_id() ) ` adding an OR followed by a check on the group id to hide.

    #129738
    Hugo Ashmore
    Participant

    Profiles are by default public, you can also extend them by creating your own custom xprofile fields, these and any profile fields can be further modified if wished to show or hide some based on whether the displayed user is also the logged in user.

    #128706
    Marcella
    Participant

    Hey @davidveldt this should do it if you are using the default theme. Otherwise you should integrate as you see fit.

    theme/registration/register.php

    You can add any groups or fields as you require. The groups and fields here are arbitrary.

    ` ‘player’, 4 => ‘coach’, 5 =>’parent’, 6 => ‘instructor’); ?>

    $role) : ?>
    <div id="” class=”role-fields”>

    <label for="”>

    <textarea rows="5" cols="40" name="” id=””>

    <input type="hidden" name="signup_profile_field_ids" id="signup_profile_field_ids" value="” />

    `

    Create some profile groups to cater for each role. You can find the group id within the BuddyPress admin… In the url bar or investigate your database.

    You should set-up the $roles array above to match your requirements.

    Within the loop you can show any fields you have created within that xprofile group. If you have a select box within that group you would add the following code as outlined in the bp-default register.php

    `

    <label for="”>

    <select name="” id=””>

    `

    Finally add the following jQuery where you house any other code of similar ilk.

    `
    jQuery(“.role-fields”).hide();
    $roles = jQuery(“#roles”);
    jQuery(“#field_2”).change(function()
    {
    $role = jQuery(this).val().toLowerCase();
    jQuery(“.role-fields”).hide();
    jQuery(“#” + $role).toggle();
    });
    `

    Here’s a pastebin for all that above. http://pastebin.com/QFdTdstz

    No need for tabs or accordion this time.

    Hope that helps you on the Road.

    #128632
    Marcella
    Participant

    Just an example here, running with Paul Gibbs start point.

    Create xprofile fields as normal.

    Each career group would also have its own xprofile group.

    Player would have his / her own set of fields.
    Coach would have his / her own set of fields.
    Parent would have his / her own set of fields.
    Instructor would have his / her own set of fields.

    None of the above would be required fields. (as far as BuddyPress is concerned (unless you roll some PHP codes))

    You’d have another xprofile group specifically for required fields (this would be your first group).

    You would make the “type” part of the required group and set it as a select box.

    You could then write your registration form mark-up matching the requirements of jQuery tabs or jQuery accordion.

    The “type” would be the last item on the required fields. Once that was selected you could then show or hide the corresponding jQuery ui-tab-panel that holds those form fields.

    You could then on-the-fly make those fields then required using some jQuery also but a bit hacky.

    #126155
    freque.unce
    Participant

    I changed register.php to display profile group 3 (optional profile fields I added via dash) instead of 1, to hide the required displayname option on signup, which forces it to clone username data by default. I then removed the ability to change names in xprofiles’ edit.php (with if/else, statements on textbox & submit button for profile group 1).

    Those 2 steps take care of all future occurances, so I then went in and changed all of my existing users’ display names to match their usernames, manually, via the dashboard.

    Problem solved. More of a substitute than a removal, but it works for me. Hopefully someone will find this useful.

    modemlooper
    Moderator

    Just read you don’t want to edit home.php. There isn’t a filter for privacy like there is with messages for showing profile sections. Messages and xprofile fields has logic for output and can be filtered but the actual page needs a code edit.

    #88998

    In reply to: Hide profile field

    r-a-y
    Keymaster

    Tested just now, works for me.
    You need to use the profile id #.

    Go to your profile field setup and check the ID by putting your mouse over the “Edit” field. The ID # is field_id.
    For example, “Name” is 1.

    Either that or go to your DB and manually look up the profile field id in the wp_bp_xprofile_fields table.

    You can also use any profile template tag and do your conditional.

    If you wanted to use the profile name, use bp_get_the_profile_field_name() instead.

    peterverkooijen
    Participant

    @thelandman, in my solution I use javascript to generate the username from the weird semi-optional xprofile fullname field, hide the username field on the form, use the email login plugin so members don’t need the username to log in, add more custom code to synchronize the fullname and the fullname-derived username to all the various similar fields in the database, etc. It’s messy, but somewhat workable.

    The point is that it should not be that hard. Using full names, Firstname Lastname, should be part of the core. Seeing that none of this is fixed in 1.2+ and probably will never be fixed, I have no plans to upgrade to newer versions of Buddypress and will continue developing my version as a fork, more suited for professional and business use. If anyone is interested in working with me on that, please contact me directly.

    Gene53
    Participant

    Done, thanks again.

    Gene

    jivany
    Participant

    So it works? Tag the topic as resolved. ;)

    Gene53
    Participant

    Believe it or not, it didn’t work when I changed Username for 1 but it did when I added ,3 (still don’t know what the 3 is for, LOL).

    Does that mean I don’t really need the funky function and simply change the <input type=”hidden” … > in edit.php or should I just leave things as they are now that it seems to work?

    EDIT: when I added ,3, I couldn’t change the value of the next field and “1” still gives me the error…

    EDIT 2: ROFLOL, it didn’t work because I omitted the , (colon) after the 1. Now everything seems to work.

    Thanks again, I really appreciate your help.

    Gene

    jivany
    Participant

    It becomes just string manipulation. Create a new function (my_funky_function) and do something like this:

    function my_funky_function() {
    echo str_replace( "username","", bp_get_the_profile_group_field_ids() );
    }

    Then replace the bp_the_profile_group_field_ids() call in edit.php (in your child theme of course) with my_funky_function().

    I think that will work but it’s not tested. ;)

    Edit:

    Oh, sorry, I’m sort of wrong. This is what I get in my edit.php form in the HTML:

    <input type="hidden" name="field_ids" id="field_ids" value="1,3" />

    Field_id 1 is the Username for me. You just need to filter that out so the str_replace call should be “1,” instead of “username”.

    Gene53
    Participant

    Makes sense but I haven’t a clue on how I could code such a function… That’s way above my programming skills.

    jivany
    Participant

    <input type="hidden" name="field_ids" id="field_ids" value="<?php bp_the_profile_group_field_ids() ?>" />

    That line is your problem. Well, more specifically, the call to bp_the_profile_group_field_ids() which creates a list of the expected field names.

    Unfortunately it doesn’t have a filter so you’d have to clone and own the function into your functions.php file and manually filter out the “username” field from the string that gets generated.

    Make sense?

    Gene53
    Participant

    Hey jivany,

    I was sort of wondering if that would happen

    LOL, it sure did so I’m wondering if there was a workaround, such as the field not being visible (or non editable) but would still send the name field when the form is submitted.

    Darn, I miss the good old days (phpBB 1 and 2) when you only had to comment out code in templates…

    jivany
    Participant

    Oh, nope, it probably means that the code is actually checking that the field ‘username’ should be getting updated. I was sort of wondering if that would happen. ;)

    Gene53
    Participant

    Oops, spoke too soon, if I edit anything in group 1 (where Username is hidden), I get “Please make sure you fill in all required fields in this profile field group before saving” even though everything has been filled.

    Oh well, back to the drawing board. Maybe the code wasn’t inserted in the right place and/or I have to add HTML but I haven’t a clue as to what I should add.

    Gene53
    Participant

    @jivany Wow, thanks, I simply added:

    <?php if ( 'Username' == bp_get_the_profile_field_name() ) : ?>

    <?php else : ?>

    under:

    <?php if ( 'textbox' == bp_get_the_profile_field_type() ) : ?>

    inserted a endif where you indicated, didn’t do any HTML formatting and the Username field is now hidden.

    Thanks again!

    Gene

    jivany
    Participant

    Well, yes, you should be able to make the username field non-editable. I would assume the username field is a “textbox” type. In edit.php, you should be able to just filter out the username field and not create a form “textbox” HTML element. So, in member/single/profile/edit.php around line 21, add in a check something like:

    <?php if ( 'username' == bp_get_the_profile_field_name() ) : ?>
    // Just display the Username with bp_the_profile_field_name() and add HTML to style how you want.
    <?php else : ?>
    // Do the existing <label... code on line 23 and 24
    <?php endif; ?>

    Now, a creative user might still be able to circumvent your little hack and submit their change directly to the form. I see a nonce being used though in the form so that might not be too much of a concern after all.

Viewing 25 results - 51 through 75 (of 104 total)
Skip to toolbar