Search Results for '@mention on profile'
-
Search Results
-
Hi!
I’m new to Buddypress and this will be my first post here. I’m working on some customizations of the user profiles on my site. Now I want to remove the “Favorites” button/function but I can’t figure out how to do it. I tried to add the following to my bp-custom.php
add_filter( ‘bp_activity_can_favorite’, ‘__return_false’ );
…but without luck. And trust me, I’ve done my googling on this 🙂
I’ve done the same thing to the “@mentions” button by adding the following code to bp-custom.php
add_filter( ‘bp_activity_do_mentions’, ‘__return_false’ );
…and this works perfectly!
Anyone who can point me in the right direction?
Thanks!
FredrikHi @imath,
We connected on Twitter and you asked me to @mention you to help me with my problem with BP My-Home plugin.
I love this plugin, however when I have it activated and deactivated, I have problems with my website. I’m using the latest version of WordPress and Buddypress.
When Activated: I can’t go to any buddypress member page except my own; Or anytime I try to use this url structure “site.com/members/USERNAME” I get a “This webpage has a redirect loop” SEE IMAGE BELOW
http://s24.postimg.org/bewuoufqd/http_producia_staging_wpengine_com_members_cau.png
When Deactivated: I can’t see anyone’s members page. I get this error
http://s8.postimg.org/b1l5p5v51/Fiverr_Help_s_Profile_Producia.png
Please help, as we’re looking to go live this Saturday.
Thanks in advance!
I have a unique problem, I think. I have a subscription member based site, and prior to my current system, the users were forced to use email addresses as their username. When I migrated to the new system, the email addresses-as-usernames were imported.
I’m trying to implement Buddypress but it wants to display their usernames, and a lot of my users don’t want their email address as public info.
Specifically, when posting to a group or replying, and also on their profile (the @mention name)
IS their a way to completely get rid of displaying the usernames, and instead display their nickname or displayname?
Hi,
I’m using WP 3.6 and BP 1.8
I’ve added
add_filter('bp_activity_do_mentions', '__return_false');
to my bp-custom.php file.
However when I visit a Members Profile Page the @mention still displays below the name field.
Any suggestions?
Thank you
Topic: @mention and username
The site i’m working on is www .fishwire.net. I have it all running but one of the main problems is the @mentions. When someone posts a comment it uses their full name “john smith” says… However john smith’s @John-smith How can i make them the same? The @name would promote the function where as you have to go to the individuals profile in order to find out what their @name is in order to respond to someone.
Thanks!
I have been trying to find out ways to implement a Facebook-like “write on wall” or “post to profile” functionality, and it seems that I am not alone. After some research, I was lead to this very helpful article written by Brajesh Singh in 2010:
This is a brief report how I adapted the mod to WordPress 3.4.2 + Buddypress 1.6.1 + Buddpress Template Pack 1.2.1. So far everything seems to work. In case of any confusion, this mod does not exactly implement Facebook write-to-wall. The trick here is to enable the status update form on profiles and, when it is used in the profile of user X, append a short piece of text @mentioning user X. The status will thus show up later in X’s “Mention” tab. It will look more like write-to-wall if I manage to combine the “Personal” and “Mention” streams into one, another mod many people seem to want to have.
I am using not the bp-default theme but Twenty-Eleven + Buddpress Template Pack 1.2.1. All the mods suggested by Brajesh Singh basically still work, modulo different locations and some code updates. Please refer to Brajesh’s original article. The following describes the difference.
For Step 1, find lines 65-66 in members/single/activity.php
if ( is_user_logged_in() && bp_is_my_profile() && ( !bp_current_action() || bp_is_current_action( 'just-me' ) ) )
locate_template( array( 'activity/post-form.php'), true );
Change line 65 to
if ( is_user_logged_in() && ( !bp_current_action() || bp_is_current_action( 'just-me' ) ) )
For Step 2, find line 38 of activity/post-form.php
<?php if ( bp_is_active( 'groups' ) && !bp_is_member() && !bp_is_group() ) : ?>
Change to
<?php if ( bp_is_active( 'groups' ) && !bp_is_member() && !bp_is_group() ) : ?>
For Step 3, in functions.php of your theme (create this file if it does not exist)
<?phpfunction bpdev_remove_post_update(){
remove_action( 'wp_ajax_post_update', 'bp_dtheme_post_update' );
}add_action("init","bpdev_remove_post_update");
add_action( 'wp_ajax_post_update', 'bp_mytheme_post_update' );
/* AJAX update posting */
function bp_mytheme_post_update() {
global $bp;/* Check the nonce */
check_admin_referer( 'post_update', '_wpnonce_post_update' );if ( !is_user_logged_in() ) {
echo '-1';
return false;
}if ( empty( $_POST['content'] ) ) {
echo '-1' . __( 'Please enter some content to post.', 'buddypress' ) . '';
return false;
}if ( empty( $_POST['object'] ) && function_exists( 'bp_activity_post_update' ) ) {
if(!bp_is_home() && bp_is_member())
$content="@". bp_get_displayed_user_username()." ".$_POST['content'];
else
$content=$_POST['content'];$activity_id = bp_activity_post_update( array( 'content' => $content ) );
} elseif ( $_POST['object'] == 'groups' ) {
if ( !empty( $_POST['item_id'] )&&function_exists( 'groups_post_update' ) )
$activity_id = groups_post_update( array( 'content' => $_POST['content'], 'group_id' => $_POST['item_id'] ) );
} else
$activity_id = apply_filters( 'bp_activity_custom_update', $_POST['object'], $_POST['item_id'], $_POST['content'] );if ( !$activity_id ) {
echo '-1' . __( 'There was a problem posting your update, please try again.', 'buddypress' ) . '';
return false;
}if ( bp_has_activities ( 'include=' . $activity_id ) ) {
while ( bp_activities() ) {
bp_the_activity();
locate_template( array( 'activity/entry.php' ), true );
}
}
}?>
The code above is mostly the same as that of Brajesh Singh, apart from the beginning. Brajesh’s code starts with:
remove_action( 'wp_ajax_post_update', 'bp_dtheme_post_update' );
add_action( 'wp_ajax_post_update', 'bp_mytheme_post_update' );
It didn’t work for me — my status updates got duplicated. I then found somewhere else that it didn’t work for themes other than bp-default. If you use bp-default, you might need Brajesh’s version.Hope the above helps.
If an author creates a blog post then later updates the post using an @mention somewhere in the post’s contents, the new mention will link to the user’s profile like it is suppose to. However it will not show up in the user’s profile under ‘Mentions’. How can I fixing this issue?
For some reason I only just now noticed this. The @mention isn’t showing up in the profile on my site. What could I have done to disable this? I’d like to have it back.
hi,
having some issues with bp putting auto links on profile to twitter, specifically @mention part – http://new.progressivetalks.com/members/jakewhitehead/
why is this and how can i control it?
Also is it possible to edit the@ mention id?
thanks
**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(); ?>
Hi,
I’m using Buddypress for an academic blogging system. We don’t want students’ usernames to be visible in the system to other users, alongside their real names. The display names are populated by LDAP values.
I have disabled @mentions, which use the username values. All I need to do now (I think) is change the urls of members’ profile pages, which currently use the studentID. e.g:
http://domainname.ac.uk/members/zhe11341841/Is it possible to rewrite these to use another unique identifier, such as member ID? e.g.
http://domainname.ac.uk/members/751Thanks!
What is the ‘?’ on member profile page in profile-header (next to the @mention)? What does it do? How can I enable it to do something?