Search Results for 'profile fields'
-
AuthorSearch Results
-
October 24, 2013 at 7:43 pm #173322
Hugo Ashmore
ParticipantIf you want a paid option you could check out:
October 24, 2013 at 4:26 pm #173319Robert Trevellyan
ParticipantI don’t know if there’s a way to do it natively in BuddyPress (I’m new here), but s2member can be used to create additional member fields that are only accessible to administrators, and I expect there are other plugins that offer similar functionality.
October 23, 2013 at 1:01 pm #173277In reply to: Function to update databse fields
martinbeaulne
ParticipantWell well. I finally found, and I’m surprised the answer didn’t come from this thread.
It is quite simple, in fact. Just need to use the function:
xprofile_set_field_data($field, $member-id, $value);So, with a simple form sending those three values, one can update a single field anywhere. As I wanted to let members update their fields directly from their member profile ( without using the very bad and obscure edit.php ), I put a form and the function in the member-header.php
My form and function updates three fields.
Here is the function, somewhere in the member-header.php file:
<?php function updatedemo() { $id = $_POST['id-member']; $liendemo = $_POST['liendemo']; $champdemo = $_POST['champdemo']; $titre = $_POST['titre']; $champtitre = $_POST['champtitre']; $description = $_POST['description']; $champdescription = $_POST['champdescription']; xprofile_set_field_data($champdemo, $id, $liendemo); xprofile_set_field_data($champdescription, $id, $description); xprofile_set_field_data($champtitre, $id, $titre); } if(isset($_POST['submit'])) { updatedemo(); } ?>And here is the form:
<?php if ( bp_is_my_profile() ) { ?> <form method="post" action="<?php bp_displayed_user_link(); ?>"> <?php if ( xprofile_get_field_data('25') == "" ) { ?> <img src="http://www.cinemacontact.com/fr/images/form-demo-01.jpg"><br> <?php }; if ( !xprofile_get_field_data('25') == "" ) { ?> <img src="http://www.cinemacontact.com/fr/images/form-demo-01-1.jpg"><br> <?php }; ?> <img src="http://www.cinemacontact.com/fr/images/form-demo-02.jpg"><br><input type="text" name="titre" size="40"><br> <img src="http://www.cinemacontact.com/fr/images/form-demo-03.jpg"><br><input type="text" name="liendemo" size="80"><br> <img src="http://www.cinemacontact.com/fr/images/form-demo-04.jpg"><br> <img src="http://www.cinemacontact.com/fr/images/form-demo-05.jpg"><br> <textarea style="width:400px; height:75px;" name="description"></textarea> <input type="hidden" name="champdemo" value="lien-4"> <input type="hidden" name="champdescription" value="description-4"> <input type="hidden" name="champtitre" value="titre-4"> <input type="hidden" name="id-member" value="<?php echo bp_loggedin_user_id(); ?>"><br> <input type="submit" value="Envoyer" name="submit"> </form> <?php }; ?></h3>And this actually works.
Maybe I didn’t ask correctly at the beginning of the thread. All I wanted to know was:
« Oh, Martin, there is, indeed, a function to update xprofile fields: xprofile_set_field_data(), don’t need to start with edit.php file. »🙂
October 20, 2013 at 10:03 am #173124ugcheleuce
Participant@Jobster123: I’m afraid I don’t understand what you mean.
The success of a directory does not depend on unique content but on whether you can entice users to register profiles. In addition, the success of the directory depends on how easy it is for visitors to search the directory and find the user profiles that fulfils their need. This means that a directory system needs to be easy to use for users who want to register but who aren’t computer literate or who don’t have time to figure out how to beautify their profiles beyond that which is necessary.
Of course, it would be great if Google could index the directory, but the strength of the directory lies not in the “description” field of each profile page, but in the way all the factual fields have been set up… because those are the things that visitors will search.
Samuel (ugcheleuce)
October 20, 2013 at 3:29 am #173114Yukon Cornelius
Participant@danbp Thank you man, this is amazing!
It didn’t do exactly what i wanted, so i made a couple of tweaks. I changed the filter so the messages were added to the profile only, not the member header meta. I also made the statement into elseif, with an array, so it would do what i needed it to, ie show up only if both fields were empty. Here’s my code. It is probably a bit messy, but it does the trick:
function bpfr_my_message_on_profile () { if ( bp_is_my_profile()) : if ( !$data = bp_get_profile_field_data( 'field=About' ) ) : echo '<p class="enter-info">Please tell the community a little bit about yourself by filling out the form on the edit tab above.</p>'; elseif ( !$data = bp_get_profile_field_data(array( field=>'vimeo',field=>'youtube') ) ) : echo '<p class="enter-info">There is nothing here! Spruce up your profile by adding content via the edit tab above.</p>'; endif; endif; } add_filter( 'bp_before_profile_content', 'bpfr_my_message_on_profile' );Thanks for all your help. You rock!
October 17, 2013 at 9:13 pm #173014In reply to: Buddypress x-profile visibility doesn't work
shanebp
ModeratorVisibility checks are not done when profile data is retrieved ‘outside’ BP_XProfile_Group.
You can use bp_xprofile_get_hidden_fields_for_user() to do your own check.
It is reasonable to expect bp_member_profile_data() to include an argument re visibility check.
So it’s not a bug, but you can create an enhancement request ticket on trac.
October 17, 2013 at 5:06 pm #173005In reply to: Buddypress x-profile visibility doesn't work
trinzia
ParticipantSame issue (details below)
In this file {themename}\members\single\member-header.php, is the following code:
<?php /*** * If you'd like to show specific profile fields here use: * bp_member_profile_data( 'field=About Me' ); -- Pass the name of the field */ do_action( 'bp_profile_header_meta' ); ?>I have some custom profile fields, so I replaced the ‘do_action’ with these:
<h3>About Me<h3> <?php bp_member_profile_data( 'field=About' ); ?> <h3>Birthday</h3> <?php bp_member_profile_data( 'field=Birthday' ); ?>When I click on the Edit Profile link, I can change visibility settings, and it appears to save them. BUT the saved settings don’t do anything. In another browser where I’m not logged in at all, I can always see all of the fields listed, no matter which settings were chosen.
Advice?
October 15, 2013 at 11:40 am #172857In reply to: Dynamic profile fields
paddelboot
ParticipantAnother approach might be to “fake” those dynamically created fields. Upon saving them, simply collect all data entered and save it into 1 field. When displaying the profile, extract this data into the according amount of input fields.
October 15, 2013 at 5:29 am #172822bp-help
Participant@shaungreen
I am not sure I am following you but if you deactivated that plugin and a new user can register and activate an account and login successfully then this is not a BP or bbPress issue. It needs to be taken up on that plugins support forum if you insist on using this plugin. Otherwise you may want to look into alternatives! I have used:
https://wordpress.org/plugins/bp-force-profile/
It forces a user to complete the required xprofile fields before they can interact with the site and seem like a good deterrent against spam registrations.October 12, 2013 at 9:43 pm #172749In reply to: 'Survey' Project
@mercime
ParticipantI would like to create a section where people can sign in and answer questions and add their image and then have people see their answers.
@cortttt Sure. Use BuddyPress Extended Profile Fields to highlight the best of your community https://codex.buddypress.org/buddypress-components-and-features/extended-profiles/
Make sure that Extended Profiles is checked in wp-admin Settings > BuddyPress > ComponentsAt the top of the sections would be a running total…total years lost to illness
Check out https://wordpress.org/plugins/buddypress-xprofile-custom-fields-type/ and then customize the plugin to include the running total years lost to illness or use/rename birthday field
October 11, 2013 at 5:48 pm #172702In reply to: Adding classes to profile fields
October 11, 2013 at 5:44 pm #172701In reply to: Adding classes to profile fields
applegateian
ParticipantThanks @henrywright-1 and @shanebp
Works a treat 🙂
October 11, 2013 at 5:30 pm #172700In reply to: Adding classes to profile fields
shanebp
ModeratorDon’t initialize $i as a string if you’re going to use it as an integer.
if ( $items = bp_get_profile_field_data( array( 'field' => 'Budget' ) ) ) { $i = 0; foreach ( $items as $item ) { ?> <div id="size-<?php echo ++$i; ?>"> <?php echo $item; ?> </div> <?php } }October 11, 2013 at 5:16 pm #172696In reply to: Adding classes to profile fields
Henry
MemberAh I see what you’re trying to do.
$i = '1'; if ( $items = bp_get_profile_field_data( array( 'field' => 'Budget' ) ) ) { foreach ( $items as $item ) { ?> <div id="<?php echo 'size-' . $i; ?>"> <?php echo $item; ?> </div> <?php $i++; ?> <?php } }October 11, 2013 at 5:01 pm #172692In reply to: Adding classes to profile fields
applegateian
ParticipantHmm ok thanks @henrywright-1
On the front end I get:
item-1 £500k-£2m
item-2 £2m+The HTML generated is –
<div id="size500"> item-1 £500k-£2m </div> <div id="size500"> item-2 £2m+ </div>How can I make those divs unique?
October 11, 2013 at 4:49 pm #172691In reply to: Adding classes to profile fields
Henry
MemberA unique ID is easy enough, just use the loop to output a unique value. e.g.
$i = '1'; if ( $items = bp_get_profile_field_data( array( 'field' => 'Budget' ) ) ) { foreach ( $items as $item ) { ?> <!-- put what you want here --> <?php echo 'item-' . $i; ?> <?php echo $item; ?> <?php $i++; ?> <!-- put what you want here --> <?php } }October 11, 2013 at 4:43 pm #172690In reply to: Adding classes to profile fields
applegateian
ParticipantQuick question @henrywright-1 – any way to give each of those that are spat out a unique id?
Or do they have to have the same HTML around them?
Ideally, each of the items are wrapped different id – e.g.
<div id="size500">£500K</div>October 11, 2013 at 4:40 pm #172688In reply to: Adding classes to profile fields
applegateian
Participant@henrywright-1 it’s added in /wp-admin/users.php?page=bp-profile-setup – Profile Fields under the Users menu in WP Admin.
Your code works, thanks..!
So I can add html into those spaces, and each item is now separated by html…I think that should do it. Thanks so much for the support Team Buddypress 🙂
October 11, 2013 at 4:35 pm #172687In reply to: Adding classes to profile fields
Henry
MemberIs budget a field that you’ve set up under WP Admin > Profile Fields? and is it of type ‘checkbox’? also are you displaying the values on the user’s profile page? if yes to all of these then this should work:
if ( $items = bp_get_profile_field_data( array( 'field' => 'Budget' ) ) ) { foreach ( $items as $item ) { ?> <!-- put what you want here --> <?php echo $item; ?> <!-- put what you want here --> <?php } }Note: I’ve amended the code so you can insert HTML a bit easier
October 11, 2013 at 4:24 pm #172685In reply to: Adding classes to profile fields
applegateian
ParticipantThanks for the idea.
Pasting that in (exactly as it is) doesn’t return anything for Budget.
How do I add the HTML I want into:
// put whatever you want hereCheers
Ian
October 11, 2013 at 4:14 pm #172683In reply to: Adding classes to profile fields
Henry
MemberHi @applegateian – I think the problem might be the snippet you’re using to output the data string.
try doing something like this:
if ( $items = bp_get_member_profile_data( array( 'field' => 'Budget' ) ) ) { foreach ( $items as $item ) { // put whatever you want here echo $item; // put what you want here } }Note: I haven’t tested.
October 11, 2013 at 1:58 pm #172679In reply to: Adding classes to profile fields
applegateian
ParticipantNot sure it’s a custom hack…
In WordPress admin, I go to Profile Fields
Then, I have three profile groups in there. The third one is where this budget field sits.
It’s only available to certain user types, which is why it’s in a separate profile group.
However, as far as I know @bphelp – none of this is custom or a hack, this is standard BP functionality? Then using this snippet to show the output on the front end:
<div id="profileProjectSize"> <?php $data=bp_get_member_profile_data(array('field'=>'Budget')); echo $data; ?> </div>October 11, 2013 at 1:53 pm #172678In reply to: Adding classes to profile fields
bp-help
Participant@applegateian
Maybe I am missing something here! Did you add those fields in the dashboard, or was it some custom hack?October 11, 2013 at 1:50 pm #172677In reply to: Adding classes to profile fields
applegateian
ParticipantThat’s what is strange @bphelp – when I inspect element in Chrome, there are simply no tags around the checkboxes on view profile:
October 11, 2013 at 1:47 pm #172676In reply to: Adding classes to profile fields
bp-help
Participant@applegateian
If your on the view profile page and you are inspecting with dev tools you should see a tr class with the field_ID followed by td class label and td class data. You should be able to use those to your advantage. -
AuthorSearch Results