Buddypress user registration validation not working with custom select query

There is no such thing as $bp->get_var. Try using $wpdb->get_var. Or try this: function validate_user_signup($result) { global $wpdb; $result = $wpdb->get_var(“SELECT user_id FROM wp_bp_xprofile_data WHERE value=”{$_POST[“field_2′]}'”); if( $result != NULL ){ $new_error = new WP_Error(); $new_error->add( ‘field_2’, __( ‘Phone number is already in use.’, ‘buddypress’ ) ); $result[‘errors’] = $new_error; } return $result; } add_filter(‘bp_core_validate_user_signup’, … Read more

add extra parameter in default hook in wordpress

You don’t really need to add this parameter, you can use global $post; function bp_add_visibility_to_activity( $content, $user_id, $activity_id ) { global $post; $post_id = $post->ID; // do stuff } add_action( ‘bp_activity_posted_update’, ‘bp_add_visibility_to_activity’, 10, 3 ); Note that $post->ID will return null if your are not in a post or page, so you maybe need to … Read more

Add external url to WooCommerce My Account navigation

Making a small assumption here. It’s more likely that the actual output looks something like this: <a href=”www.subdomain.domin.com/members/profile”> Profile </a> rather than: <a href=”www.domain.com/my-account/www.subdomain.domain.com/members/profile/”> Profile </a> And your browser is actually filling in for the missing scheme and path. Browsers will assume an href is relative if you don’t use an absolute URI (go figure!) … Read more

send reply message by thread id in buddypress

Get thread id for existing conversation for users or not create new conversation, $threadId = buddydev_get_threads_between_users($sender_id, $recip_id ); if(empty($threadId)){ if ( $thread_id = messages_new_message( array(‘sender_id’ => $sender_id, ‘subject’ => $subject, ‘content’ => $message, ‘recipients’ => $recip_id ) ) ) { bp_core_add_message( __(‘Message was sent.’, ‘buddypress’ ) ); } else { bp_core_add_message( __( ‘There was an … Read more

Buddypress: Filter Members Based on If They Have Posts

Solved if anyone needs this: <?php // The Query $user_query = new WP_User_Query( array(‘has_published_posts’ => array(‘post_type’=>’post’)) ); // User Loop $published_users = array(); if ( ! empty( $user_query->results ) ) { foreach ( $user_query->results as $user ) { $published_users[] = $user->ID ; } } else { } $usersimploded = implode(“,”,$published_users); if ( bp_ajax_querystring( ‘members’ ) … Read more

how to create buddypress shortcodes?

can you just add_shortcode? add_shortcode (‘use-this’, ‘get_nickname’); now in your code call [use-this] of course change ‘use-this’ to whatever you want in both places if you want to change it.

How to add “create page” option for users in buddypress like facebook?

The code below is an example in how to add an admin page to your WordPress website – you can use the example below as starting point, minimal changes are required. add_action(‘admin_menu’, ‘awesome_page_create’); function awesome_page_create() { $page_title=”My Awesome Admin Page”; $menu_title=”Awesome Admin Page”; $capability = ‘edit_posts’; $menu_slug = ‘awesome_page’; $function = ‘my_awesome_page_display’; $icon_url=””; $position = … Read more

Upload buddy press profile picture from custom page template

By default a Buddypress user can update their profile picture at /members/$username/profile/change-avatar/ – if your theme isn’t exposing that option something might be broken in your profile template. Edit: this functionality is exposed in /members/single/profile/change-avatar.php, can you just include that in your custom template? If not, examining the functions used on there should get you … Read more

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