Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'profile fields'

Viewing 25 results - 2,151 through 2,175 (of 5,755 total)
  • Author
    Search Results
  • CommonEasy
    Participant

    Hi there,

    I use both BP 2.0.1 and the BP custom fields type plugin and i got the the links removed with:

    function remove_xprofile_links() {
        remove_filter( 'bp_get_the_profile_field_value', 'xprofile_filter_link_profile_data', 9, 2 );
    }
    add_action('bp_setup_globals', 'remove_xprofile_links');

    I was wondering if you could use this to only hide the links from certain profile fields, like only for profile field 2, 6 & 7 ?

    #183743
    CommonEasy
    Participant

    Hi there,

    I have a profile field which i hided from the edit profile page, so it will basically function as a view only field. The data for this field is getting from another table (t2) i created in MYSQL, that data in t2 is generated from data from other profile fields from wp_bp_xprofile_data. (Data from all the users is used, you can see it has some kind of calculator. So i tried to update the wp_bp_xprofile_data table with a procedure triggered after an update on the profile fields, unfortunately this doesn’t seem to work (http://buddypress.org/support/topic/start-procedure-when-profile-is-edited/). So now i am asking if it is possible to load the data from profile field 15 directly from t2, instead of first transfer the data from t2 to wp_bp_xprofile_data? the columns from t2 are user_id | value and from wp_bp_xprofile_data are afcourse id | field_id | user_id | value. Where is the best place to start? Thanks in advance 🙂
    ps. i use BP 2.0.1. and WP 3.9.1.

    #183741
    CommonEasy
    Participant

    I got this working with:

    add_filter( 'bxcft_show_field_value', 'my_show_field', 15, 4);
    function my_show_field($value_to_return, $type, $id, $value) {
      if ($value_to_return == '')
            return $value_to_return;   
       if ($type == 'number') {
            $value = str_replace("<p>", "", $value);
            $value = str_replace("</p>", "", $value);
            $field = new BP_XProfile_Field($id);
            if ($field->id == '18' ) {
    		  
    
    	 $f_value=number_format($value,2);
    			  $new_value = "&euro; $f_value,-";
           
    
    	   } else {
                $new_value = $value;
            }
            return '<p>'.$new_value.'</p>';
        }
        return $value_to_return;
    }

    Does anybody have an idea how i can use this for multiple fields? strangely something like ‘2,18,19’ isn’t working…

    #183740

    In reply to: Remove profile links

    CommonEasy
    Participant

    sorry to bump this old topic. I use both BP 2.0.1 and BP custom fields type and i got the the links removed with:

    function remove_xprofile_links() {
        remove_filter( 'bp_get_the_profile_field_value', 'xprofile_filter_link_profile_data', 9, 2 );
    }
    add_action('bp_setup_globals', 'remove_xprofile_links');

    I was wondering if you could use this to only hide the links from certain profile fields, like only for profile field 2, 6 & 7 ?

    #183705
    compixonline
    Participant

    Hi –

    I really appreciate your reply… it’s a little above my head but working on it. How would you then populate the buddypress Xprofile fields (which would be the same, say user_meta is occupation I would have a BP Xprofile field “occupation” and I’d want to copy it across.

    I’d also want to hide the ability to change that field in the BP members profile, forcing them to use the Membermouse field in order to change their occupation both in the Membermouse Table and their BP profile…

    Hope you can help! Many thanks.

    #183678
    whedlund
    Participant

    I need to disable the Extended Profile fields for users. I’m importing their data from our database into WordPress so they can view their info and also search for other members; but they can’t be allowed to change the data as it’s not all data they have permission to update (like membership level, etc.) Plus, we’re not setup to sync their changes in buddypress with our internal database yet.

    I’ve done some searching and can’t seem to find a solution. I hope there’s one out there.

    Thanks in advance for your help.

    #183669
    whedlund
    Participant

    To simplify my question, I’ve pasted the code in that Chris wrote. I just don’t know how to call the buddypress xprofile fields?

    /* ===========================================
    Send Emails when User Profile Changes
    =============================================*/

    // IF EMAIL CHANGES
    function sr_user_profile_update_email( $user_id, $old_user_data ) {

    $user = get_userdata( $user_id );
    if($old_user_data->user_email != $user->user_email) {
    $admin_email = "email@yourdomain.com";
    $message = sprintf( __( 'This user has updated their profile on the SchoolRise USA Staff Member site.' ) ) . "\r\n\r\n";
    $message .= sprintf( __( 'Display Name: %s' ), $user->display_name ). "\r\n\r\n";
    $message .= sprintf( __( 'Old Email: %s' ), $old_user_data->user_email ). "\r\n\r\n";
    $message .= sprintf( __( 'New Email: %s' ), $user->user_email ). "\r\n\r\n";
    wp_mail( $admin_email, sprintf( __( '[Staff Member Site] User Profile Update' ), get_option('blogname') ), $message );
    }
    }

    // Save old user data and meta for later comparison for non-standard fields (phone, address etc.)
    function sr_old_user_data_transient(){

    $user_id = get_current_user_id();
    $user_data = get_userdata( $user_id );
    $user_meta = get_user_meta( $user_id );

    foreach( $user_meta as $key=>$val ){
    $user_data->data->$key = current($val);
    }

    // 1 hour should be sufficient
    set_transient( 'sr_old_user_data_' . $user_id, $user_data->data, 60 * 60 );
    }
    add_action('show_user_profile', 'sr_old_user_data_transient');

    // Cleanup when done
    function sr_old_user_data_cleanup( $user_id, $old_user_data ){
    delete_transient( 'sr_old_user_data_' . $user_id );
    }
    add_action( 'profile_update', 'sr_old_user_data_cleanup', 1000, 2 );

    whedlund
    Participant

    I am trying to write a function that will send me an email whenever a user makes a change to one of their profile fields. Thanks to Chris Perryman at Revelation Concept I was able to figure out how to do this when the user makes changes to a standard wordpress profile field like nickname or user_email.

    But she and I both got stuck trying to apply her awesome solution to buddypress xprofile fields. Here’s the thread from yesterday’s conversation between she and I.

    I would be super grateful if anyone has any ideas on what we’re missing. Thanks!

    #183636
    Iurie Malai
    Participant

    @simpleone,

    Can you show how you solved your problem? danbp‘s code did not work for me. As you, I also wanted to hide some xprofile fields and tabs that I don’t want users to be able to edit.

    #183631
    ajm113
    Participant

    Hi, I’m somewhat new to WordPress and a little newer to BuddyPress, and the site I’m working on right now is using Sweet-Date theme and the horizontal search bar for members is just UGLY. I’m looking to go in and make changes to the html code in the search fields loop. So certain fields use a certain percentage of the area. I’m not sure if the search-bar display code would be lying around in the SweetDate theme’s folder. (Assuming that’s where it is.) Or if this is a modification needed to be made somewhere else.

    Also if this is a easy question to answers… Is there a way I can get the value of profile fields left blank by the user? I would like to make a little percentage system. 🙂

    Happy coding!

    Andrew

    Paul
    Participant

    1. I was wondering whether it is possible to have facebook style cover photos in Buddypress user profiles?

    If it needs to be custom coded please show me the way.
    2. One more thing Can I make the user photo in a circle format? to make it look a little stylish.

    3. How do I have a menu only for user profiles, right now all the fields looks a little cluttered.

    hamdmaan
    Participant

    Hi,
    Long time lurker first time poster – i’ve got a bit of a problem that I just can’t figure out;

    I’m trying to get the value of the ‘radius’ field for the displayed user into a piece of PHP code to be used later on, but I keep getting errors;

    Here is the code that i’m using:
    (it’s a function that gets the radius value for the user and returns it:

    function gmw_get_radius($user_id) {
    		global $wpdb;
    
            $info = $wpdb->get_row(
                    $wpdb->prepare(
                            "SELECT * FROM <code>wp_uotu_bp_xprofile_data</code> WHERE user_id = $user_id AND field_id =1255"
            ));
    		
    		return ( isset($info) ) ? $info : false;
    		
    }

    The error that I receive via WP debug is :

    Warning: Missing argument 2 for wpdb::prepare(), called in /home3/housepa7/public_html/wp-content/plugins/geo-my-wp/plugins/friends/includes/gmw-fl-functions.php on line 35 and defined in /home3/housepa7/public_html/wp-includes/wp-db.php on line 1147
    
    Notice: wpdb::prepare was called incorrectly. The query argument of wpdb::prepare() must have a placeholder. Please see Debugging in WordPress for more information. (This message was added in version 3.9.) in /home3/housepa7/public_html/wp-includes/functions.php on line 3245
    

    Any help towards this would be very much appreciated and I can provide any more info if needed, thanks!

    NOTE: I just checked the post and it added code tags around some of the php – this is not intended and they should be apostrophes!

    CommonEasy
    Participant

    Hi there,

    i´am looking for a way to show profile fields as a currency or a percentage. I use the xprofile custom profile fields plugin to use some profile fields as number fields. However it doesn´t support a currency filter jet. I tried to following code in the custom profile fields plugin on advice as a first step:

    add_filter( 'bxcft_show_field_value', 'my_show_field', 15, 4);
    function my_show_field($value_to_return, $type, $id, $value) {
        if ($type == 'number') {
            $value = str_replace("<p>", "", $value);
            $value = str_replace("</p>", "", $value);
            $field = new BP_XProfile_Field($id);
            if ($field->name == 'Waarde van je gadget (€)') {
    		     setlocale(LC_MONETARY, 'nl_NL');
                $value = money_format('%.2n', $value) . "\n";
                $new_value = money_format('%.2n', $value) . "\n";
            } else {
                $new_value = $value;
            }
            return '<p>'.$new_value.'</p>';
        }
        return $value_to_return;
    }

    this code should change profile field 15 to a currency, unfortunatly it didn’t work. I hope there is a way to do this in buddypress itself. Can somebody please help me to the right direction? many many thanks in advance 🙂

    SimpleOne
    Participant

    I’ve modified the members-loop.php file so that my Members Directory page will display the list of members in a certain way (as shown below, for example purposes).

    Member 1
    Small Poodle
    Los Angeles

    Member 2
    Large Collie
    Boston

    Member 3
    Large Dalmatian
    Chicago

    Member 4
    N/A No Dog
    Miami

    Following is the code I’ve placed in the members-loop.php file to successfully display the above results on the Members Directory page.

    bp_member_profile_data('field=Dog Size'); 
    echo '&nbsp;'; 
    bp_member_profile_data('field=Dog Breed'); 
    echo '<br>'; 
    bp_member_profile_data('field=Dog Weight'); ?>

    Question: Is it possible for me to not display the line for ‘N/A No Dog’ whenever a member has specificed “No Dog” in the ‘Dog Breed’ field on their profile? For example, in the above, I still want the Member 4 to be shown in the list of all members. However I do not want the ‘N/A No Dog’ line (which comes from the Dog Size and Dog Breed fields entered on their profile) to be displayed underneath their username. I would only want their location, Miami, to be shown.

    Is this possible?

    FACT
    Participant

    Hello People,

    i got 2 Problems.

    I Add for the Buddypress Profile that people can add their Homepage Links. The Problem is now that the URL´s opened in the same tab and not in a new. Its Possible to change this? Thats when somebody clicks on the URL Link that it opened in a New Tab?

    ANd 2nd:

    Its Possible do Hide the Dashboard on the left side for normal Users? They cant do nothing on my site (Just a Community with a Forum and later Groups) but i think when they click on the dashboard and edit profile they think that they can change nothing Oo

    Sry for my bad english guys, but i think u understand what i mean

    EDIT:

    Oh yeah and i Use WordPress 3.9.1, Buddypress 2.0.1, Buddypress – Who clicked at my Profile? 1.7, BuddyPress Security Check 1.2.0, Buddypress Xprofile Custom Fields Type 1.5.9.5

    CommonEasy
    Participant

    you should try to hide the fields from the edit profile page but not from the profile page. try editing the wwwroot/wp-content/plugins/buddypress/bp-themes/bp-default/members/single/profile/edit.php. more information here https://buddypress.org/support/topic/ow-to-hide-more-than-one-profile-field/

    latinosamorir
    Participant

    Hello.

    So I’m trying to do a member loop that shows only members with avatars.

    Here is my code:

    template member loop file has this line:

    bp_has_members( gd_custom_ids( 'What are your interests?', $interests ) . '&per_page=6&type=random')

    functions.php

    
    /********* SEARCH MEMBERS BASED ON PROFILE FIELDS *********/
    function gd_custom_ids( $field_name, $field_value = '' ) {
      
      if ( empty( $field_name ) )
        return '';
      
      global $wpdb;
      
      $field_id = xprofile_get_field_id_from_name( $field_name ); 
     
      if ( !empty( $field_id ) ) 
        $query = "SELECT user_id FROM " . $wpdb->prefix . "bp_xprofile_data WHERE field_id = " . $field_id;
      else
       return '';
      
      if ( $field_value != '' ) 
        $query .= " AND value LIKE '%" . $field_value . "%'";
          /* 
          LIKE is slow. If you're sure the value has not been serialized, you can do this:
          $query .= " AND value = '" . $field_value . "'";
          */
      
      $custom_ids = $wpdb->get_col( $query );
      $i = 0;
      $user_ids_loop = array();
      foreach ($custom_ids as $custom_id){
    	if(gd_check_avatar($custom_id)){
    	  	$user_ids_loop[$i] = $custom_id;
      		$i++;
      	}
      }  
      
      if ( !empty( $user_ids_loop ) ) {
        // convert the array to a csv string
        $custom_ids_str = 'include=' . implode(",", $custom_ids);
        return $custom_ids_str;
      }
      else
       return '';
       
    }
    
    /********* CHECK IF MEMBER HAVE AVATARS *********/
    function gd_check_avatar($user_id){
    
    	// Check for avatar.
    		$fbavatar = false;
    		$user_info = get_userdata($user_id);
    	
    		$username=$user_info->user_login;
    	
    		//  Check what information is missing? Avatar? Profile info?
    		$username = strtolower($username);
    		
    		$userfbavatar = get_user_meta($user_ID, 'facebook_uid', true);
    		
    		if (!empty( $userfbavatar ) )
    		{
    			$fbavatar= true;
    			//echo "DEBUG: user has a FB photo<br/>"; 
    		}
    		
    		if (bp_core_fetch_avatar( array( 'item_id' => $bp->loggedin_user->id, 'no_grav' => true,'html'=> false ) ) != bp_core_avatar_default() )
    		{
    			$has_photo = true; 
    			//echo "DEBUG: user has a photo<br/>"; 
    		}
    		
    		if (  $has_photo || $fbavatar)
    		{
    			$avatarchk = true;
    		}
    		
    		if(!$avatarchk){ $avatarchk=false;}
    		
    		return $avatarchk;
    }

    I have ~6,000 members on my site.

    I get this error:

    [30-May-2014 06:59:51 UTC] PHP Fatal error:  Allowed memory size of 41943040 bytes exhausted (tried to allocate 64 bytes) in /Users/giova/Sites/lam.dev/wp-content/mu-plugins/wpengine-common/patterns.php on line 331
    [30-May-2014 06:59:51 UTC] PHP Fatal error:  Unknown: Cannot use output buffering in output buffering display handlers in Unknown on line 0

    I assume that the for loop in function gd_check_avatar() is not helping.

    What would be the best way to do this to reduce resources and still get only members with avatars?

    Or at least, sort the members so that the first members have an avatar.

    Thanks!

    Giovanni

    #183454
    SimpleOne
    Participant

    @commoneasy

    I found another solution that was suggested by someone in a different thread I had opened. Instead of modifying the edit.php file, I simply put the following code inside my functions.php file in my child theme. (Or you could put it in bp-custom.php.)

    Please be warned that this solution didn’t work when I tried it on my site running BP 1.9.1. (Even though my desired fields were successfully hidden by this solution, I still received a “required fields” error message after clicking the Save button.)

    So, in order for this to work, you need to be running BP 2.0 +.

    The below profile field ids 1, 32, and 48 correspond to the three fields I needed to hide from editing.

    function simple_one_hide_some_profile_fields( $retval ) {	
    	if(  bp_is_profile_edit() ) {		
    		$retval['exclude_fields'] = '32,48,1';	//field ID's separated by comma
    	}	
    	
    	return $retval;
    }
    add_filter( 'bp_after_has_profile_parse_args', 'simple_one_hide_some_profile_fields' );

    Try inserting the following into your functions.php or bp-custom.php and see if it works. I modified my above code specifically to hide your profile field id 15.

    function commoneasy_hide_some_profile_fields( $retval ) {	
    	if(  bp_is_profile_edit() ) {		
    		$retval['exclude_fields'] = '15';	//multiple field ID's should be separated by comma
    	}	
    	
    	return $retval;
    }
    add_filter( 'bp_after_has_profile_parse_args', 'commoneasy_hide_some_profile_fields' );
    #183453
    CommonEasy
    Participant

    Hi SimpleOne, I’m working on the same problem here! I tried to hide some fields from the edit profile page . i tried <

    
    div class="clear"></div>
    
    		<?php while ( bp_profile_fields() ) : bp_the_profile_field(); if ( bp_get_the_profile_field_id() != '15' ) :?>
    
    			<div<?php bp_field_css_class( 'editfield' ); ?>>

    to hide profilefield 15 from the editing page, unfortunatly it doesnt work, can you maybe send me a duplicate of your edit.php file? you would help me big time 🙂

    #183444
    Rita84
    Participant

    I am working on a wordpress website with buddypress installed. I have student guardian relationships. So when a guardian is visiting his student profile, he should be able to edit, delete all the fields that a user itself can do. Now I want that when a student receives a message from his friend or someone else, a message should also go to his guardian that this student has received a message. I know how to do this but I don’t know where to integrate my script. Is there any hook for this purpose or any other solution? Thanks

    #183436
    BackpackersUnion
    Participant

    Is it possible to have new user’s ‘profile fields’ already filled in when a users first registers and signs-in? Similar to how there’s a default avatar image when a users first signs-in, they know they need to add a picture unless they want to remain a grey silhouette, I’d like them to see profile fields filled in with generic data that they’ll need to change unless they want their fields to remain with sarcastic content of my choosing..

    Thanks!

    Up to date on BuddyPress and WordPress Multisite, Twenty Fourteen Theme.

    Iurie Malai
    Participant

    @danbp, I know how to check for errors, but this didn’t helped me too much :). I solved with the blank page, but no more. Your solution works for hiding some xProfile tabs from viewing, but not from editing them. Am I wrong? Sorry!

    This is my tested function (as I said, it hiding only from viewing, not from editing):

    
    function flegmatiq_profiles( $retval ) {
    
       if ( is_user_logged_in() && !bp_is_profile_edit() ) {
          $myfield = xprofile_get_field_data( 'User Type' );
          if( $myfield == "Faculty" ) {
             $retval['exclude_groups'] = '2';
    	 //$retval['exclude_fields'] = '6,18,39';
          }
       }
    
       return $retval;
    
    }
    
    add_filter( 'bp_after_has_profile_parse_args', 'flegmatiq_profiles' );
    

    The next code works as I need, but I think it is not so elegant, and it not allow to use the group ID, only his order number, as ordered by admin:

    
    function hide_profile_group_tabs_from_editing( $group_names ){
    
       if ( is_user_logged_in() && bp_is_profile_edit() && xprofile_get_field_data( "User Type") != "Faculty" ) {
          for ($x=0; $x<=sizeof($group_names); $x++) {
             if ( $x != 3 ) echo $group_names[$x]; //3 is the order number (from 0) of the tab that I need to hide in the profile edit page. This is not the group ID.
          }
       } else {
          return $group_names;
       }
    
    }
    
    add_filter('xprofile_filter_profile_group_tabs', 'hide_profile_group_tabs_from_editing');
    
    #183374
    Antimuffin
    Participant

    Hello,

    i want to add a <a href='#' target='_blank'>Terms</a> but it does not work !
    BuddyPress is always removeing the target=’_blank’ and saves only \<a href=\'#\'\>Terms\<\/a\> in the Database.
    In whitch file can i find the “Profile fields – Page”,
    i want to fix it without changeing something in the Database.

Viewing 25 results - 2,151 through 2,175 (of 5,755 total)
Skip to toolbar