Forum Replies Created
-
In reply to: How to hide profile menu items from other users
Add this snippet to bp-custom.php and give it a try.
function bpex_hide_profile_menu_tabs() { if( bp_is_active( 'xprofile' ) ) : if ( bp_is_user() && !is_super_admin() && !bp_is_my_profile() ) { // BP's profile main menu items. Comment those to show. // bp_core_remove_nav_item( 'activity' ); bp_core_remove_nav_item( 'profile' ); bp_core_remove_nav_item( 'friends' ); bp_core_remove_nav_item( 'groups' ); // exist only if you use bbPress bp_core_remove_nav_item( 'forums' ); // BP's profile main menu items. Comment those to show. // bp_core_remove_subnav_item( 'activity', 'personnal' ); bp_core_remove_subnav_item( 'activity', 'mentions' ); bp_core_remove_subnav_item( 'activity', 'favorites' ); bp_core_remove_subnav_item( 'activity', 'friends' ); bp_core_remove_subnav_item( 'activity', 'groups' ); } endif; } add_action( 'bp_setup_nav', 'bpex_hide_profile_menu_tabs', 15 );In reply to: How do I add metadata to a BuddyPress post?Note also what’s coming up for meta in WP 4.6 scheduled for August 16, 2016
In reply to: How do I change the activity-greeting copy?BP files are very well commented actually. But reading through hundreds of files is not easy. Here a good ressource to find a function, hook by keywords. Still interesting even if related to BP 2.4.3
Test and search for get_ to have an idea !In reply to: How do I add metadata to a BuddyPress post?Guess you have to code it completely.
A great and very complete tutorial is Creating Maintainable WordPress Meta Boxes
And here an overview of almost all BP hooks and filters related to meta.
In reply to: How do I change the activity-greeting copy?Maybe it’s me who’s wrong. I haven’t tested, but it’s how i used such a function in the past, called inside another one. I also wrote “something like”, which is very different of “use this”. It’s an example, not the absolute solution! ๐
Let’s wait for Allan’s reaction before continuing this discussion. For the moment, the only important thing related to this post is:
$goal = xprofile_get_field_data( 'Your goal', $user_id );In reply to: Custom post typeHave you read this tutorial ?
Note that most of BP custom functions for core are better handled when living in bp-custom.php. Sometimes also, a same function may work from within one file, but not from the other. In other case, which file has no real importance.
Even if in background there is a hierarchy and a load order, to take in account for the file choice.That said, as it is related to CPT, bp-custom is the best place IMO.
Theme’s functions.php contains functions related to theme, templating and evtl. wp stuff
BP custom functions goes to bp-custom.phpIt’s also better for you to have such separated functions.
In reply to: How do I change the activity-greeting copy?@social yes and no.
Yes if you consider the example function without having ‘if’ conditionnals.
If ‘conditionnals’ is empty, return = false. If not, return true.No if you add Whatโs new with bla bla…, to function, in which case you can do
return 'What's new about '. $goal .' ';If + return are not empty, so you return $return.
In reply to: How do I change the activity-greeting copy?Hi,
Try somthing like this to fetch the field.
function allan_goal( $user_id = 0, $field_name = 'Your goal' ) { $return = false; if ( empty( $user_id ) || empty( $field_name ) || ! bp_is_active( 'xprofile' ) ) { return $return; } // assuming field is called Your goal $goal = xprofile_get_field_data( 'Your goal', $user_id ); return $return; }To output field value, something like:
Whatโs new with <?php allan_goal() ?>, [username]?In reply to: BP Profile – Replacing USERNAME with NICKNAMEHi,
if nothing made sense of what you already read, i doubt i can help you as i would certainly repeat the same things… ๐Nickname doesn’t exist in WordPress. On a WP install, a new user is only asked for a username(generally it’s a nickname like creatorsite), an email and a password. That’s all!
By convinience, a WP user can add his first and last name to his profile, but it is not an obligation.
When BP is added, he adds a mandatory field called Name which can by filled with first and last name or whatever else. Only the field is mandatory, not the content. And you can change his nale to what you want. Eg. Your dogs name. An other difference for this field is that it let you enter uppercase and space, what the WP username field doesn’t allow. BP use this field to synchronize members from WP and those registered once BP is activated.
Users are handled by WP, not by BP which is only a plugin, btw. both use the same DB user table.
Here a complete description of WP’s database, and read attentively the part related to wp_users.
Nickname = username. Your question is related to username vs. display_name.
Read here for a solution.
ps: your picture mention that nicknames can eliminate a security issue. Which one exactly ? i’m curious to learn how over 200 000 active BP sites are threatened by hackers seaking for usernames in 2016 !
In reply to: Adding Multiple Custom Activity Feeds to the StreamRead and learn from here:
In reply to: How to use bp_has_activities filtering in a functionSomething like this ?
function bpfr_remove_some_activity_filters( $filters, $context ) { /** * Get available filters depending on the scope. * * @since 2.1.0 * * @param string $context The current context. 'activity', 'member', * 'member_groups', 'group'. * * @return string HTML for <option> values. */ if ( 'member' == $context ) { $remove_these = array( 'Updates', 'Posts', 'Comments' ); // case sensitive foreach ( $filters as $key => $val ) { if ( in_array( $val, $remove_these ) ) unset( $filters[ $key ] ); } } return $filters; } add_filter( 'bp_get_activity_show_filters_options', 'bpfr_remove_some_activity_filters', 20, 2 );In reply to: Customizing Preset Groups PageIf you’re sepaking about the Group directory page, yes !
# of columns can be defined by CSS. For other details, read here
https://buddypress.org/support/topic/how-to-display-multiple-single-group-headers-on-a-single-page/You need also a child-theme to do customization.
Codex is your friend. ๐
In reply to: Buddypress not sending activation emailsWhat is your BP version ? Have you tried to use the email repair tool ?
In reply to: PHP 7.0 compatibilityIn reply to: How to use bp_has_activities filtering in a functionhi @ljmac,
Filter description
Usage example (sorry if i’m wrong) of the filter inside a function
https://buddypress.org/support/topic/adding-favourite-posts-as-a-tab-in-buddypress/#post-236682Hi,
please open a ticket for this on Trac if you expect a quick advice. Login by using same credentials as here.
In reply to: Add custom notificationHi @omdisa7
See this topic if it can help you:
https://buddypress.org/support/topic/notification-is-created-but-cant-list-it-for-the-user/
In reply to: Impossible to fill password field on registrationhi @missmad
d’abord impossible n’est pas franรงais ! Non mais… ๐
I tested the registration page and it works as expected. But i’m used to navigate forms by keyboard, not by mouse click… The password field is only accessible by tabed nav, but not by mouse click.
It seems that the password field use a script which is not part of WP or BP and which generate this issue.
Also there is a check for strength , which doesn’t let you go to pwd confirmation field as long as the first one is empty or weak….
Le mieux est l’ennemi du bien. Do you realy need to be so strict ? Sometimes such rules can be against productivity.
Check the plugin, the theme or whatever you installed for password strength and eventually any custom coding which may interfer with the registration process…
In reply to: Top posts on front pageHi @gilbert2015,
what do you call top posts ? Blog posts or aupdates ?
You can add a widget area to your homepage template and use such a widget there.They’re many on the plugin repo, if those shiped with WP are not enough.
In reply to: Use groups activity streams as commentsIt does, of course. But you haven’t to convience me. ๐ Another option could be to use BP Group Blog.
In reply to: Use groups activity streams as commentsHi @telesemana
it’s certainly possible, but not without coding a lot.
The posts are in the blog loop. The group activity is in the group loop.
And groups are basically “members” grouped by affinity.
And activity comments are not blog comments.So it’s not a 5 mn task and somewhere it’s like reinventing the wheel. You’d better close comments for a given post and link your readers to the related group, where they can comment the post activity (and not the post itself, like an ordinary post).
In reply to: [Resolved] Removing nav & subnav item in groupsplease don’t jump into topics marked as resolved! Open your own, for more clarity
How to remove group tabs since 2.6
function bpex_remove_group_tabs() { /** * @since 2.6.0 Introduced the $component parameter. * * @param string $slug The slug of the primary navigation item. * @param string $component The component the navigation is attached to. Defaults to 'members'. * @return bool Returns false on failure, True on success. */ if ( ! bp_is_group() ) { return; } $slug = bp_get_current_group_slug(); // all existing default group tabs are listed here. Uncomment or remove. // bp_core_remove_subnav_item( $slug, 'members' ); bp_core_remove_subnav_item( $slug, 'send-invites' ); // bp_core_remove_subnav_item( $slug, 'admin' ); // bp_core_remove_subnav_item( $slug, 'forum' ); } add_action( 'bp_actions', 'bpex_remove_group_tabs' );You’re welcome! ๐
You can use something like this (add to bp-custom.php or child theme’s functions.php)
BuddyPress usermenu usage: remove_node(‘$id-$nav-$subnav’)
/* remove items from Toolbar Usermenu (top-right) */ function bpex_admin_bar_remove_this(){ global $wp_admin_bar; $wp_admin_bar->remove_node('my-account-forums-favorites'); $wp_admin_bar->remove_node('my-account-messages-starred'); // etc... } add_action('wp_before_admin_bar_render','bpex_admin_bar_remove_this');Merci @imath !
The old way
The following syntax to change the tab order is deprecated since 2.6 and will throw an error notice:
function rt_change_profile_tab_order() { global $bp; $bp->bp_nav['profile']['position'] = 10; $bp->bp_nav['activity']['position'] = 20; } add_action( 'bp_setup_nav', 'rt_change_profile_tab_order', 999 );The new way
Now the correct syntax to use for modifying – since 2.6 – the tabs position on the buddybar when you’re on a profile.
This example list all BP related items who appear by default on a profile nav, in order of appearance and include also the forum tab (if you use bbPress for group forums).
By default, activity tab comes as 1st. The snippet will move it to 4th position.To modify a position you simply change the numeric value.
If you want to move only one item, you remove or comment (add//at begin of the line) the ones you don’t want to move.function bpex_primary_nav_tabs_position() { buddypress()->members->nav->edit_nav( array( 'position' => 4, ), 'activity' ); buddypress()->members->nav->edit_nav( array( 'position' => 5, ), 'profile' ); buddypress()->members->nav->edit_nav( array( 'position' => 7, ), 'notifications' ); buddypress()->members->nav->edit_nav( array( 'position' => 9, ), 'messages' ); buddypress()->members->nav->edit_nav( array( 'position' => 2, ), 'friends' ); buddypress()->members->nav->edit_nav( array( 'position' => 6, ), 'groups' ); buddypress()->members->nav->edit_nav( array( 'position' => 3, ), 'forums' ); buddypress()->members->nav->edit_nav( array( 'position' => 1, ), 'settings' ); } add_action( 'bp_setup_nav', 'bpex_primary_nav_tabs_position', 999 );That’s it for the buddybar nav menu order on profile.