Forum Replies Created
-
In reply to: Unable to Add Profile Tab
hello @optiqal,
using snippets from 2012 leads to errors in many case. 😉Here’s a new version of what you used. I tested it on BP 2.1 and 2013 theme.
(original code comes from here) As it contained errors i corrected them and adjusted the code to get content everywhere./* we're building the nav button and add it to the profile main menu */ function mb_bp_profile_menu_posts() { global $bp; bp_core_new_nav_item( array( 'name' => 'My Posts', 'slug' => 'posts', 'position' => 11, 'default_subnav_slug' => 'published', 'screen_function' => 'mb_author_posts' ) ); } add_action('bp_setup_nav', 'mb_bp_profile_menu_posts', 301 ); /* we're building 2 sub item * the first is the one showing by default */ function mb_bp_profile_submenu_posts() { global $bp; if(!is_user_logged_in()) return ''; bp_core_new_subnav_item( array( 'name' => 'Published', 'slug' => 'published', 'parent_url' => $bp->loggedin_user->domain . $bp->bp_nav['posts']['slug'] . '/' , 'parent_slug' => $bp->bp_nav['posts']['slug'], 'position' => 10, 'screen_function' => 'mb_author_posts' //the function is declared below ) ); bp_core_new_subnav_item( array( 'name' => 'Drafts', 'slug' => 'drafts', 'parent_url' => $bp->loggedin_user->domain . $bp->bp_nav['posts']['slug'] . '/' , 'parent_slug' => $bp->bp_nav['posts']['slug'], 'position' => 20, 'screen_function' => 'mb_author_drafts' //the function is declared below ) ); } add_action('bp_setup_nav', 'mb_bp_profile_submenu_posts', 302 ); /* here we control our 1st sub item * first function is the screen_function * second function displays the content */ function mb_author_posts(){ add_action( 'bp_template_content', 'mb_show_posts' ); bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) ); } function mb_show_posts() { echo 'Function to Generate the displayed users posts.'; // add yout stuff here } /* here we control our 2nd sub item * first function is the screen_function * second function displays the content */ function mb_author_drafts() { add_action( 'bp_template_content', 'mb_show_drafts' ); bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) ); } function mb_show_drafts() { echo 'Another function to Generate the displayed users drafts.'; // add yout stuff here }In reply to: Social Media Link Icons in profiles1) create your social fields on xprofile
2) give them a name like Twitter or Facebook
3) tell the user to enter their social username
4) install font-awesome or similar to get nice social iconsThis function works as of BP 1.7 and was tested on BP 2.0.1. Add it to bp-custom.php or your (child) theme’s functions.php
Icons are showed under @username | active since at the right of the user avatar on the profile header.
Remove the text Test… if you want to use only font-awesome icons or replace it with an image or text of your choice
function bpfr_socialize_profile () { echo '<br>'; // don't remove ! if ( $data = bp_get_profile_field_data( 'field=Twitter ' ) ) : ?> <a href="http://twitter.com/<?php echo xprofile_get_field_data( 'Twitter', bp_displayed_user_id() );?>/" target="_blank" title="Twitter"><i class="icon-twitter"> </i>Test Twitter</a> <?php endif; if ( $data = bp_get_profile_field_data( 'field=Facebook ' ) ) : ?> <a href="http://facebook.com/<?php echo xprofile_get_field_data( 'Facebook', bp_displayed_user_id() );?>/" target="_blank" title="Facebook"><i class="icon-facebook"></i>Test FB</a> <?php endif; } add_filter( 'bp_before_member_header_meta', 'bpfr_socialize_profile' );In reply to: adding / modifing the budypress member page linksWill this help you ? Add it to your theme’s functions.php
function bpfr_my_directory_setup_nav() { echo'<li><a href="#main">Encore</a></li>'; // link to what you want } add_action( 'bp_members_directory_member_types', 'bpfr_my_directory_setup_nav' );In reply to: Help with profilesIt’s a field builder plugin, not a filter, so no it wouldn’t help you. BuddyPress already do this (building fields and fields section) for xprofile component, so such a plugin is not to use with BP.
Conditionnal fields is an old and remaining “must have” thing, but the state of the art is far away i guess.
https://buddypress.org/support/topic/buddypress-conditional-profile-fields-available-now/i would take a try over Gravity Form at your place.
In reply to: Trouble with Members LoopWhere do you use this code ?
Read here and see especially the recommendation at the end of the post:
or view more here:Add custom filters to loops and enjoy them within your plugin
In reply to: [Resolved] Hide BP Search BarAre you aware about css styling ?
The css goes into your theme style.css, not in the core file.Please read a little the codex before asking for such basic things !
Read about child-theme and buddypress customization. On BP’s codex and WP codex too.
You can also learn a lot by only reading topics on this forum.I confirm: the code example doesn’t work from within bp-custom.php. But he works in theme/functions.php
And if all is goig well, you’ll have the right result after that. 😉
Both example mentionned by imath on the codex are working. And the output goes nice when you’re on a group page. Just tested them with 2014 and the whole code in functions.php…
But can you be more explicit of what you want ?
Do you mean the group directory menu only ? Like this:
| All Groups (3) | My Groups (1) | My item |In reply to: Adding New Profile Tab ContentIn reply to: [Resolved] Hide BP Search BarThis filter will remove any members count everywhere. Goes into bp-custom.php or theme’s functions.php
add_filter ('bp_get_total_member_count', '__return_false');Now you see a count with zero. But this count is hardcoded in a span. So you can hide this with css:
#activity-all span, #members-all span{ display:none; }See html/css details in index.php of each folder in bp-templates/bp-legacy/buddypress/
In reply to: Who's Online Widget and Members Widget Not Workingare all (8) salt keys in place in wp-config ?
Do you have also something like this ?/* Multisite */
define(‘MULTISITE’, true);
define(‘SUBDOMAIN_INSTALL’, true); // false if sub directories
define(‘DOMAIN_CURRENT_SITE’, ‘your-site.com’);
define(‘PATH_CURRENT_SITE’, ‘/’);
define(‘SITE_ID_CURRENT_SITE’, 1);
define(‘BLOG_ID_CURRENT_SITE’, 1);In reply to: Hot can I display the profile fields groups in tabs?Anyway an image says more as words (in our case).
Check if this plugin can help you:
https://wordpress.org/plugins/buddypress-profile-tabs/In reply to: [Resolved] Display xProfile field groupshi @pstidsen,
not sure i understand what you want. But if your goal is to fetch a xprofile data and show it somewhere on your site (aka outside of the profile loop), you can use a function like these:
function pstidsen() { // we need the user_id first (mandatory outside a loop) $user_id = bp_get_activity_user_id(); // now we fetch the field data (separate fied id's by comma) $my_field = xprofile_get_field_data('4, 41,55', $user_id); // we built the output echo '<div class="authorinfo">'. $my_field . '</div>'; } // the new hook add_action( 'show_pstidsen', 'pstidsen' ); // finally add this placeholder in the appropriate template <?php do_action( 'show_pstidsen'); ?>In reply to: Hot can I display the profile fields groups in tabs?Sorry, it’s not clear at all ! 😉 Can you make a mockup of what you want ?
In reply to: BuddyPress and SEO Best PracticesSEO best practices are more marketings philosophy questions before technical solutions.
By default WP/BP display correctly their content. Some learning about permalinks and tags usage would be good starters for a correct ranking and site search.Good SEOing is a full time job and using a plugin to achieve this job is not the solution, but only an easier way to handle some parts.
That said, the most popular SEO plugin for WP/BP is probably Yoast. Googling about this produces many answers and good advices.
In reply to: Who's Online Widget and Members Widget Not WorkingWhich language you use on your site ?
In reply to: Hot can I display the profile fields groups in tabs?On xprofile component, the default field group is called Name and contains only one field who will contain the username. This group is already tabed on a profile page and is the only group field who appears on the register page.
Now, on the xprofile admin you can add as many fields and group fields you want, and you can set each field to different visibility.
These new field can be grouped and each group you create will automatically be tabed on a profile page.https://codex.buddypress.org/buddypress-components-and-features/extended-profiles/
If you mean showing groups on the profile, this also made automatically by BP. On each profile, you have (if exist) the groups the member belongs to.
If all this is not what you mean, be more explicit 😉
In your first topic you asked: It is possible to turn off this notification?
Yes it is, and the solution is in the first link. The other link is given as reference to the code, who is in a core file. Such core files should never been modified directly.
You need to study a bit WP and BP codex to understand how to achieve this, and learn a bit more about buddypress customization. You are also free to hire a developer by posting at http://jobs.wordpress.net/ or somewhere else.
One easy way to begin is to search and read this forum first i guess.
In reply to: I want to use BP BUT is there a plugin for this use?hi @jjjaay9,
BuddyPress (BP) is a community plugin (a bundle of 8 distinct components and many other features) for WordPress. These components are all optionnal, but in any case, publishing is the territory of WordPress.
If you want to allow front-end publishing for your users, to avoid them going directly into the admin, search some plugin on the WP plugin repo or use a theme who provide such facility.For example consider the theme P2, it probably contains anything you listed. (so far i remember)
User guide is here.
In reply to: [Resolved] How to hide more than one profile field?Group exclusion doesn’t work on a single install for the moment (only on MS).
More advice on this here:
https://buddypress.trac.wordpress.org/ticket/5650In reply to: [Resolved] Hide BP Search BarHi @paton400,
give this a try. You can the function to your child-theme’s functions.php or into bp-custom.php
//Remove Buddypress members search function bpfr_remove_member_search_form( $search_form_html){ return ''; } add_filter('bp_directory_members_search_form', 'bpfr_remove_member_search_form' );In reply to: Disable commenting on Mentions in ProfileSurprise! 😀
Here are two functions to achieve your needs. The first can handle several comment possibilities on different activity types.
You can use the second if you only want to deactivate ONE activity type.
May this help !If you need to deactivate comments for several activity types.
function bpfr_remove_updates_commenting($can_comment) { //defining the context if($can_comment == true) : $can_comment = bp_get_activity_action_name(); //just in case of... if(empty($can_comment)) return; //handling the activity types we want to disable //to get other activity type names, go to the DB and check the "type" column in xx_bp_activity table switch($can_comment){ case 'bbp_reply_create': // type name $can_comment = ! ('bbp_reply_create'); break; case 'activity_update': // type name $can_comment = ! ('activity_update'); break; } //action ! return $can_comment; //context end here endif; } add_filter('bp_activity_can_comment', 'bpfr_remove_updates_commenting');This function handles only one activity type: bbp_create_reply. In this example, a topic activity can no more be commented from within the activity screen.
function bpfr_remove_bbp_reply_activity_commenting($can_comment) { if ($can_comment == true) { $can_comment = ! ('bbp_reply_create' == bp_get_activity_action_name()); } return $can_comment; } add_filter('bp_activity_can_comment', 'bpfr_remove_bbp_reply_activity_commenting');In reply to: Translation fails only at "Sitewide Activity"Finally I opened a ticket !
In reply to: Translation fails only at "Sitewide Activity"it’s not the theme
it’s not the translation
seems to be somthing unstable with bp-loader
sometimes i have things translated, sometimes not ! Stuning ! 👿In reply to: Translation fails only at "Sitewide Activity"@shanebp,
forcing a translation is not the best solution, even if it is a solution.
Mine by hacking the core file is not better, as we loose it at the next update.
Your function won’t be loosed, but it should be used by caution, as gettext pass a second time on ALL strings. It’s not dramatical to force the translation for one string, but what will happen if someone use this trick for 20, 50 or more strings ? Performance trouble !I’ll track this further before opening a ticket.
https://codex.wordpress.org/Plugin_API/Filter_Reference/gettext
https://codex.wordpress.org/Plugin_API/Filter_Reference/gettext_with_context