Forum Replies Created
Have you got pretty permalinks enabled? Do your other pages all load correctly (posts / pages / archives) with the correct permalinks?
You can add the following template to your theme to override how members profile are displayed: /buddypress/members/single/index.php
In that index.php you can include different template parts to display the user based on their role.
So, you’d have a template part to display writers, and a different template part to display subscribers.
You can read more on the template hierarchy here: https://codex.buddypress.org/themes/theme-compatibility-1-7/template-hierarchy/
Changing these titles isn’t the easiest thing, but BuddyPress does provide 2 ways you can do it. However, hacking core files like bp-activity-loader.php is definitely not one of them. [Never hack core files — have a Google if it’s not obvious to you why you shouldn’t]
Ok the 2 solutions are:
- Use a language / translation file
- Use the template hierarchy
The string “Site-Wide Activity” is translatable — all the strings are. You can implement a language file that translates ‘Site-Wide Activity’ into whatever string you’d like. Have a search for translating BuddyPress strings / POT files / poedit. There’s also a documentation (they call it the Codex) page on it: https://codex.buddypress.org/getting-started/customizing/customizing-labels-messages-and-urls/
The second solution is to use the template hierarchy. If you don’t provide a specific template for your activity directory, BuddyPress will use the page.php file from your theme and ‘inject’ the title “Site-Wide Activity” where page.php makes a call to the_title().
You can override this by implementing your own template — create a file called index-directory.php inside /buddypress/activity in your site’s theme. Copy the basics of page.php into that file, and replace the_title() with your hardcoded title for the page.
You can read more about the template hierarchy here: https://codex.buddypress.org/themes/theme-compatibility-1-7/template-hierarchy/
Neither solution is simple, you’ll either have to get your head around using poedit, or need some basic PHP coding skills and an understanding of the principles of templates and themes in WordPress. In the future, it would be nice to see a settings panel in wp-admin to configure these basic strings.
[p.s. if you don’t want to use poedit, you could take a look at plugin solutions for string translation, e.g. codestyling localisation]
Correction — you can also use bp_group_name() by passing a group to it as its argument.
Take your group_id, instantiate a group, and pass it to bp_group_name():
$args = array( 'group_id' => $my_id ); $group = groups_get_group( $args ); .. bp_group_name( $group);
For a loop like that you can use bp_has_groups() instead of groups_get_user_groups(). Is there a reason why you rejected that approach?
Then a my groups widget can have a simple core like this:
<?php if ( bp_has_groups( 'type=alphabetical&user_id=' . bp_loggedin_user_id() ) ) : ?> <ul id="my-groups-list"> <?php while ( bp_groups() ) : bp_the_group(); ?> <li class="row collapse"> <div class="item-avatar small-3 columns"> <a href="<?php bp_group_permalink() ?>"><?php bp_group_avatar_thumb() ?></a> </div> <div class="item small-9 columns"> <div class="item-title"><a href="<?php bp_group_permalink() ?>" title="<?php bp_group_name() ?>"><?php bp_group_name() ?></a></div> </div> </li> <?php endwhile; ?> </ul> <?php else: ?> <div class="widget-error"><?php _e( 'No current groups.', 'my-groups-widget' ); ?></div> <?php endif; ?>
Note: If you want to use functions like bp_group_name(), you need to be inside a bp_has_groups() loop. The loop and bp_the_group() instantiate structures in the group template that are then used by bp_group_name.
If you want to use groups_get_user_groups() and setup your own loop, you’ll need to use different functions to access the name, permalink, etc. Look in bp-groups-functions.php, bp-groups-template.php and in bp-group-classes.php to get an idea what’s available.
or even easier for the displayed user id:
That’s more of an s2member question than a BuddyPress one – so, better asked on their forums.
In your PHP template for displaying the user, you can add the following code:
echo get_user_field('s2member_access_label', $user_id);
and to get the $user_id for the displayed user, you can use:
global $bp; $user_id = $bp->displayed_user->id;
@strangechild — there is some documentation here: https://codex.buddypress.org/themes/theme-compatibility-1-7/theme-compatibility-2/
The intro is confusing, but if you jump to the second section, it tells you where to find files and where they need to be added to your theme, if you want to override them.
ok.. props to @hnla
Defining the constant BP_ENABLE_MULTIBLOG in bp-custom.php fixed the problem.
@boone – any thoughts on this vs. enabling BP on a site by site basis (as suggested as preferable in your in file comments)? Is activity / members / groups, etc. shared when BP is activated separately for each site?
If you look in the implementation bp_has_activities(), you’ll see if no user id is supplied as an argument it will default to the displayed_user id on a member page.
See lines 316 and 382 of bp-activity-template.php
If you’re on a non member page it will show activity relative to the logged in user (line 382).
Try passing the logged in user id as an argument to your bp_has_activities() call, that should override the displayed user default on a member page.
Duplicate of other thread: https://buddypress.org/support/topic/hide-the-followingfollowers-tabs-from-non-profile-owners/
We’ve used WP FB Autoconnect on a lot of BuddyPress sites – https://wordpress.org/plugins/wp-fb-autoconnect/
There’s a functional free version, and just a few dollars extra for the pro version
Sounds like you are using an old / outdated plugin with a recent version of BuddyPress.
Looks like called wp-cache might be the problem — see if this link helps you https://wordpress.org/support/topic/advanced-cachephp-problems-on-upgrade
Maybe I’m just confused by the naming:
I know I can do this by creating my own class named BP_Legacy in my theme and customising, but this doesn’t seem a correct approach.
Is the BP_Legacy class supposed to behave like a pluggable function? i.e. you are expected to redeclare the class with the same name?
On a separate but related matter — if I want to create a completely bespoke theme (not theme compat), how do I stop an instance of BP_Legacy being created and registering its actions?
I’ve tried declaring add_theme_support(‘buddypress’) hooked on to ‘after_setup_theme’, but that doesn’t stop an instance of BP_Legacy being constructed and registering its actions.
Looking at the BP_Theme_Compat constructor, it would appear that add_theme_support(‘buddypress’) should stop it — does it need to be hooked on to something earlier than ‘after_setup_theme’?
You shouldn’t be using Genesis Connect with current versions of BuddyPress.
From the Genesis Connect developer:
As of BP 1.7 you do not need to have GenesisConnect. We are currently maintaining it for customers who had BP installs prior to BP 1.7.
Yes, had looked at the implementation in the default BP components, and ‘gotten’ my head around it.
Good to get confirmation that this is the right approach for 3rd party as well.
thanks, yes, BuddyDrive looks to have the ‘correct’ solution.
It creates a BP_Theme_Compat class for the component – the same approach that the internal components (Groups, Activity, etc.) do.
Resurrecting an old thread, but we encountered the same problem on 1.7 install, and fixed in same way.
I note the problem doesn’t seem to occur on testbp.org
We had problems upgrading a large site – see: https://buddypress.org/support/topic/wsod-in-wp-admin-activating-site-tracking-upgrade-from-1-2-9-1-5/
I assume some BP script in the backend was timing out.
We solved by:
1. exporting our users / user_meta table. Leaving just the admin user
2. upgrading BP
3. Reimporting the users
This worked fine. The problem only occurred if all the users were present during the actual upgrade process.
Depending where the links are being added / submitted, you might also be able to add a filter in your PHP code to strip them out.
@r-a-y — looks like your reply and my edit with thanks crossed!
Have the solution — the code to implement the BP_Legacy class in buddypress-functions.php had changed between beta and full release.
I needed to update the buddypress-functions.php file in our theme to match these changes.
@r-a-y: thanks for getting back to me. Yes, this is a considerable build based on the new theming approach — it’s been about 4 months in development (with a number of devs involved). We’d seen it through a number of alpha / betas of 1.7, so was a bit of a shock when the WSOD appeared! Anyway, that problem sorted now.
@shanebpdev – sorry, just seen your comment. Thanks for the feedback.
The client is partnered with a publishing company, and uses the publishing company’s servers — unfortunately, I don’t have too many details on the specification — concentrating on the development side of this project.
At one stage, we had considerable server problems (when we were handling 100 / 1000s of new member registrations each day). I suspect though that this was due in no small part to the number of DB queries being fired off on each page view. Hopefully, that issue is considerably reduced with 1.7+. We’re still 1.6.x for Enterprise Nation.
Problem is that groups_create_group() doesn’t set the total_member_count — so subsequent calls to set up the Groups Template fail to load the groups.
We worked around by explicitly setting: groups_update_groupmeta( $group_id, ‘total_member_count’, (int) groups_get_groupmeta( $group_id, ‘total_member_count’) + 1 );
Will add to trac as bug.