Forum Replies Created
-
In reply to: Batch create group pages
For 400 groups, write a function.
Some old info, might still work:
https://buddypress.org/support/topic/resolved-programmatically-creating-a-group/In reply to: Activity stream based on locationSo you want to filter activity items based on geo-data.
Have you looked at https://codex.buddypress.org/?s=activity+loop
Specifically re bp_parse_args and custom filters.But first, how would you assign geo-data to an activity item?
There is an activity_meta table you should be able to use for storage viabp_activity_update_meta()In reply to: Activity stream based on locationWhat determines relevance? A field? Keywords?
Try this:
$args = array( 'group_id' => bp_get_group_id(), 'exclude_admins_mods' => false, ); $members = groups_get_group_members( $args ); foreach( $members['members'] as $member ) { echo $member->display_name . '<br/>'; } // for reference, show all the data echo '<pre>'; var_dump( $members ); echo '</pre>';bp_is_my_profile()returns a bool.In reply to: Buddypress Avatar in Nav Menubp_displayed_user_link()andbp_displayed_user_avataronly work on a profile page.Instead use:
bp_loggedin_user_domain()andbp_loggedin_user_avatar().Use this function
groups_get_group_members.Try this somewhere in your groups-loop file:
$members = groups_get_group_members(); var_dump( $members );Handling layout and display is up to you.
In reply to: Feature Request: Filterable xProfile Field LabelsDid you try using:
apply_filters( 'bp_get_the_profile_field_name', $field->name );
and / or
apply_filters( 'bp_get_the_profile_field_is_required', (bool) $retval );
from bp-xprofile\bp-xprofile-template.php ?In reply to: How to change font color for group description?a little incontinence
It might be a little inconvenient, but nothing that will require a diaper.
It’s easy to add modified versions of these 2 files to a buddypress folder in your theme – then change or add a css class to the description.
bp-templates\bp-legacy\buddypress\groups\groups-loop.php
bp-templates\bp-legacy\buddypress\groups\single\group-header.phpInfo re template overloading:
In reply to: BuddyPress Members Ajax FilterIn reply to: Add New User Activity on Button ClickYes you need a function.
To call the function on change, you need to use ajax.
https://codex.wordpress.org/AJAXUse the WP function
https://codex.wordpress.org/Function_Reference/wp_update_termIn reply to: Add New User Activity on Button ClickOn button click, use a page refresh or ajax to fire a function that calls bp_activity_add.
In reply to: How to Modify Content Before Saving if to DBYou’re using that hook incorrectly.
What do you think$argsrepresents in your function?Here is the hook, from bp-activity\bp-activity-functions.php
do_action( 'bp_activity_posted_update', $r['content'], $r['user_id'], $activity_id );
Notice that it passes3separate arguments.
And$contentis not one of them.
And there is no scope for a return.
And that hook runsafterthe activity has been created, so even if your function was less malformed, it wouldn’t work as you expect.The correct hook is called earlier in the same function as the hook you’re using.
$add_content = apply_filters( 'bp_activity_new_update_content', $activity_content );
Adjust$activity_contentand return it.In reply to: Users extended profile field content not showing.There are, unfortunately, two sets of user data.
Your imported data was placed in the _usermeta table.
This data will show in wp-admin > users > user > profileBuddyPress uses different tables: _xprofile_
This data will show in wp-admin > users > user > extended profile
And on the front end while viewing a member profile.You may want to write a script that migrates from usermeta to xprofile.
Study the structure of the tables used for xprofile.In reply to: bp_loggedin_user_id() is always 0What hook are you using?
Try:
function anika_test() { echo 'logged in ID: ' . bp_loggedin_user_id(); echo '<br>some field: ' . xprofile_get_field_data('some field name', bp_loggedin_user_id() ); } add_action( 'bp_ready', 'anika_test' );bp_displayed_user_id()needs to be called in the context of a profile.
Look at the template files for an appropriate hook.In reply to: BP_Group_Member_Query type alphabeticalIt’d be a lot easier to answer your questions if you were explicit about the functions you’re using, for example:
bp_group_list_admins()Since it’s called in a template, overload the template and make a call to your own version of that function that sets ‘type’ to whatever you want.
In reply to: BP_Group_Member_Query type alphabeticalBP_Group_Member_Query is a class extension of BP_User_Query
Take a look at the code examples here:In reply to: Accessing Original $wp_queryDid you read: https://codex.buddypress.org/developer/the-bp-global/
In reply to: Accessing Original $wp_queryDid you try:
bp_get_group_slug();In reply to: get group owner during group loopThere are several functions re the group creator that are available in the groups loop.
For example:bp_group_creator_username()
Look in bp-groups\bp-groups-template.phpIn reply to: Hide the whole Base profile field groupTry this…
Make a template overload of this file:
bp-templates\bp-legacy\buddypress\members\single\profile\profile-loop.phpIn that new file, change this:
<?php while ( bp_profile_groups() ) : bp_the_profile_group(); ?>to this, assuming the id of your base group is 1
<?php while ( bp_profile_groups() ) : bp_the_profile_group(); ?> <?php if( bp_get_the_profile_group_id() != 1 ) : ?>And add an
<?php endif; ?>before the<?php endwhile; ?>near the bottom of the page.Do the same for:
bp-templates\bp-legacy\buddypress\members\single\profile\edit.phpIn reply to: Creating a Member DirectoryIf you mean add a link to navigation, you can do that via …/wp-admin/nav-menus.php
If you want to add it elsewhere, it’s just a simple link.
It sounds like you are having trouble adding the link in a specific place.
So you need to be specific about that place.In reply to: Creating a Member Directory>…the page I created for the Members.
How did you create that page?
You should just create a page titled ‘Members’. The page should be blank.
You then assign that page to the Members component through Settings > BuddyPress
You should then be able to see a listing of all active members by visiting:
…yoursite.com/members/Or is your issue just about navigation?
In reply to: Passing xprofile user data to prefill formsPlease use the
codebutton.You need to include the user id:
echo xprofile_get_field_data( 'Undergraduate College/University', $current_user->ID );