BuddyPress Xprofile check if user can view field [closed]

I found the answer to this question with support from the members from the BuddyPress forum. The function that I needed was xprofile_get_field_data(). Here my code: <?php $hidden_fields = bp_xprofile_get_hidden_fields_for_user(); ?> <?php if(xprofile_get_field_data(‘field_name’) && !in_array(xprofile_get_field_id_from_name(‘field_name’), $hidden_fields)) : ?> <p><?php echo xprofile_get_field_data (‘field_name’); ?></p> <?php endif; ?>

Show buddypress notification in the frontend [closed]

Put the following code in your functions.php. If you want a demo i can show you. // my custom notification menu www.cityflavourmagazine.com function my_bp_adminbar_notifications_menu() { global $bp; if ( !is_user_logged_in() ) return false; echo ‘<li id=”top-notification”>’; _e( ‘Alerts’, ‘buddypress’ ); if ( $notifications = bp_core_get_notifications_for_user( $bp->loggedin_user->id ) ) { ?> <span><?php echo count( $notifications ) … Read more

How to ensure buddypress custome profile field is unique

You should be able to enforce uniqueness with a filter something like this (untested…consider this pseudocode, just the basic idea): add_filter( ‘bp_xprofile_field_type_is_valid’, function( $validated, $values, $field ) { global $bp, $wpdb; // you’ll need to constrain this to your particular field type if ( $field->id === $your_field_id ) { $results = $wpdb->get_results( $wpdb->prepare( sprintf( “SELECT … Read more

Login redirect to certain bp profile page

this one works better imho, not my code btw 🙂 put it in /plugins/bp-custom.php //=Redirect to User’s Profile Page after Login function rt_login_redirect($redirect_to, $set_for, $user){ $redirect_to = bp_core_get_user_domain($user->id); return $redirect_to; } add_filter(‘login_redirect’, ‘rt_login_redirect’, 20, 3);

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)