Forum Replies Created
-
In reply to: Adsense on activity stream?
A lot, maybe most BP sites are not commercial.
You may want to create a template overload of this file:
buddypress\bp-templates\bp-legacy\buddypress\activity\entry.phpTo add content to the entries in the activity stream, use this hook in that file:
do_action( 'bp_activity_entry_content' );If you need access to the activity content as part of your ad display decision chain, use the filter hook in
buddypress/bp-activity/bp-activity-template/:
apply_filters_ref_array( 'bp_get_activity_content_body', array( $activities_template->activity->content, &$activities_template->activity ) );In reply to: Buddy Press advice welcomeUsing BP will mean that each user will have at least a basic profile.
You can turn various components on and off – ex. FriendsThe best way to find out if BP is suitable for your site is to create a test site and try it out.
Please use the
codebutton when sharing code.Try:
<?php $cover_image_url = bp_attachments_get_attachment( 'url', array( 'item_id' => bp_loggedin_user_id() ) ); ?> <img src="<?php echo $cover_image_url; ?>">In reply to: Run WP functions in bp-custom.php$bp->displayed_user->idis only available if you are viewing a profile page.And it is better to remove the
global $bpand usebp_displayed_user_id().Try adding a check to see if you are viewing a profile page:
if ( bp_is_user() ) { $post_count = count_user_posts( bp_displayed_user_id(), 'drawings' ); // etc }In reply to: DIsplay the tab “Create on group”If you want it wrapped in an
<li>:echo bp_get_group_create_nav_item();If you just want the button:
echo bp_get_group_create_button();Where you put it is up to you.
Try:
add_action( 'bp_email', function( $email_type, $email_obj ) { $email_obj->set_from( "custom@example.com", "Custom Website Name" ); }, 10, 2 );https://codex.buddypress.org/emails/#filter-from-address-and-name
In reply to: Profiles & Member List: Redirect all subscribers‘subscriber’ is a WP role.
Google ‘wp is user subscriber’Current user id:
bp_loggedin_user_id()In reply to: follow button instead of add friendYou need to do more than add a button – you need a plugin:
https://wordpress.org/plugins/buddypress-followers/If you don’t want Friends functionality, turn off the Friends component:
wp-admin > Settings > BuddyPressIn reply to: Profiles & Member List: Redirect all subscribersDetermine if a user is on the Members list:
if( bp_current_component('members') )Determine if a user is on a profile page:
if ( bp_is_user() )In reply to: Column sender_onlyGrep
sender_onlyinbuddypress/bp-messages.afaik, it provides a field for determining whether a message you send appears in your inbox and is included in total counts and unread counts.
In reply to: Ionic app or other with REST api?This is my favorite solution: WP-AppKit
Love the preview feature.In reply to: Chaning DB prefixTurn on
wp_debugand see what the errors are.In reply to: Most links redirect to homepageThere is most likely a conflict with one of your other plugins.
Try deactivating theme one at a time. Start with ‘Page Links To’.After that, try switching momentarily to a WP theme like 2013 to determine if it is your theme.
In reply to: How do I load BuddyPress functions?bp_displayed_user_domain()only works on profile pages.
Try usingbp_loggedin_user_domain()It worked on my install. In bp-custom.
Were you logged out when you tried it?Remove the link:
function dono_remove_view_link( $latest_update ) { if ( ! is_user_logged_in() ) { $text = preg_replace('/<a href=\"(.*?)\">(.*?)<\/a>/', "\\2", $latest_update); $link_text = esc_attr__( 'View', 'buddypress' ); $latest_update = rtrim($text, $link_text); } return $latest_update; } add_filter( 'bp_get_activity_latest_update', 'dono_remove_view_link', 1, 100 );In reply to: Email situation for account deletionb) If an email can be sent only after a member has been inactive for X number of days.
This may still work with current version of BP:
https://github.com/imath/bp-wake-up-sleepersIn reply to: Hide Members List in Public GroupsPity that the theme needs to be hacke as…
To avoid that, you should be using a child theme.
Or you could put the code in bp-custom.php.In reply to: Additional activity update metaUnless you are explicitly using the BP default theme, I believe you should be using this file:
buddypress\bp-templates\bp-legacy\js\buddypress.jsAnd you should be able to overload that file in your theme.
In reply to: Shortcode to create Edit Profile PageTo fix the redirect loop, try this adjustment to Henry’s code:
add_action( 'swpm_login', function() { if ( bp_is_my_profile() ) return; bp_core_redirect( bp_loggedin_user_domain() ); } );In reply to: Hide Members List in Public GroupsThis will remove the ‘Members’ link on group pages:
function bp_group_remove_members_tab() { if ( ! bp_is_group() ) return; global $bp; if (isset($bp->groups->current_group->slug) && $bp->groups->current_group->slug == $bp->current_item) { $bp->bp_options_nav[$bp->groups->current_group->slug]['members'] = false; } } add_action( 'bp_setup_nav', 'bp_group_remove_members_tab', 999 );You can put it in your theme/functions.php
also – I think there is probably a better way to code this… ?In reply to: Changing the capabilities of adminYou mean group admins?
I don’t think group admins can leave a group.
To remove the ability to delete groups for everyone except site admins, try:
function janhart_remove_group_admin_tab() { if ( ! bp_is_group() || ! ( bp_is_current_action( 'admin' ) && bp_action_variable( 0 ) ) || is_super_admin() ) { return; } // Add the admin subnav slug you want to hide in the following array $hide_tabs = array( 'delete-group' => 1, ); $parent_nav_slug = bp_get_current_group_slug() . '_manage'; // Remove the nav items foreach ( array_keys( $hide_tabs ) as $tab ) { bp_core_remove_subnav_item( $parent_nav_slug, $tab ); } // You may want to be sure the user can't access if ( ! empty( $hide_tabs[ bp_action_variable( 0 ) ] ) ) { bp_core_add_message( 'You are not allowed to delete this group.', 'error' ); bp_core_redirect( bp_get_group_permalink( groups_get_current_group() ) ); } } add_action( 'bp_actions', 'janhart_remove_group_admin_tab', 9 );The capabilities you want to adjust are not related to WP roles.
In reply to: Error using bp_displayed_user_id()You are calling
bp_displayed_user_id()before it is available.Try:
function hadhc_loaded() { if ( bp_is_user() ) { // add your code here and it will only run if on a profile page } } add_action( 'bp_loaded', 'hadhc_landing' );In reply to: Show additional fields on member profile headerThey mean the theme that is currently activated.
In reply to: Show additional fields on member profile headerEdit this file:
buddypress\bp-templates\bp-legacy\buddypress\members\single\member-header.phpIf you have cover images enabled, edit this file:
buddypress\bp-templates\bp-legacy\buddypress\members\single\cover-image-header.phpEither way, you should be creating template overloads.