Search Results for 'buddypress'
-
Search Results
-
**UPDATED**
-when multiple results show, it will show the AKA @ name properly now
-added the same limit on the results returned that the original code usedLike a lot of people, I want the auto suggest to look for display names and nice names. Below is my code to do just that. Im using a $wpdb->get_results to do my search. Im also changing up the displayed text to also include that users nice name so if the user is searching for “bob”. A user’s display name might be “bob9”, but there login = “I_am_bob” It will display avatar then display name then @username
example output
[avatar] bob9 AKA -> @i_am_bobWarning im not a coding master, but it seems to work for me. Below is the whole class-bplabs-autosuggest.php so just make a backup of your site, and overwrite inside class-bplabs-autosuggest.php with the code below
<?php /** * @package BP_Labs * @subpackage Mentions_Autosuggest */ // Exit if accessed directly if ( !defined( 'ABSPATH' ) ) exit; /** * Implements the <a href='http://buddypress.org/community/members/message/' rel='nofollow'>@message</a> autosuggest experiment. * * <a href='http://buddypress.org/community/members/since/' rel='nofollow'>@since</a> 1.0 */ class BPLabs_Autosuggest extends BPLabs_Beaker { /** * Enqueue javascript * * <a href='http://buddypress.org/community/members/since/' rel='nofollow'>@since</a> 1.0 */ public function enqueue_script() { $dir = WP_PLUGIN_URL . '/bp-labs/beakers/js/jquery.mentions'; if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) wp_enqueue_script( 'bplabs-autosuggest-js', "{$dir}.dev.js", array( 'jquery' ), '1.2' ); else wp_enqueue_script( 'bplabs-autosuggest-js', "{$dir}.js", array( 'jquery' ), '1.2' ); wp_localize_script( 'bplabs-autosuggest-js', 'BPMentions', array( 'error1' => __( 'Sorry, an error occurred.', 'bpl' ), 'error2' => _x( 'Please try again.', 'an error occurred', 'bpl' ), 'searching' => _x( 'Searching for members to mention... one moment please...', 'started a search', 'bpl' ) ) ); // This bit of javascript is what you could add directly to your theme $dir = WP_PLUGIN_URL . '/bp-labs/beakers/js/autosuggest'; if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) wp_enqueue_script( 'bplabs-autosuggest-theme-js', "{$dir}.dev.js", array( 'bplabs-autosuggest-js' ), '1.0' ); else wp_enqueue_script( 'bplabs-autosuggest-theme-js', "{$dir}.js", array( 'bplabs-autosuggest-js' ), '1.0' ); } /** * Enqueue CSS * * <a href='http://buddypress.org/community/members/since/' rel='nofollow'>@since</a> 1.0 */ public function enqueue_style() { $dir = WP_PLUGIN_URL . '/bp-labs/beakers/css/jquery.mentions'; if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) wp_enqueue_style( 'bplabs-autosuggest', "{$dir}.dev.css", array(), '1.0' ); else wp_enqueue_style( 'bplabs-autosuggest', "{$dir}.css", array(), '1.0' ); } /** * Add the AJAX callback for the mention_autosuggest() method. * * <a href='http://buddypress.org/community/members/since/' rel='nofollow'>@since</a> 1.0 */ protected function register_actions() { add_action( 'wp_ajax_activity_mention_autosuggest', array( 'BPLabs_Autosuggest', 'mention_autosuggest' ) ); } /** * AJAX receiver for the @mention autosuggest jQuery library. Performs a search on the string provided and returns matches. * * <a href='http://buddypress.org/community/members/global/' rel='nofollow'>@global</a> object $bp BuddyPress global settings * @return mixed Either HTML or JSON. If error, "-1" for missing parameters, "0" for no matches. * <a href='http://buddypress.org/community/members/see/' rel='nofollow'>@see</a> bp-labs/beakers/js/jquery.mentions.dev.js * <a href='http://buddypress.org/community/members/since/' rel='nofollow'>@since</a> 1.0 */ public function mention_autosuggest() { global $bp; if ( empty( $_POST ) || empty( $_POST ) ) exit( '-1' ); // Sanitise input $search_query = implode( '', (array) preg_replace( array( '|^https?<img src="smileys/irritated.gif" width="" height="" alt=":/" title=":/" class="bbcode_smiley" />/|i', '|*|', '|@|' ), '', $_POST ) ); if ( empty( $search_query ) ) exit( '-1' ); //$args = array( // 'count_total' => false, // 'number' => (int) $_POST, // 'search' => "{$search_query}*" //); if ( !empty( $bp->loggedin_user->id ) ) $args = array( $bp->loggedin_user->id ); if ( bp_is_username_compatibility_mode() ) { //$args = array( 'ID', 'user_login' ); //$args = 'login'; } else { //$args = array( 'ID', 'display_name' ); //$args = 'nicename'; } $args = apply_filters( 'bpl_mention_autosuggest_args', $args ); // Search users //TAO custom search using display name global $wpdb; $TAO_limit_results = (int) $_POST; $user_search_results = $wpdb->get_results( "SELECT ID, user_nicename, display_name, user_login FROM wp_users WHERE user_login like'%$search_query%' OR display_name like '%$search_query%' LIMIT 0, $TAO_limit_results" ); //print_r($user_search_results); echo "<br>"; echo 'Searching for members to mention with "' .$search_query .'" in their name.'; echo "<br>"; echo 'Click on the user you wish to mention.'; $args = array( 'search' => "*{$search_query}*" ); //$user_search_results = new WP_User_Query( $args ); //print_r($user_search_results); if ( empty( $user_search_results ) ) { // Return JSON if ( !empty( $_POST ) && 'json' == $_POST ) { exit( json_encode( false ) ); // Return HTML } else { printf( '<li class="section error"><span>%s</span> %s </li>', _x( 'No matches found.', 'no search results', 'bpl' ), _x( 'Please check your spelling.', 'no search results', 'bpl' ) ); exit(); } } // If logged in, get user's friends $friend_ids = array(); if ( !empty( $bp->loggedin_user->id ) && bp_is_active( 'friends' ) ) $friend_ids = friends_get_friend_user_ids( $bp->loggedin_user->id ); $search_results = array( 'friends' => array(), 'others' => array() ); // Build results foreach ( (array) $user_search_results as $user ) { $result = new stdClass; $result->avatar = bp_core_fetch_avatar( array( 'item_id' => $user->ID, 'width' => 30, 'height' => 30, 'type' => 'thumb', 'alt' => __( 'Profile picture of %s', 'bpl' ) ) ); $result->name = bp_core_get_user_displayname( $user->ID ); //TAO adding the nicename to do a AKA $result->TAO_user_nicename = $user->user_nicename; if ( bp_is_username_compatibility_mode() ) $result->id = $user->user_login; else $result->id = $user->user_nicename; if ( in_array( $user->ID, (array) $friend_ids ) ) $search_results[] = $result; else $search_results[] = $result; } apply_filters_ref_array( 'bpl_mention_autosuggest', array( &$search_results, $args ) ); // Return JSON if ( !empty( $_POST ) && 'json' == $_POST ) { exit( json_encode( $search_results ) ); // Return HTML } else { $html = array(); foreach ( $search_results as $section => $items ) { if ( empty( $items ) ) continue; // Friends and other users if ( 'friends' == $section || 'others' == $section ) { if ( 'friends' == $section ) { $html[] = sprintf( '<li class="section friends">%s </li>', __( 'Your friends', 'bpl' ) ); } elseif ( 'others' == $section ) { if ( !empty( $search_results ) ) $html[] = sprintf( '<li class="section other">%s </li>', sprintf( __( 'Other people on %s', 'bpl' ), get_bloginfo( 'name', 'display' ) ) ); else $html[] = sprintf( '<li class="section other">%s </li>', sprintf( __( 'People on %s', 'bpl' ), get_bloginfo( 'name', 'display' ) ) ); } foreach ( $items as $item ) $html[] = sprintf( '<li class="%s">%s </li>', esc_attr( $item->id ), $item->avatar . esc_html( $item->name ) . '   AKA ---> @' .$item->TAO_user_nicename ); // For third-party extensions } else { $custom_section = apply_filters( 'bpl_mention_autosuggest_custom_section', false, $section, $items ); if ( !empty( $custom_section ) ) $html = array_merge( $html, (array) $custom_section ); } } // Safety net if ( empty( $html ) ) $html[] = sprintf( '<li class="section error"><span>%s</span> %s </li>', _x( 'No matches found.', 'no search results', 'bpl' ), _x( 'Please check your spelling.', 'no search results', 'bpl' ) ); exit( apply_filters( 'bpl_mention_autosuggest_html', implode( PHP_EOL, $html ), $html ) ); } } } new BPLabs_Autosuggest(); ?>Topic: bbpress not working
I have installed buddypress and bbpress on my site ontariobuyersmarket.ca and when creating new forums its giving the url, but when i explore the url it just gives me a h1 tag name of the forum name. for example “general” forum is on the url http://www.ontariobuyersmarket.ca/Q&A/forum/general/ ….sincerely confused
I’ve been looking for a way to search for particular topics. There appears to be a search feature above the forums but whenever I enter a search term it takes me to the same page, http://buddypress.org/?s.
Is there a search feature on the forums that would be more granular than the tags?
ThanksI have Buddypress set up with a sitewide bbPress forum. I don’t have any groups set up, because this is a small intranet type site used for my company, where we don’t need groups.
How can I get daily digest emails of the site activity stream set up?
I’ve tried installing the Buddypress Group Email Subscription plug-in, but that must only work with groups? Do I need to set up a group, and change to a bbPress group forum instead of sitewide for this to work?
We are facing some technical issue with adding categories to activity in BuddyPress. In this project we are also using a plugin ‘BuddyPress Activity Plus’.
The idea was to create and maintain two separate tables (activity_category, activity_category_relation); activity_category is for holding category data and activity_category_relation will hold their relationship.
Problem
The problem is when somebody posts an update in the activity; we need to retrieve the particular activity id.
When I checked codes of ‘BuddyPress’ plugin and ‘BuddyPress Activity Plus’ plugin, ‘BuddyPress Activity Plus’ plugin jquery ajax functions to post activity updates, so it seems hard to retrieve the activity post id that we are using to relate with the category id.
Please explain if I miss anything/ did anything wrong. I’m new to BuddyPress.

Hello,
I installed BuddyPress with the “Site Wide” Forum option.
The Forum is working fine, but I get this error:
“The following active BuddyPress Components do not have associated WordPress Pages: Discussion Forums. “
When I click “Repair” it takes me to BuddyPress > Pages
Under “Directories” there is “Discussion Forum” and a drop down menu.
The forum that I have is not listed in the dropdown menu.
If I hit “New Page” it just makes like a new blank blogging page and links to that.
How do I make a link to the forum in the header next to “Home, Activity, Groups”, etc?
Thanks
Hi, I’m using the buddypress mobile plugin and love it with the exception that there is no domain mapping. I’d like to offer viewers the ability to switch back and forth between desktop and mobile. I’ve seen this with other mobile plugins but none of the others do what buddypress mobile does with the member directory. Is there anyway I can get my url to be m.mydomain.com and have a link in my footer to switch between the 2? Thanks in advance.