Forum Replies Created
-
Yes indeed, there is a way.
Step by step tutorial with example code which you add to bp-custom.
Note: use this code as is and follow the instruction. Once you understood what it does and how it works, you will be able to modify it to your needs.First, create a new xprofile field in the first group field (aka Base Group and containing Name as default field). Only fields created in that group are visible on the register page. Call it Type, enter description and choose multiselectbox as field type. Add operator, vendor, coach as select option.
That’s all for the register part handled by BuddyPress.
Now we need to declare the whole thing to get it work on front-end.
Member-type is an additionnal functiony to select members by… type ! Not by role, not by latest, mst popular or anything else. Just (for the moment) by a custom type of your choice.We have to built a member directory for our types. We have 3 types and they will be shown on 3 new tabs on that directory.
1) we formally declare the member types
2) we count members by type (to stay correctly informative on the directory)
3) we display the tabsfunction using_mt_register_member_types() { bp_register_member_type( 'operator', array( 'labels' => array( 'name' => __( 'Operators', 'using-mt' ), 'singular_name' => __( 'Operator', 'using-mt' ), ), ) ); bp_register_member_type( 'vendor', array( 'labels' => array( 'name' => __( 'Vendors', 'using-mt' ), 'singular_name' => __( 'Vendor', 'using-mt' ), ), ) ); bp_register_member_type( 'coach', array( 'labels' => array( 'name' => __( 'Coaches', 'using-mt' ), 'singular_name' => __( 'Coach', 'using-mt' ), ), ) ); } add_action( 'bp_init', 'using_mt_register_member_types' ); function using_mt_count_member_types( $member_type = '', $taxonomy = 'bp_member_type' ) { global $wpdb; $member_types = bp_get_member_types(); if ( empty( $member_type ) || empty( $member_types[ $member_type ] ) ) { return false; } $count_types = wp_cache_get( 'using_mt_count_member_types', 'using_mt_bp_member_type' ); if ( ! $count_types ) { if ( ! bp_is_root_blog() ) { switch_to_blog( bp_get_root_blog_id() ); } $sql = array( 'select' => "SELECT t.slug, tt.count FROM {$wpdb->term_taxonomy} tt LEFT JOIN {$wpdb->terms} t", 'on' => 'ON tt.term_id = t.term_id', 'where' => $wpdb->prepare( 'WHERE tt.taxonomy = %s', $taxonomy ), ); $count_types = $wpdb->get_results( join( ' ', $sql ) ); wp_cache_set( 'using_mt_count_member_types', $count_types, 'using_mt_bp_member_type' ); restore_current_blog(); } $type_count = wp_filter_object_list( $count_types, array( 'slug' => $member_type ), 'and', 'count' ); $type_count = array_values( $type_count ); if ( empty( $type_count ) ) { return 0; } return (int) $type_count[0]; } function using_mt_display_directory_tabs() { $member_types = bp_get_member_types( array(), 'objects' ); // Loop in member types to build the tabs foreach ( $member_types as $member_type ) : ?> <li id="members-<?php echo esc_attr( $member_type->name ) ;?>"> <a href="<?php bp_members_directory_permalink(); ?>"><?php printf( '%s <span>%d</span>', $member_type->labels['name'], using_mt_count_member_types( $member_type->name ) ); ?></a> </li> <?php endforeach; } add_action( 'bp_members_directory_member_types', 'using_mt_display_directory_tabs' );We also need to sort the members list on each type tab using the loop scope.
function using_mt_set_has_members_type_arg( $args = array() ) { // Get member types to check scope $member_types = bp_get_member_types(); // Set the member type arg if scope match one of the registered member type if ( ! empty( $args['scope'] ) && ! empty( $member_types[ $args['scope'] ] ) ) { $args['member_type'] = $args['scope']; } return $args; } add_filter( 'bp_before_has_members_parse_args', 'using_mt_set_has_members_type_arg', 10, 1 );And we finally clean the cache to stay up to date with the output
function using_mt_clean_count_cache( $term = 0, $taxonomy = null ) { if ( empty( $term ) || empty( $taxonomy->name ) || 'bp_member_type' != $taxonomy->name ) { return; } wp_cache_delete( 'using_mt_count_member_types', 'using_mt_bp_member_type' ); } add_action( 'edited_term_taxonomy', 'using_mt_clean_count_cache', 10, 2 );That’s all for a members directory page showing All Members and tabed Members by type.
If you want to show the type of a member on his profile header, use this:
function using_mt_member_header_display() { $member_type = bp_get_member_type( bp_displayed_user_id() ); if ( empty( $member_type ) ) { return; } $member_type_object = bp_get_member_type_object( $member_type ); ?> <p class="member_type"><?php echo esc_html( $member_type_object->labels['singular_name'] ); ?></p> <?php } add_action( 'bp_before_member_header_meta', 'using_mt_member_header_display' );Or if you want to display the type under each user avatar on the member directory, you can use this snippet. Note: was originally made to add a geoloc shortcode below the member type. I let it as is, so you can see how it’s done.
function who_are_you_directory() { // by member_type name + geoloc (wpgeo me) $user = bp_get_member_user_id(); $terms = bp_get_object_terms( $user, 'bp_member_type' ); if ( ! empty( $terms ) ) { if ( ! is_wp_error( $terms ) ) { foreach( $terms as $term ) { echo '<p>' . $term->name . '</p>'; echo do_shortcode('[gmw_member_info]'); } } } } add_filter ( 'bp_directory_members_item', 'who_are_you_directory' );Anything inspired by Codex and heavy topics reading.
May this help.
In reply to: Unable to select a group privacy optionDon’t jump into other topics when you have an unrelated question to that topic.
Activate 2015 theme and see if you get the missing radio buttons.
In reply to: Remove Hidden or Public type of group?You can remove the creation option from the template. You have to do this from within a child theme by using a template overload.
Concerned file is bp-templates/bp-legacy/buddypress/groups/create.php
Part to remove for the “hidden” option is
<label> <input type="radio" name="group-status" value="hidden"<?php if ( 'hidden' == bp_get_new_group_status() ) { ?> checked="checked"<?php } ?> /> <strong><?php _e('This is a hidden group', 'buddypress' ); ?></strong> </label> <ul> <li><?php _e( 'Only users who are invited can join the group.', 'buddypress' ); ?></li> <li><?php _e( 'This group will not be listed in the groups directory or search results.', 'buddypress' ); ?></li> <li><?php _e( 'Group content and activity will only be visible to members of the group.', 'buddypress' ); ?></li> </ul>In reply to: How to customize labels ?Ok, now we need more details about what is appearing on your register page.
– do you use a register plugin ?
– what is your theme name ?
– which tool have you used to generate the mo file ?In reply to: How to customize labels ?Yeap, and is your WP setup for en_US ? See Settings > General > Site language
In reply to: How to customize labels ?Don’t hijack other topics please. Moved your question to it’s own topic.
What have you done ? it’s probably because you did it wrong, this happens while learning.
In reply to: Buddypress pages don’t work at allAnswered on similar question of yours
https://buddypress.org/support/topic/install-issue-menu-hrefs-dont-work/#post-239502In reply to: [Resolved] Install issue: menu hrefs don’t workRead the manual …
In reply to: Extending group fieldsNothing ready to use avaible at the moment. Depends of your coding level…
An old plugin, don’t know if it is still working: bp group reviews
A different one, maybe: buddypress groups extras
And a little read of the codex:Good luck !
Have you tested this plugin ?
https://wordpress.org/plugins/buddypress-upload-avatar-ajax/In reply to: Problem repairing Activate & Register pagesDefault output for register and activate page is a selectbox set to — None —
As long as you haven’t allowed user registration and manually created these page, no button will be shown.
Aside it could be related to your theme. Try using 2014 or 2015 before scrubbling with CSS hacks.
In reply to: Urgent: Turning my site into https is not workingDepends where wp is installed ! Usually at site root.
See your WP settings (settings > general) if unsure.
Remember also that BuddyPress does not work on installations where you give WordPress its own directory.i’m part of the one percenter who cares about well formed urls and a basic system which is working on 23% of www’s sites !
If you have enhancement ideas, feel free to post in the appropriate forum or open a ticket on Trac.
BP is only a WP plugin and doesn’t handle registration. On the other hand, WP use a very short registering form, containing 3 fields: username, email and password.
First and last name are optionnal fields on the standard WP user profile. These fields are not mandatory, never appear on the registration page and it’s in the freedom of everyone to use them or not. When BP is installed, he provides a mandatory Name field, which can be used to enter a username or a first/last name.
Even if i have no percentage to give you, i’m pretty sure that almost all users are satisfied to use a CMS which doesn’t ask them for real names at first ! And why not their address, blood group, gran’mother nickname or their mom’s phone number ?
This are privacy options, and WP is smart enough to not abuse of such things, by default. Smart enough also to use the simpliest existing register routine, like all other major web operators, a username, a valid email and an encrypted password.
Anything else is matter of flexibility, one of the major interrest to use BuddyPress. And definetly no, not all communities have members who knows each others. Don’t make you the spokeman of such behalf speculation. 😉
I think you’re confused by system requirements and your own desires. To get it clear for the register aspect, read here please.
Oh, and the answer to your question is here:
In reply to: Urgent: Turning my site into https is not workingbasic htaccess for a single install look’s like this:
(assuming your root site is hxxp://your-site.com)# CONFIG SINGLE #<IfModule mod_rewrite.c> #RewriteEngine On #RewriteBase / #RewriteRule ^index\.php$ - [L] #RewriteCond %{REQUEST_FILENAME} !-f #RewriteCond %{REQUEST_FILENAME} !-d #RewriteRule . /index.php [L] #</IfModule>Perhaps you made it wrong ? How did you create the mo file ? What is your site language and theme ?
If you’re talking about extended profile field groups, only the Base (Primary) Field Group shows up in the Registration Form.
In reply to: Change "activity" slug3 mounth later….
just tested the defines and they’re working ! You have a cote error in above code. 😉Try this:
define( 'BP_ACTIVITY_SLUG', 'activitissima' );Remind also that BP’s activity page, defined in BP settings, must be empty, without shortcodes, template or page model. Just a title. These pages are dynamic, not static like normal WP pages.
If you need to modifiy it, use a template override.If you still want to understand, please read here:
https://buddypress.org/support/topic/changing-slugs-with-bp-custom-php-no-change/In reply to: Remove friend notifications for all activity pageThe function should be in one file only. And you are using a cache. Clear it !
This core function has no filter. The easiest way is to use a language translation file.
https://codex.buddypress.org/developer/customizing/customizing-labels-messages-and-urls/
In pot file, the concerned string Members is commented by [ component directory title ].
In reply to: Static Front Page ProblemsDoes register and activate pages exist ? Page must exist and be blank (no associated templates or model)
Have you setup pretty permalinks ?
Do you use a custom redirect function somewhere ?Function doc says:
* @param array $result Results of user validation including errors, if any.
Original function fires$result = array( 'user_name' => $user_name, 'user_email' => $user_email, 'errors' => $errors, );Try
function validate_user_signup( $result ) { // the modified code and at least something like return $result; } add_filter( 'bp_core_validate_user_signup', 'validate_user_signup' );In reply to: Post button is not showingit’s intended so. The button will only show up when you click inside the textbox.
Also, it seems you use BP Default theme. Do you know that you can use any other themme since BP 1.7 ?
Aside of renaming folders coming from github, you can’t use this plugin with your BP 1.5.3.1 and WP 3.3.1 version.
MediaPress requires at least: WP 3.9 & BuddyPress 2.0
Update your install first or find another solution.
In reply to: How to avoid spam registration in buddypressPlease read the doc, according to plugins description:
WangGuard Always will be free for personal use, this means that whenever you have less than 5,000 daily registrations or you make less than $200/month, you never have to pay anything for WangGuard.
thank you for your help, but please, don’t give a 4 years old solution without testing it.
At first, the snippet contains cote errors, and second, it doesn’t work with BP 2.x, as things has changed.You can easily modify your template loop by using bp_parse_args function.
Here a working example (activity-update is commented – uncomment to see the difference)
You simply have to list what to show. Anything not listed will be ignored, on all activity feeds.
Add this to bp-custom.php or child theme functions.php
function my_bp_activities_include_activity_types( $retval ) { // only allow the following activity types to be shown $retval['action'] = array( // 'activity_update', 'activity_comment', 'new_blog_post', 'new_blog_comment', 'friendship_created', 'created_group', ); return $retval; } add_filter( 'bp_after_has_activities_parse_args', 'my_bp_activities_include_activity_types' );