Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'profile fields'

Viewing 25 results - 1,376 through 1,400 (of 3,594 total)
  • Author
    Search Results
  • #174141
    @mercime
    Participant

    @paralys there’s no plugin which would implement the synchronization of the BP xProfile fields and the WP User Profiles in the backend. Either you need to hire a developer to create this plugin for you, create it yourself or wait for someone to create one and release it to the public.

    #174105
    danbp
    Participant

    Hi @samgeppi108,

    wow what a video you did for such a common issue. PBCAK ! Sorry to say that, this IS working but you haven’t completely set up the right component (profile).

    Now the good news. Take a breath man, you’re saved ! In 5 mn you can start your community 😀

    Connect to the WP admin as super-admin. Click on Users on the left col, and select Profile configuration from the sub-menu.

    This will open a window where you have by default only one group of fields named BASE. This group is the one showed by default on the register page, so new user can enter some information such as their name, and anything else you want to have in that place.

    If you prefer to let them complete their profile skills after registering, you should create a second group of fields on the previous mentionned setting page. You cal add as many groups you want, with as many fields and type of fields you need.

    Once done and saved, connect you as a normal user and go to the profile profile setting tab. You will see 2 tabs. Name and X, you just created. You can fill in the fields and save.
    If you go on the profile tab, anything will be on !

    Read here the documentation:
    https://codex.buddypress.org/getting-started/configure-components/ Users>profile fields

    Keep the Codex in mind, because it’s the first place to go before coming up here to claim “it doesn’t work !” 😉 It does !

    #173915
    Henry
    Member

    The way to do this would be to wrap info fields in conditional statements like this

    if member type is X then
        // display info field
    #173692
    Mohammad Raheel
    Participant

    hi thanks @shanebp i am really biggner for my self i did what you said but matter is when i tried but never got result kindly check my code tell me i already spend 4 days.

    <?php
    global $wpdb, $bp;
    $result = $wpdb->get_results(“SELECT user_id FROM wp_bp_xprofile_data WHERE value = ‘$_POST[language]’ OR value = ‘$_POST[budget]’ OR value = ‘$_POST[style]’LIMIT 0 , 30”);
    print_r($result);
    $result = array();
    //$values = maybe_unserialize($result);
    //echo var_dump( maybe_unserialize( $result ) );
    //$values = $result;
    //$value = bp_unserialize_profile_user_id( $values );
    //$values = implode( “, “, $value);
    //echo $values;
    //print_r($values);
    //so you have to ‘manually’ unserialize them
    foreach($result as $user_id=>%d)
    {
    echo “Key=” . $user_id . “, Value=” . %d;
    echo “<br>”;
    }
    //$values_str = implode( ‘,’, $getty );
    //print_r($values_str);

    //)

    echo $get_these_members;
    $get_these_members = ‘include=’ . substr($get_these_members, 0, -1);

    ?>

    #173587
    rianhall
    Participant

    The Code from “SOLVED: Limit Members Loop by Profile Fields” seem easy to implement. I added this to my function.php

    // to exclude only defined roles in the Buddypress Members LOOP
    
    function exclude_by_role($exclude_roles) {
    
    $memberArray = array();
    
    if (bp_has_members()) :
    while (bp_members()) : bp_the_member();
    $user = new WP_User( bp_get_member_user_id() );
    $user_role = $user->roles[0];
    foreach ($exclude_roles as $exclude_role) {
    if ($exclude_role==$user_role) {
    array_push($memberArray, $user->ID);
    break;
    }
    }
    endwhile;
    endif;
    
    $theExcludeString=implode(",",$memberArray);
    
    return $theExcludeString;
    }

    I then added this to my member-loop.php

    <? $excluded_roles = array ('administrator', 'author', 'subscriber'); // this can be any roles you have set up
    	if (bp_has_members( 'exclude=' . exclude_by_role($excluded_roles) . '&' . bp_ajax_querystring( 'members' ) ) ) : ?>
    

    Unfortunately, it still is not excluding any of the specified roles. I took a look at the second example, but not sure where to put the code. Any suggestions?

    #173578
    Benoit Hennegrave
    Participant
    #173445
    auch07
    Participant

    Sorry code I posted back was outdated.

    <?php
    $bpProfileField = xprofile_get_field_data( 'Services Required', $user_id_from_email, $multi_format = 'comma' );
    if ( empty ( $bpProfileField) ):
    ?>
    <div class="profile_fields"><b>Services Provided:</b> <span><?php bp_member_profile_data( 'field=Services Provided' , $user_id_from_email ) ?></span></div>
    <?php else: ?>
    <p><b>Services Required:</b> <?php echo $bpProfileField; ?></p>
    <?php endif; ?>
    <br>
    #173442
    auch07
    Participant

    Thanks for the reply Shane. My apologies for the delay in responding myself but I just got back on working on this issue this weekend here.

    One field I am working on right now involves displaying either Services Required or Services Provided as you can see in the code below. Depending on the type of user you are will determine which field you have filled in thus which field will display on the user profile. Unfortunately my PHP is pretty weak thus the foreach loop you mentioned has me scratching my head. The code below does what I want with the exception of it displaying horizontally instead of vertically. I am hoping you would be able to give me some detailed direction in what way to go for the PHP challenged guy that I am lol.

    <?php
    $bpProfileField = xprofile_get_field_data( 'Services Required', $user_id_from_email, $multi_format = 'comma' );
    if ( empty ( $bpProfileField) ):
    ?>
    <div class="profile_fields"><b>Services Provided:</b> <span><?php bp_profile_field_data( 'field=Services Provided' );?></span></div>
    <?php else: ?>
    <p><b>Services Required:</b> <?php echo $bpProfileField; ?></p>
    <?php endif; ?>
    #173441
    jaxdestroyer
    Participant

    The only way I know how to hide it currently is through css. BP will give your sub group a class name based on what you sub group is called. For example, my sub group is About Me. The class name is about-me.

    To make sure you are getting the right class name I suggest you use Firefox firebug or chromes built in element inspector. You should also see another class name of bg-widget when using either tool.

    To make the css specific for that particular snippet all you need to do in your Themes or BuddyPress child themes style.css

    .bp-widget.about-me{
        display: none;
    }

    This will hide the whole sub group when someone is viewing the profile. It makes sure it has both class names before making it no longer display so the user can still see it when editing their profile.

    If you want to only get rid of specific rows that contain this information then BP still has you covered. They also make a class based on your input field name. Using Facebook as an example again the class is field_facebook. To be as specific as possible without going too overboard in your Themes or BuddyPress child themes style.css put in

    table.profile-fields tr.field_facebook{
       display:none;
    }

    This will only get rid of the one row, however, there is a caveat. If you alternate colors between rows it will still count the hidden field. I suggest that if you are going to use this make sure that the fields are at the bottom of the group so they no longer break flowof alternating colors.

    If you want to do multiple fields just seperate them via a comma as shown below

    table.profile-fields tr.field_facebook,
    table.profile-fields tr.field_twiitter{
       display:none;
    }
    #173437
    noizeburger
    Participant

    Now, that your code makes it possible to show icons in my profile header, is there a way to hide the profile group that helds my input fields? Main reason is, that my youtube and twitter links won’t show in the fieldgroup as a result of the use of a snippet to use oembed-code in my profiles.

    #173380
    Marc
    Participant

    When you update an profile field, it is first deleted, then re-created. I’m sure of that, after looking the BuddyPress code.

    Why the BuddyPress works like this ? How to prevent this issue, to keep the same ID when the field is updated ?

    I just realise that I didn’t say Hi, to the community! Mistake fixed! I’m sorry.

    #173322
    Hugo Ashmore
    Participant

    If you want a paid option you could check out:

    BuddyNotes

    #173319
    Robert Trevellyan
    Participant

    I 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.

    #173277
    martinbeaulne
    Participant

    Well 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. »

    🙂

    #173124
    ugcheleuce
    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)

    #173114
    Yukon 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!

    #173014
    shanebp
    Moderator

    Visibility 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.

    #173005
    trinzia
    Participant

    Same 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?

    #172857

    In reply to: Dynamic profile fields

    paddelboot
    Participant

    Another 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.

    bp-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.

    #172749

    In reply to: 'Survey' Project

    @mercime
    Participant

    I 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 > Components

    At 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

    #172702
    Henry
    Member

    @shanebp good shout!

    #172701
    applegateian
    Participant

    Thanks @henrywright-1 and @shanebp

    Works a treat 🙂

    #172700
    shanebp
    Moderator

    @henrywright-1

    Don’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 }
    }
    #172696
    Henry
    Member

    Ah 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 }
    }
Viewing 25 results - 1,376 through 1,400 (of 3,594 total)
Skip to toolbar