Truncate latest activity in buddypress

You can filter ‘bp_get_activity_latest_update_excerpt’. Sample code, not tested, you will need my function utf8_truncate(): add_filter( ‘bp_get_activity_latest_update_excerpt’, ‘wpse_56860_trim_buddypress_excerpt’ ); function wpse_56860_trim_buddypress_excerpt( $excerpt ) { // Number of characters to show. Adjust this to your needs. $length = 80; // Fix BuddyPress’ wrong quotes. return _x( ‘“’, ‘opening curly double quote’ ) . utf8_truncate( $excerpt, $length ) … Read more

custom post on homepage

You can also use a new query (with php enabled) so show a single post by ID, i.e. the post with ID 101: <?php $my_query = new WP_Query(‘p=101’); ?> <?php while ($my_query->have_posts()) : $my_query->the_post(); ?> <a href=”https://wordpress.stackexchange.com/questions/64210/<?php the_permalink() ?>” title=”<?php the_title(); ?>”> <?php the_title(); ?><?php the_content(); ?></a> <?php endwhile; ?> This can be used multiple … Read more

How to get the group_id from the “groups_join_group” action in buddypress [closed]

$group_id is the first argument passed to groups_join_group action hook function, the second argument is $user_id. You can use these data to obtain group creator_id like: add_action(‘groups_join_group’, ‘my_groups_join_group_action’, 10, 2); function my_groups_join_group_action($group_id, $user_id) { // use $group_id and $user_id here: $group = groups_get_group( array( ‘group_id’ => $group_id ) ); $creator_id = $group->creator_id; }

security issue in wordpress?

You can force all visitors to log in before they are allowed to see the pages. This will not work for attachments. But … if that already is a problem for your site – why did you install WordPress in a publicly accessible directory? You should plan visibility first, then run the installation. Consider HTTP … Read more

WordPress SEO plugin (by Yoast) and BuddyPress [closed]

This is possible using the filter wpseo_breadcrumb_links. In this example, I’m using the functions bp_get_user_meta and bp_loggedin_user_id, adjust as needed. To check if the page is child of the Members page (in this example, ID == 2), I’m using the function has_parent grabbed from here. add_filter( ‘wpseo_breadcrumb_links’, ‘buddy_crumbs_wpse_88889’ ); function buddy_crumbs_wpse_88889( $links ) { // … Read more

Format Buddypress Date Picker Output [closed]

I have no idea if BuddyPress has built in date functions but WordPress does and PHP does. This should do it: $bpress_date = bp_profile_field_data( array(‘user_id’=>get_the_author_meta( ‘ID’ ),’field’=>’birthday’)); // $bpress_date = “1985-10-30 00:00:00”; // test echo date(‘F, j, Y’,strtotime($bpress_date)); PHP’s date expects UNIXTIME. That is why the date string is passed through strtotime. It does not … Read more

Display count of new members registered today [closed]

function bp_registrations_today($activated = false) { global $wpdb; $query = “SELECT COUNT(ID) FROM {$wpdb->prefix}users WHERE DATE(user_registered) = CURDATE()”; if ( $activated ) { $query .= ” AND user_status = 0″; } return $wpdb->get_var($query); } To get the number of users registered today, call the function as echo bp_registrations_today(); To get the number of users registered today … Read more

bp_has_members with custom fields [closed]

Buddypress’ bp_has_members() function accepts several parameters to alter the output. Take a look at the Accepted Parameters section on the codex page regarding the members loop. The two parameter meta_key and meta_value might just be what you’re looking for. The Code Examples section should give you an additional insight in how to do it – … Read more