Forum Replies Created
-
In reply to: Display Role as part of Profile
The role ID is the role name.
If you know the possible role names, you can do something like:
$userole = $user->roles[0]; if ( $userole == 'senior-fellow' ); echo 'Senior Fellow'; elseif ( $userole == 'junior-fellow' ); echo 'Junior Fellow'; else echo $userole;In reply to: Display Role as part of Profilefunction dlongm_show_role() { $user = get_userdata( bp_displayed_user_id() ); echo $user->roles[0]; } add_action( 'bp_before_member_header_meta', 'dlongm_show_role' );In reply to: Display Role as part of Profileforeach ( $user->roles as $role ) if ( $role != 'whatever role you want to avoid' && $role != 'another role you want to avoid' ) echo $role;After you submit the form, are you still on the group page?
I doubt that your filter function is aware of the Group.
Can you pass parameters to the shortcode?
If so, pass in the$group_id–$group_id = bp_get_group_id();
Then use it in the filter to get the user ids of group admins
groups_get_group_admins( $group_id );
And use the result to get email addys.In reply to: Display Role as part of Profilehttps://codex.wordpress.org/Function_Reference/get_userdata
Example:
function dlongm_show_role() { $user = get_userdata( bp_displayed_user_id() ); if ( !empty( $user->roles ) && is_array( $user->roles ) ) { foreach ( $user->roles as $role ) echo $role; } } add_action( 'bp_before_member_header_meta', 'dlongm_show_role' );In reply to: double information on profileTo confirm that is it or is not an issue with your theme, try switching momentarily to a WP theme like 2013.
If you have any plugins that affect profile data, try deactivating them.
Same file you used for your code.
You can also use bp_parse_args. It’s probably more appropriate given that you want to affect various templates.
Don’t check each member in the while loop – very inefficient and things like pagination will be buggy. Just get the members you want.
Try something like this:$test_role_array = get_users( array( 'fields' => 'ID', 'role' => 'testing' ) ); $test_role_csv = implode(",", $test_role_array). $exclude_testing = 'exclude=' . $test_role_csv; if ( bp_has_members( $exclude_testing ) ) // etcYou can add profile fields via wp-admin > Users > Profile Fields
You can search those fields with this plugin:
https://wordpress.org/plugins/bp-profile-search/In reply to: Trying to get property of non-objectMy guess is that another plugin or some custom code or your theme is trying to apply a filter to
bp_get_the_profile_field_idbut the$fieldis not available.Try deactivating any plugins that deal with profile fields.
To confirm that the issue is in your theme, try switching momentarily to a WP theme like 2013.
In reply to: subject in private messageAsk Kleo how to add BP templates in a Kleo child theme.
In reply to: Adding Text to account details on registration siteCreate a template overload of this file:
buddypress\bp-templates\bp-legacy\buddypress\members\register.phpAnd add your text.
In reply to: subject in private messagedo i need to change anything in below function?
Maybe – it needs to output an url like this:
http://yourdomain.com/members/acengiz/messages/compose/?r=member-login-name&subject=Testing&_wpnonce=d5e2ace8d7rneeds to be the login name of that member.In reply to: subject in private messagePlease use the
codebutton when sharing code.Why would you add a
formtag? Don’t.<input type="text" name="subject" id="subject" value="<?php if ( isset( $_GET['subject'] ) ) echo $_GET['subject']; else bp_messages_subject_value(); ?>" />In reply to: Hide some fields on Registration formSeems to be a WangGuard field.
Your question pertains to bbPress, not BuddyPress.
The bbPress support forum is here.Anyhow…
The filter hook you want is inbbpress\includes\common\functions.phpapply_filters( 'bbp_forum_subscription_mail_message', $message, $topic_id, $forum_id, $user_id );function jorrit_filter_forum_topic_message_email( $message, $topic_id, $forum_id, $user_id ) { $message = wp_trim_words( $message, 15 ); // change 15 to however many words you want return $message; } add_filter( 'bbp_forum_subscription_mail_message', 'jorrit_filter_forum_topic_message_email', 10, 4 );In reply to: subject in private messageCreate a template overload of this file:
buddypress\bp-templates\bp-legacy\buddypress\members\single\messages\compose.phpAnd adjust the
subjectinput field so that it looks for your$_GETvariable.In reply to: A dynamic linkbp_loggedin_user_domain() . 'media';In reply to: Best Practice For CusomizationIf your customizations are theme-specific, then theme/functions.php and theme/buddypress are the places for your code.
You can put code in bp-custom.php, but it will run regardless of which theme is active.
In reply to: Jomsocial to buddypressDuplicate – closed.
In reply to: Getting user_ids from database errorGlad you got it working.
One issue is that you assume this prefix
wp_.
It may work for you, but to avoid that assumption do this:"SELECT user_id FROM {$wpdb->prefix}bp_xprofile_data…etcIn reply to: Profile Photo not showing in activity ?If you want somebody to examine your site, you need to provide a user / pw.
Your issue may be related to your theme.
To confirm, try switching momentarily to a WP theme like 2013 and see if the problem persists.In reply to: Getting user_ids from database error‘WordPress database error: [Unknown column ‘user_id’ in ‘field list’]’
There is no
user_idfield inbp_xprofile_fields.
The correct table isbp_xprofile_data.valueis a text field, so you need quotes:AND value = '45'";Instead of
AND value !empty";tryAND value != ''";$wpdb->get_varreturns a single value. Try$wpdb->get_col.Your issues could have been solved by examining the table structure and reading reference docs like https://codex.wordpress.org/Class_Reference/wpdb.