Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'profile fields'

Viewing 25 results - 1,526 through 1,550 (of 5,755 total)
  • Author
    Search Results
  • #244510
    douglaslovin83
    Participant

    My profile fields are jumbled. Latest version of WordPress & Buddypress. No customizations. No plugins that modify visuals.

    Using extended profiles.

    I have tried about 4 themes.. they are look jumbled with the same rounded looking boxes and such.

    Current theme = latest version of BuddyBoss.

    http://peaceimout.com/members/dlovin123/

    Thanks for the help!

    #244455
    JECPFG
    Participant

    Full disclaimer: I’m not much of a programmer; more of a front end guy who gets by on the back end with trial and error. This one is above my skill level, however.

    I am using BuddyPress’ Profile Fields in conjunction with WPMUDev’s Membership 2 Pro plugin. I’ve created some new Profile Fields that I also want to be displayed on a user’s account page. I’ve found the file that needs to be updated; currently, the code displaying the default membership attributes looks like this:

    public function prepare_fields() {
    $fields = array(
    ‘personal_info’ => array(
    ‘first_name’ => __( ‘First name’, MS_TEXT_DOMAIN ),
    ‘last_name’ => __( ‘Last name’, MS_TEXT_DOMAIN ),
    ‘username’ => __( ‘Username’, MS_TEXT_DOMAIN ),
    ’email’ => __( ‘Email’, MS_TEXT_DOMAIN ),
    )
    );

    When I add new Profile Fields in BuddyPress, they show up as fields that users can edit within their profile but they don’t automatically display in this array. I can see how to add new fields to the list:

    ‘value_of_XXXX’ => __( ‘XXXX’, MS_TEXT_DOMAIN ),

    I just don’t know how to find the value of XXXX once I have created that field within BuddyPress. I have posted the same question in the WPMUDev forum but so far don’t have an answer.

    I am using WP 4.2.5 and BuddyPress 2.3.3. I am currently developing locally so I can’t send a link.

    Thanks in advance.

    lfeddern
    Participant

    Hi,

    I want to display the events that a buddypress user has submitted on their profile page under their profile fields.

    I tried to make a custom shortcode based on some stuff found in the forums but it displayed all events, here is the code for that

    function custom_shortcode(){
                 $user_id = get_the_author_meta( 'ID' ); //returns id of user profile
                 return do_shortcode( '[eo_events author='.$user_id.']' ); }
    add_shortcode( 'eo_custom_shortcode', 'custom_shortcode' );

    I then displayed the shortcode in profile-loop.php like this:

    /** This action is documented in bp-templates/bp-legacy/buddypress/members/single/profile/profile-wp.php */
    do_action( 'bp_after_profile_loop_content' ); ?>
    <h5 class="event_profile_title_random"> Upcoming Events & Deadlines... </h5>
    <div id="event_profileinfo_random">  [eo_custom_shortcode] </div>

    This works when I specify a fixed know user id but is not working dynamically. I guess get_the_author_meta() is being used wrong. Do I need to use it inside profile-loop.php instead? I have tried this with no luck. COuld someone help me out? I am a php begineer trying to learn! thanks so much for your help!

    #244377
    Maddish
    Participant

    I’m trying to override the default /_inc/global.js file with a custom one, but after deregister the original one, every post_update is run twice, so each post is duplicated.

    I’m using

    Wordpress version 4.3
    buddypress version 2.3.3
    typal-makewp005 Chld theme

    In bp-custom.php:

    
    function deregister_bp_scripts(){
    
    wp_deregister_script( 'dtheme-ajax-js');
    wp_dequeue_script( 'dtheme-ajax-js');
    }
    add_action('wp_enqueue_scripts', 'deregister_bp_scripts');
    
    function mytheme_enqueue_scripts() {
    
    			$params = array(
    					'my_favs'           => __( 'My Favorites', 'buddypress' ),
    					'accepted'          => __( 'Accepted', 'buddypress' ),
    					'rejected'          => __( 'Rejected', 'buddypress' ),
    					'show_all_comments' => __( 'Show all comments for this thread', 'buddypress' ),
    					'show_x_comments'   => __( 'Show all %d comments', 'buddypress' ),
    					'show_all'          => __( 'Show all', 'buddypress' ),
    					'comments'          => __( 'comments', 'buddypress' ),
    					'close'             => __( 'Close', 'buddypress' ),
    					'view'              => __( 'View', 'buddypress' ),
    					'mark_as_fav'       => __( 'Favorite', 'buddypress' ),
    					'remove_fav'        => __( 'Remove Favorite', 'buddypress' ),
    					'unsaved_changes'   => __( 'Your profile has unsaved changes. If you leave the page, the changes will be lost.', 'buddypress' ),
    			);
    wp_enqueue_script( 'custom_dtheme-ajax-js', get_stylesheet_directory_uri() . '/js/global.js', array( 'jquery' ) );
    	wp_localize_script( 'custom_dtheme-ajax-js', 'BP_DTheme', $params );
    }
    
    add_action('wp_enqueue_scripts', 'mytheme_enqueue_scripts');
    

    I already tried to set different priority , to move this code to functions.php instead of bp-custom.php, to use the twentyfifteen theme, to make a child of the bp-default theme, but no way…
    What I need to do is to add some custom fileds to the activity form to create a facebook-like link-preview.

    I followed this post in which they say you have to add to global.js the new fields’ values, but I don’t want to change the global.js file directly (for next updates)

    https://buddypress.org/support/topic/adding-a-second-element-for-posting-with-an-activity/

    Does anybody know what am I doing wrong?

    Dreitausend
    Participant

    Hi there,
    after a whole day googleing and trial and errors I guess I have to ask to accomplish this:
    I need to display an extended field right next to the name of an attendee in the events manager list.
    In this topic they talk a lot about how to change the attendees.php
    https://wordpress.org/support/topic/plugin-events-manager-display-attendees-in-a-page
    Right now my code is this:

    <?php
    
    /* @var $EM_Event EM_Event */
    $people = array();
    foreach($EM_Event->get_bookings() as $EM_Booking){
            $people[$EM_Booking->person->ID] = $EM_Booking->person;
    		$user_info = get_userdata($referring_user_id);
    }
    ?>
                   
            <ul class="event-attendees">
            <?php foreach($people as $EM_Person): ?>
            <li>
            <?php $user_info = get_userdata($EM_Person->ID);
            echo get_avatar($EM_Person->ID, 50) . " " . $user_info->first_name . " " . $user_info->last_name . " " . " <a href=" . $EM_Person->user_url . "> $EM_Person->user_url </a>  "  ;
            ?></li>
            <?php endforeach; ?>
    </ul>
    

    So I already get some good information. But I just cannot figure out, how to get the Location of the Person next to their Name. The Location is an extended field.

    Does anyone can help me with this?

    #244209
    rezon8dev
    Participant

    OK yup that does it. A question and one more request. @danbp I really do appreciate this, you’re helping me learn some basic stuff and some more detail on BP in general!

    Question, why does bp_member_profile_data pull in the array data but not print the classes?

    Request, I need the fields returned from musical genre to all be on one line and they should be if all the values of the array are returned wrapped in the class rather than than each of the values being wrapped in the class, I just can’t figure out the syntax to make that happen…

    Thanks a million!

    #244205

    In reply to: Add a Text Area Field

    danbp
    Participant

    hi,
    Dashboard > Users > Profile Fields > Add new field

    Name []
    Description []
    Type > select Multi-line Text Area

    User Extended Profiles

    #244201
    danbp
    Participant

    Ok, i see… multiselectbox/checkbox values are returned in a array.

    if ( $data = bp_member_profile_data( 'field=Musical Genre' ) )....endif; thing cannot work, because we have to fetch the whole array of values, not only one.
    Give this a try:

    function custom_display_xprofile_fields() {
    
    if ( $data = bp_get_profile_field_data( 'field=Artist Name' ) ) : 
    	echo '<div class="artist"><h4 class="user-nicename">'. xprofile_get_field_data( 'Artist Name', bp_displayed_user_id() ) .'</h4></div>';
    endif;
    
    if ( $datas = bp_get_profile_field_data( array( 'field' => 'Musical Genre' ) ) ) :
        foreach ( $datas as $data ) { 
           echo '<div class="genre">'. $data .'</div>';
        }
    endif;
    
    if ( $data = bp_get_profile_field_data( 'field=Location' ) ) : 
    	echo '<div class="location">'. xprofile_get_field_data( 'Location', bp_displayed_user_id() ) .'</div>';
    endif;
    }
    add_action( 'bp_profile_header_meta' , 'custom_display_xprofile_fields' );
    #244198
    rezon8dev
    Participant

    Changing the function to this:

    /*
    * Add xprofile fields to member header
    */
    function custom_display_xprofile_fields() {
    
    if ( $data = bp_get_profile_field_data( 'field=Artist Name' ) ) : 
    	echo '<div class="mdetcenter"><div class="artist"><h4 class="user-nicename">'. xprofile_get_field_data( 'Artist Name', bp_displayed_user_id() ) .'</h4></div></div>';
    endif;
    
    if ( $data = bp_member_profile_data( 'field=Musical Genre' ) ) : 
    
    	echo '<div class="mdetcenter"><div class="genre">'. xprofile_get_field_data( 'Musical Genre', bp_displayed_user_id() ) .'</div></div>';
    
    endif;
    
    if ( $data = bp_get_profile_field_data( 'field=Location' ) ) : 
        echo '<br>';
    	echo '<div class="mdetcenter"><div class="location">'. xprofile_get_field_data( 'Location', bp_displayed_user_id() ) .'</div></div>';
    endif;

    Gives me this HTML output:

    	<div class="mdetcenter"><div class="artist"><h4 class="user-nicename">No Way Back</h4></div></div>
    Alternative, Blues, Country, Electronic
    <br><div class="mdetcenter"><div class="location">Detroit, MI. US</div></div>
    #244190
    rezon8dev
    Participant

    OK this mostly worked and I do not know how to fix the portion that is not working. I’ve entered this:

    /*
    * Add xprofile fields to member header
    */
    function custom_display_xprofile_fields() {
    
    if ( $data = bp_get_profile_field_data( 'field=Artist Name' ) ) : 
    	echo '<div class="mdetcenter artist"><h4 class="user-nicename">'. xprofile_get_field_data( 'Artist Name', bp_displayed_user_id() ) .'</div>';
    endif;
    
    if ( $data = bp_get_profile_field_data( 'field=Musical Genre' ) ) : 
    	echo '<div class="mdetcenter genre">'. xprofile_get_field_data( 'Musical Genre', bp_displayed_user_id() ) .'</div>';
    endif;
    
    if ( $data = bp_get_profile_field_data( 'field=Location' ) ) : 
    	echo '<div class="mdetcenter location">'. xprofile_get_field_data( 'Location', bp_displayed_user_id() ) .'</div>';
    endif;
    
    }
    add_action( 'bp_profile_header_meta' , 'custom_display_xprofile_fields' );
    add_filter( 'bp_before_member_header_meta', 'custom_display_xprofile_fields' );
    

    The Musical Genre field is a multi-select field type and the echo is printing “array” rather than the array of selected values in this field…

    @danbp can you help here?

    #244188
    danbp
    Participant

    How else would I override the buddypress file unless it was in my child theme with the same name?

    You should NOT override core files. The only files you alter from child theme are template files.

    To alter core functions, you use custom functions and add them via filter hooks, preferably added to bp-custom.php – so you won’t loose your work at next update.

    member-profile.php doesn’t exist in BuddyPress.

    Codex is your friend !

    Theme Compatibility & Template Files

    Displaying Extended Profile Fields on Member Profiles

    … and forum search too. 😉

    #244187
    Kasper Kloster
    Participant

    Hi,
    I’m struckling a bit over here..
    I’m trying to let visitors filter members by profile fields.

    At the registrion form users can choose genre from checkbox:
    Rock, Hip-hop, Jazz, Indie etc. – User can choose as many as they want.

    At the members-loop / buddypress-index, I want visitors to be able to filter from these values.

    So if they click on “Jazz” and “Rock”
    All users that have the chosen values, will appear.

    But I can’t get “Genres” / Profile-fields out..

    Can somebody help me in the right direction?
    Thanks.

    #244184
    danbp
    Participant

    Is your child theme working correctly with Kleo ?
    Is the altered member-header.php file in your child-theme ?
    Do you really use a file called member-profile.php, as stated in your first topic ? Bad !

    Remove all your custom snippets and revert back to original BP template fisrt, then try this in bp-custom.php:

    function custom_display_xprofile_fields() {
    
    echo 'Custom display fields';
    echo '<ul>';
    if ( $data = bp_get_profile_field_data( 'field=Artist Name' ) ) : 
    	echo '<li>'. xprofile_get_field_data( 'Artist Name', bp_displayed_user_id() ) .'</li>';
    endif;
    
    if ( $data = bp_get_profile_field_data( 'field=Musical Genre' ) ) : 
    	echo '<li>'. xprofile_get_field_data( 'Musical Genre', bp_displayed_user_id() ) .'</li>';
    endif;
    
    if ( $data = bp_get_profile_field_data( 'field=Location' ) ) : 
    	echo '<li>'. xprofile_get_field_data( 'Location', bp_displayed_user_id() ) .'</li>';
    endif;
    
    echo '</ul>';
    }
    add_action( 'bp_profile_header_meta' , 'custom_display_xprofile_fields' );
    add_filter( 'bp_before_member_header_meta', 'custom_display_xprofile_fields' );
    #244181
    rezon8dev
    Participant

    Has anyone seen the duplicating profile fields issue happen when displaying xprofile fields in the member header before?

    #244175
    rezon8dev
    Participant

    OK will do @shanebp.
    Can anyone give me a hand and let me know if this code looks proper? Even if I remove this from my child theme functions.php file and add the following to my member-header.php file:

    
    bp_member_profile_data( 'field=Artist Name' );
    bp_member_profile_data( 'field=Musical Genre' );
    bp_member_profile_data( 'field=Location' );

    I get similar results; the custom fields being displayed multiple times, oddly when I add the above to the member-header.php I get the Artist name field showing 4 times in a row rather than repeating sets of fields 1-4 and then fields 1-4 again duplicating when the code in a previous post above is in the functions file…

    #244172
    rezon8dev
    Participant

    @shanebp, I’ve tracked it down but still cant figure out what is wrong. This was all working until I upgraded to the latest bp… It is in my functions file for my theme, it is this function to place 3 xprofile fields in the member header area:

    /** 
     *  Add extended profile fields to the member profile header area  
    */
    
    add_action( 'bp_profile_header_meta' , 'display_user_xprofile_fields' );
    function display_user_xprofile_fields() {
    
     	$artistname = bp_get_member_profile_data('field=Artist Name');
        $musicalgenre = bp_get_member_profile_data('field=Musical Genre');
        $location = bp_get_member_profile_data('field=Location');
    
        if ($artistname || $musicalgenre || $location) {
    
            echo '<div class="mdetcenter artist"><h4 class="user-nicename">'. '' . $artistname . '</h4></div>';
            echo '<div class="mdetcenter genre">'. '' . $musicalgenre . '</div>';
            echo '<div class="mdetcenter location">'. '' . $location . '</div>';
        }
    }

    Can you see what is wrong? This is driving me crazy…

    #244168
    shanebp
    Moderator

    >they now see their profile fields displayed 2 times.

    Rhetorical questions:
    As 2 sets or double entries?
    Does the issue remain if you remove the 3rd shortcode?

    It should be easy to narrow it down by following the clues given when you explore those questions.

    rezon8dev
    Participant

    Hello,
    I have a new issue which has popped up after updating to the newest BP 2.3.3. I have altered the member/ profile-loop.php and when a user is logged in they now see their profile fields displayed 2 times. There are 3 shortcodes echo’ed on this page and the 2 from rtmedia are the only items on the page which are not displaying twice, the 3rs (events manager) is also displaying 2x just as the profile fields and xprofile fields are. I’m assuming it has to do with the php I’ve entered but I cannot for the life of me find the issue. Any help would be great, as this issues is only visible when a user is logged in a site link probably wont help much. Everything is up to date and running on WPE/HHVM with php 5.5.
    Here is the contents on my member-profile.php

    <?php $user_ID = bp_displayed_user_id(); ?>
    <?php do_action( 'bp_before_profile_loop_content' ); ?>
    
    <?php if ( bp_has_profile() ) : ?>
    
    	<?php while ( bp_profile_groups() ) : bp_the_profile_group(); ?>
    
    		<?php if ( bp_profile_group_has_fields() ) : ?>
    
    			<?php do_action( 'bp_before_profile_field_content' ); ?>
    
    			<div class="bp-widget <?php bp_the_profile_group_slug(); ?>">
    
    		
    				<div class="hr-title hr-full hr-double"><abbr><?php bp_the_profile_group_name(); ?></abbr></div>
    				<div class="gap-10"></div>
    		
    					<?php while ( bp_profile_fields() ) : bp_the_profile_field(); ?>
    
    						<?php if ( bp_field_has_data() ) : ?>
                  
                  
                  
                  <dl<?php bp_field_css_class('dl-horizontal'); ?>>
                    <dt><?php bp_the_profile_field_name(); ?></dt>
                    <dd><?php bp_the_profile_field_value(); ?></dd>
                  </dl>
                  
    
    						<?php endif; ?>
    
    						<?php do_action( 'bp_profile_field_item' ); ?>
    
    					<?php endwhile; ?>
    
                            
                            
                            
    			</div><!-- end bp-widget -->
    
    			<?php do_action( 'bp_after_profile_field_content' ); ?>
    
    		<?php endif; ?>
    
    	<?php endwhile; ?>
    
    	<?php do_action( 'bp_profile_field_buttons' ); ?>
    
    <?php endif; ?>
    
    <?php do_action( 'bp_after_profile_loop_content' ); ?>
    
    <?php if(bp_is_my_profile() ) 
    {
     ?>
    
    <?php if(pmpro_hasMembershipLevel(array(1,2,3)))
    {
     ?>
    
    <div class="bp-widget">
    	<div class="epkpmgallery">
    		
    		<div class="hr-title hr-full hr-double"><abbr>Promotional Media</abbr></div>
    						<div class="gap-10"></div>
    	
    		<div class="hr-title hr-full"><abbr>Pics</abbr></div>
    
    	</div>
    
    	<div class="epkpgallery">
    
    <?php echo do_shortcode( '[rtmedia_gallery media_type="photo" global="false" attribute_slug="epk-photo" term_slug="current-press-photo" per_page="20" context="profile" media_author="' .$user_ID. '" media_title="true" lightbox="false"]' ); ?>
    
        </div>
    
    		
    		<div class="hr-title hr-full"><abbr>Songs</abbr></div>
        
       
    
        <div class="epkagallery">
    
    <?php echo do_shortcode( '[rtmedia_gallery media_type="music" global="false" attribute_slug="epk-album" term_slug="current-album" per_page="40" context="profile" media_author="' .$user_ID. '" media_title="true" lightbox="false"]' ); ?>
    
        </div>
    </div>
    
    <div class="bp-widget">
    	<div class="epkggallery">
    		
    		<div class="hr-title hr-full hr-double"><abbr>Upcoming Gigs</abbr></div>
    						<div class="gap-10"></div>
    <a id="epkanc"></a>
    
    <?php echo do_shortcode( '[events_list owner="' .$user_ID. '"]' ); ?>
        </div>
    </div>
    
    <hr>
    
    <div class="epkgalleryprint">
    				<section class="container-wrap main-color" style=""><div class="section-container container"><div class="row">
    	<div class="col-sm-12 wpb_column column_container">
    		<div class="wpb_wrapper">
    				<div class="vc_btn3-container vc_btn3-center"><a class="vc_general vc_btn3 vc_btn3-size-lg vc_btn3-shape-rounded vc_btn3-style-outline vc_btn3-block vc_btn3-icon-left vc_btn3-color-success" href="javascript:window.print()" title="Print Your Press Kit" target="_blank"><i class="vc_btn3-icon fa fa-file-pdf-o"></i>Print Press Kit</a></div>
    		</div> 
    	</div> 
    </div></div></section><!-- end section -->
    </div>
    
    <?php 
    }
     ?>
    <?php 
    }
     ?>
    #244152
    modemlooper
    Moderator

    the column on the right are added profile fields, you can remove the field from the admin

    more info on profile fields https://codex.buddypress.org/administrator-guide/extended-profiles/

    #244138
    nilje
    Participant

    No, there is no other plugin which could cause it
    I’ve made a screenshot
    http://www.danielaholl.de/Apublic/Unbenannt-1.jpg
    I think the left side is the WordPress registration and right the one for buddypress.. there are my custom profile fields too.

    #244123
    danbp
    Participant

    Take a look at DB tables related to xprofile:
    _bp_xprofile_data
    _bp_xprofile_fields
    _bp_xprofile_groups
    _bp_xprofile_meta

    If users entered data like https://twitter.com/comandovictor use a mysql command to wipe out https://twitter.com/ via phpMyAdmin.

    UPDATE table_name SET col_name = REPLACE(col_name, 'old_value', 'new_value');

    wp_ is default table prefix, change it if you use another prefix.
    UPDATE wp_bp_xprofile_data SET col_name = REPLACE(value, 'https://twitter.com/', '');

    That’s the fastest method. Don’t forget to backup the table BEFORE doing this.

    Changing the field type can be done from the xprofile admin.

    #244118

    In reply to: Profile Signature

    danbp
    Participant

    It is standard! At least if you use xprofile component to let your users enter their signature.

    1) Create a new field. Call it Signature and give it a textarea type.
    2) Once this field is edited by a user, during registration or later, the signature appears on his profile.

    3) if you want this field somewhere else, for ex on the profile header, you simply write a function to call this field and hook it into the template you want.

    Ie. Add this to child theme functions.php or bp-custom.php

    function my_signature() {	
    if ( bp_is_active( 'xprofile' ) )
       if ( $signature = xprofile_get_field_data( 'Signature', bp_get_member_user_id() ) ) : // field name; case sensitive				
          echo $signature;	
       endif;
    }
    add_filter( 'bp_before_member_header_meta', 'my_signature' );

    Or to use Henry’s advice
    add_filter( 'bp_after_profile_content', 'my_signature' );

    Reference

    User Extended Profiles

    Displaying Extended Profile Fields on Member Profiles

    Youngtive
    Participant

    Hi everybody,

    I am having a problem with the profile fields in buddypress. After searching through the forum I found out that this line of js:

    
    <script>
    jQuery(document).ready(function($){
    $('#field_156').attr('minlength', '9'); 
    $('#field_156').attr('maxlength', '14');
    });
    </script>
    

    was needed to give a maxlength of characters to a profile field (I included the minlength myself). I added this line of code underneath at the footer.php just above the </body>. And this is working excellent in Chrome! However this isn’t working on either Firefox or the new Edge browser from Microsoft. I am kinda stuck at this point. Wondering if any of you guys can help me 🙂

    Sorry for my bad english if thats the case!

    Kind Regards,

    Youngtive

    #244047
    chriotte
    Participant

    Hi, I’m creating a page where I want to list all members and then let the users filter them by for example location by checking checkboxes.
    I created a quick mockup in photoshop of what I’m creating.
    mockup

    I’m working in the members-loop.php and my code works backend, my problem is to connect to front-end. Firstly I have an empty array of locations I want to filter by $locationValg. If I manually add a location, let’s say Oslo (The capital of Norway) to the Array, the loop spits out users wich have set the location to Oslo. So the code itself works. Prior to starting, I heard that you could connect front-end to the back-end by using Ajax and jQuery.
    After hours of trying and googling I’m not able to figure this out. Right now I’m just debugging with a button to echo out some words from a PHP function to see if it works, but ultimately I want the users to check the box “Oslo”, and The script add Oslo to my $locationValg array and rerun the script.

    This is my members-loop (a bit messy right now after hours of testing). The code is semi-Norwegian and English, so sorry for the confusion.

    Any advice for a PHP-Wordpress-Buddypress starter? 🙂

    <?php
    
    /**
     * BuddyPress - Members Loop
     *
     * Querystring is set via AJAX in _inc/ajax.php - bp_legacy_theme_object_filter()
     *
     * @package BuddyPress
     * @subpackage bp-legacy
     */
    
    ?>
    
    <?php
    
    $locationValg = array();
    setVerdier();
    
    if(isset($_POST['action']) && !empty($_POST['action'])) {
        $action = $_POST['action'];
         switch($action) {
            case 'test' : setEcho();break;
            case 'post' : setEcho();break;
    
            // ...etc...
        }
    setVerdier();
     }
    
    function setEcho(){
    	echo"trykket på knapp";
    }
    
    function setVerdier(){
    
    global $locationValg;
    
    /*$locationValg[] = "Oslo";
    $locationValg[] = "Telemark";
    $locationValg[] = "sd";
    echo $locationValg[1]; */
    lagListe();
    }
    
    /**
     * Fires before the display of the members loop.
     *
     * @since BuddyPress (1.2.0)
     */
    function lagListe(){ 
    		
    global $locationValg;
    
    do_action( 'bp_before_members_loop' ); ?>
    
    <?php if ( bp_get_current_member_type() ) : ?>
    	<p class="current-member-type"><?php //bp_current_member_type_message() ?></p>
    <?php endif; ?>
    
    <?php if ( bp_has_members( bp_ajax_querystring( 'members' ) ) ) : ?>
    
    	<div id="pag-top" class="pagination">
    
    		<div class="pag-count" id="member-dir-count-top">
    
    			<?php //bp_members_pagination_count(); ?>
    
    		</div>
    		<input type="submit" value="Last side" id="lastsideBtn"/>
    		<div id="sorteringsvalg"> 
    		<h2> Sorter artister</h2>
    		<ul>
    		<label for="oslo">Oslo</label>
    		<li><input type="checkbox" id="oslo" name="Oslo" value="Oslo"/></li>
    		</ul>
    
    		</div>
    		<div class="pagination-links" id="member-dir-pag-top">
    
    			<?php //bp_members_pagination_links(); ?>
    
    		</div>
    
    	</div>
    
    	<?php
    
    	/**
    	 * Fires before the display of the members list.
    	 *
    	 * @since BuddyPress (1.1.0)
    	 */
    	do_action( 'bp_before_directory_members_list' ); ?>
    
    	<ul id="members-list" class="item-list"> 
    
    <?php
    $numbersOfLocationsChecked = count($locationValg);
    
     while ( bp_members() ) : bp_the_member(); ?>
    	
    	<?php //$brukerType = bp_member_profile_data('field=Type');;
    
    //	echo 'brukertype:' . $brukerType;	
    
    $user = new WP_User( bp_get_member_user_id() );
    $userLocation = bp_get_member_profile_data('field=Område'); 
    //dele opp basert på komma
    $ordSomSkalDeles = $userLocation;
    $oppdeltOrd = explode(',', $ordSomSkalDeles);
    $antallOppdelteOrd = count($oppdeltOrd);
    //echo("Lengde" . $numbersOfLocationsChecked);
    //echo "Arrayinnhold: " .  $locationValg[1];
    //echo "Lokasjon fra profil: " . $userLocation;
    
    //This will check if the users hasent cheked anything, and prints all data
    if($numbersOfLocationsChecked == 0){
    	//print alt
    	//I know, this is not good coding with the same lines copy pasted
    if ( $user->roles[0] == 'subscriber' ){ ?>
    		<li <?php bp_member_class(); ?>>
    			<div class="item-avatar">
    			<a href="<?php bp_member_permalink(); ?>"><?php bp_member_avatar('type=full&width=100%&height=180'); ?></a>
    		</div>
    			<div class="item">
    				<div class="item-title">
    					<a href="<?php bp_member_permalink(); ?>"><?php bp_member_name(); ?></a>
    				</div>
    					<div class="item-title">
    					<a href="<?php bp_member_permalink(); ?>"><?php bp_get_member_type($user_id); ?></a>
    				</div>
    				<div class="musikertype">
    					<span><?php bp_member_profile_data('field=Type'); ?></span>
    				</div>
    				<div class="musikerlokasjon">
    					<span><?php bp_member_profile_data('field=Område'); ?></span>
    				</div>
    				<div class="musikerprissjikte">
    					<span><?php bp_member_profile_data('field=Prissjikte'); ?></span>
    				</div>
    
    				<?php
    				/**
    				 * Fires inside the display of a directory member item.
    				 *
    				 * @since BuddyPress (1.1.0)
    				 */
    				do_action( 'bp_directory_members_item' ); ?>
    
    				<?php
    				//bp_member_profile_data('field=Type');
    				 /***
    				  * If you want to show specific profile fields here you can,
    				  * but it'll add an extra query for each member in the loop
    				  * (only one regardless of the number of fields you show):
    				  *
    				  * bp_member_profile_data( 'field=the field name' );
    				  */
    				?>
    			</div>
    
    			<div class="action">
    
    				<?php
    
    				/**
    				 * Fires inside the members action HTML markup to display actions.
    				 *
    				 * @since BuddyPress (1.1.0)
    				 */
    				do_action( 'bp_directory_members_actions' ); ?>
    
    			</div>
    
    			<div class="clear"></div>
    		</li>
    <?php } 
    	//Ferdig med å printe ut alt
    }else{
    	//print kun field med riktig område
    	for($i = 0;$i< $numbersOfLocationsChecked;$i++){
    		for($x = 0;$x < $antallOppdelteOrd;$x++){ 
    		//echo("oppdelte ord før løkke " . $oppdeltOrd[0] );
    		$omrade = str_replace(' ', '', $oppdeltOrd[$x]);
    		//echo("oppdelte ord før løkke område " . $omrade . " SLUTT");
    		$omradeFraValgt = str_replace(' ', '', $locationValg[$i]);	
    		$printet = false;	
    		if($omrade===$omradeFraValgt){
    		//	echo("oppdelte ord fra løkke " . $oppdeltOrd[$x] );
    			//printing only data where the lcoation is selected
    			if ( $user->roles[0] == 'subscriber' ){ ?>
    		<li <?php bp_member_class(); ?>>
    			<div class="item-avatar">
    			<a href="<?php bp_member_permalink(); ?>"><?php bp_member_avatar('type=full&width=100%&height=180'); ?></a>
    		</div>
    			<div class="item">
    				<div class="item-title">
    					<a href="<?php bp_member_permalink(); ?>"><?php bp_member_name(); ?></a>
    				</div>
    					<div class="item-title">
    					<a href="<?php bp_member_permalink(); ?>"><?php bp_get_member_type($user_id); ?></a>
    				</div>
    				<div class="musikertype">
    					<span><?php bp_member_profile_data('field=Type'); ?></span>
    				</div>
    				<div class="musikerlokasjon">
    					<span><?php bp_member_profile_data('field=Område'); ?></span>
    				</div>
    				<div class="musikerprissjikte">
    					<span><?php bp_member_profile_data('field=Prissjikte'); ?></span>
    				</div>
    
    				<?php
    				/**
    				 * Fires inside the display of a directory member item.
    				 *
    				 * @since BuddyPress (1.1.0)
    				 */
    				do_action( 'bp_directory_members_item' ); ?>
    
    				<?php
    				//bp_member_profile_data('field=Type');
    				 /***
    				  * If you want to show specific profile fields here you can,
    				  * but it'll add an extra query for each member in the loop
    				  * (only one regardless of the number of fields you show):
    				  *
    				  * bp_member_profile_data( 'field=the field name' );
    				  */
    				?>
    			</div>
    
    			<div class="action">
    
    				<?php
    
    				/**
    				 * Fires inside the members action HTML markup to display actions.
    				 *
    				 * @since BuddyPress (1.1.0)
    				 */
    				do_action( 'bp_directory_members_actions' ); ?>
    
    			</div>
    
    			<div class="clear"></div>
    		</li>
    <?php } 
    
    		$printet = true;
    		//slutt på løkka som skal sjekke profil ord
    		} else{
    
    			//echo $omrade . " og " . $omradeFraValgt . " er ulike";
    		}
    			//Stopper løkka dersom den printes ut siden det kan være flere med samme lokasjon
    			if($printet == true){
    				break;
    			}
    
    		}
    	}
    
    }
    
    	endwhile; ?>
    
    	</ul>
    
    	<?php
    
    	/**
    	 * Fires after the display of the members list.
    	 *
    	 * @since BuddyPress (1.1.0)
    	 */
    	do_action( 'bp_after_directory_members_list' ); ?>
    	<?php bp_member_hidden_fields(); ?>
    		<div class="pagination-links" id="member-dir-pag-bottom">
    			<?php //bp_members_pagination_links(); ?>
    		</div>
    	</div>
    
    <?php else: ?>
    
    	<div id="message" class="info">
    		<p><?php _e( "beklager, ingen funnet", 'buddypress' ); ?></p>
    	</div>
    
    <?php endif; ?>
    
    <?php
    
    /**
     * Fires after the display of the members loop.
     *
     * @since BuddyPress (1.2.0)
     */
    do_action( 'bp_after_members_loop' );
    
    } ?>
    
    <script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
    <script type="text/javascript">
    
    var testBtnClick = function()
    {
    /* $.ajax({
                //url: '_inc/ajax.php',
                success: function(data) {
                  alert("fikk til");
                }
            }); */
    
    $.ajax({ 
    	url: '/members-loop.php',
             data: {action: 'test'},
             type: 'post',
             success: function(output) {
                          alert("GÃ¥tt gjennom");
                      }
    		});
    
    }
    
    document.getElementById('lastsideBtn').onclick = testBtnClick;
    
    </script>
    
    
    #244006
    Don Caprio
    Participant

    For some years now, I’ve used different user management plugins and I have some custom WordPress fields. I’m no longer using any of them and decided to go for BuddyPress but after installing BuddyPress, I was expecting the sync option to copy these fields to Xprofile but it didn’t.

    I have a lot of users and I’m not sure creating these fields all over again using extended profile is the best option.

    Is there a way to sync these wp fields (facebook, twitter, google+ website, author bio) to buddypress extended profile?

    I’m using the latest version of Buddypress and WordPress.

    Any help will be appreciated.

Viewing 25 results - 1,526 through 1,550 (of 5,755 total)
Skip to toolbar