Forum Replies Created
-
I just needed to change the priority of the add_action to something higher…
Thanks a lot.
count me in…
brentschroeder1963
Some month ago, I change my registration process, and become spam free.
Just sometimes, I had a spam registration, but thy never had a user role.
Also I never get a registration mail.
And they not able to create a blog, or even post.
But this morning I have a new user: brentschroeder1963
Also with registration mail, a new blog …..
brentschroeder1963
@ John James Jacoby,
I had a look in the bp-events-avatar.php to understand more what’s going on there.
I’m thinking the avatar part could be like it is now.
It would be enough, if the original resized image would be available.
I did some changes to the bp-events-avatar.php and make a plugin from it.
For the moment, I will use the modified functions in custom components until you offer a better way to do it. I think it would be really great if the original resized image would be saved by the core.
Be careful!
This Plugin is just a play around on a fun buddypress installation.
<?php
/*
Plugin Name:bp-events-avatar
Description: This plugin add a template tag bp_event_flyer() to display the event flyer
Version: 0.0.1
License: GPL
*/
function bp_event_flyer( $args = '' ) {
echo bp_get_event_flyer( $args );
}
function bp_get_event_flyer( $args = '' ) {
global $bp, $events_template;
$defaults = array(
'type' => 'org',
'width' => 'auto',
'height' => 'auto',
'class' => 'avatar',
'id' => false,
'alt' => __( 'Event avatar', 'bp-events' )
);
$r = wp_parse_args( $args, $defaults );
extract( $r, EXTR_SKIP );
/* Fetch the avatar from the folder, if not provide backwards compat. */
if ( !$avatar = bp_event_fetch_avatar( array( 'item_id' => $events_template->event->id, 'object' => 'event', 'type' => $type, 'avatar_dir' => 'event-avatars', 'alt' => $alt, 'css_id' => $id, 'class' => $class, 'width' => $width, 'height' => $height ) ) )
$avatar = '<img src="' . attribute_escape( $events_template->event->avatar_thumb ) . '" class="avatar" alt="' . attribute_escape( $events_template->event->name ) . '" />';
return apply_filters( 'bp_get_event_flyer', $avatar );
}
/*
Based on contributions from: Beau Lebens - http://www.dentedreality.com.au/
Modified for BuddyPress by: Andy Peatling - http://apeatling.wordpress.com/
*/
/***
* Set up the constants we need for avatar support
*/
if ( !defined( 'BP_AVATAR_THUMB_WIDTH' ) )
define( 'BP_AVATAR_THUMB_WIDTH', 50 );
if ( !defined( 'BP_AVATAR_THUMB_HEIGHT' ) )
define( 'BP_AVATAR_THUMB_HEIGHT', 50 );
if ( !defined( 'BP_AVATAR_FULL_WIDTH' ) )
define( 'BP_AVATAR_FULL_WIDTH', 150 );
if ( !defined( 'BP_AVATAR_FULL_HEIGHT' ) )
define( 'BP_AVATAR_FULL_HEIGHT', 150 );
if ( !defined( 'BP_AVATAR_ORIGINAL_MAX_WIDTH' ) )
define( 'BP_AVATAR_ORIGINAL_MAX_WIDTH', 450 );
if ( !defined( 'BP_AVATAR_ORIGINAL_MAX_FILESIZE' ) )
define( 'BP_AVATAR_ORIGINAL_MAX_FILESIZE', get_site_option( 'fileupload_maxk' ) * 1024 );
if ( !defined( 'BP_AVATAR_DEFAULT' ) )
define( 'BP_AVATAR_DEFAULT', BP_PLUGIN_URL . '/bp-xprofile/images/none.gif' );
if ( !defined( 'BP_AVATAR_DEFAULT_THUMB' ) )
define( 'BP_AVATAR_DEFAULT_THUMB', BP_PLUGIN_URL . '/bp-xprofile/images/none-thumbnail.gif' );
function bp_event_fetch_avatar( $args = '' ) {
global $bp, $current_blog;
$defaults = array(
'item_id' => false,
'object' => 'user', // user OR group OR blog OR custom type (if you use filters)
'type' => 'thumb',
'avatar_dir' => false,
'width' => false,
'height' => false,
'class' => 'avatar',
'css_id' => false,
'alt' => __( 'Avatar Image', 'buddypress' ),
'no_grav' => false // If there is no avatar found, return false instead of a grav?
);
$params = wp_parse_args( $args, $defaults );
extract( $params, EXTR_SKIP );
if ( !$item_id ) {
if ( 'user' == $object )
$item_id = $bp->displayed_user->id;
else if ( 'group' == $object )
$item_id = $bp->groups->current_group->id;
else if ( 'blog' == $object )
$item_id = $current_blog->id;
$item_id = apply_filters( 'bp_core_avatar_item_id', $item_id, $object );
if ( !$item_id ) return false;
}
if ( !$avatar_dir ) {
if ( 'user' == $object )
$avatar_dir = 'avatars';
else if ( 'group' == $object )
$avatar_dir = 'group-avatars';
else if ( 'blog' == $object )
$avatar_dir = 'blog-avatars';
$avatar_dir = apply_filters( 'bp_core_avatar_dir', $avatar_dir, $object );
if ( !$avatar_dir ) return false;
}
if ( !$css_id )
$css_id = $object . '-' . $item_id . '-avatar';
if ( $width )
$html_width = " width='{$width}'";
else
$html_width = ( 'thumb' == $type ) ? ' width="' . BP_AVATAR_THUMB_WIDTH . '"' : ' width="' . BP_AVATAR_FULL_WIDTH . '"';
if ( $height )
$html_height = " height='{$height}'";
else
$html_height = ( 'thumb' == $type ) ? ' height="' . BP_AVATAR_THUMB_HEIGHT . '"' : ' height="' . BP_AVATAR_FULL_HEIGHT . '"';
$avatar_folder_url = apply_filters( 'bp_core_avatar_folder_url', get_blog_option( BP_ROOT_BLOG, 'siteurl' ) . '/' . basename( WP_CONTENT_DIR ) . '/blogs.dir/' . BP_ROOT_BLOG . '/files/' . $avatar_dir . '/' . $item_id, $item_id, $object, $avatar_dir );
$avatar_folder_dir = apply_filters( 'bp_core_avatar_folder_dir', WP_CONTENT_DIR . '/blogs.dir/' . BP_ROOT_BLOG . '/files/' . $avatar_dir . '/' . $item_id, $item_id, $object, $avatar_dir );
/* If no avatars have been uploaded for this item, display a gravatar */
if ( !file_exists( $avatar_folder_dir ) && !$no_grav ) {
if ( empty( $bp->grav_default->{$object} ) )
$default_grav = 'wavatar';
else if ( 'mystery' == $bp->grav_default->{$object} )
$default_grav = BP_PLUGIN_URL . '/bp-core/images/mystery-man.jpg';
else
$default_grav = $bp->grav_default->{$object};
if ( $width ) $grav_size = $width;
else if ( 'full' == $type ) $grav_size = BP_AVATAR_FULL_WIDTH;
else if ( 'thumb' == $type ) $grav_size = BP_AVATAR_THUMB_WIDTH;
if ( 'user' == $object ) {
$ud = get_userdata( $item_id );
$grav_email = $ud->user_email;
} else if ( 'group' == $object || 'blog' == $object ) {
$grav_email = "{$item_id}-{$object}@{$bp->root_domain}";
}
$grav_email = apply_filters( 'bp_core_gravatar_email', $grav_email, $item_id, $object );
$gravatar = apply_filters( 'bp_gravatar_url', 'https://secure.gravatar.com/avatar/' ) . md5( $grav_email ) . '?d=' . $default_grav . '&s=' . $grav_size;
return apply_filters( 'bp_core_fetch_avatar', "<img src='{$gravatar}' alt='{$alt}' id='{$css_id}' class='{$class}'{$html_width}{$html_height} />", $params );
} else if ( !file_exists( $avatar_folder_dir ) && $no_grav )
return false;
/* Set the file names to search for to select the full size or thumbnail image. */
$avatar_name = ( 'org' == $type ) ? '-bporg' : '-bpthumb';
$avatar_name = ( 'full' == $type ) ? '-bpfull' : $avatar_name;
$legacy_user_avatar_name = ( 'full' == $type ) ? '-avatar2' : '-avatar1';
$legacy_group_avatar_name = ( 'full' == $type ) ? '-groupavatar-full' : '-groupavatar-thumb';
if ( $av_dir = opendir( $avatar_folder_dir ) ) {
while ( false !== ( $avatar_file = readdir($av_dir) ) ) {
if ( preg_match( "/{$avatar_name}/", $avatar_file ) || preg_match( "/{$legacy_user_avatar_name}/", $avatar_file ) || preg_match( "/{$legacy_group_avatar_name}/", $avatar_file ) )
$avatar_url = $avatar_folder_url . '/' . $avatar_file;
}
}
closedir($av_dir);
return apply_filters( 'bp_core_fetch_avatar', "<img src='{$avatar_url}' alt='{$alt}' id='{$css_id}' class='{$class}'{$html_width}{$html_height} />", $params );
}
function bp_events_delete_existing_avatar( $args = '' ) {
global $bp;
$defaults = array(
'item_id' => false,
'object' => 'user', // user OR group OR blog OR custom type (if you use filters)
'avatar_dir' => false
);
$args = wp_parse_args( $args, $defaults );
extract( $args, EXTR_SKIP );
if ( !$item_id ) {
if ( 'user' == $object )
$item_id = $bp->displayed_user->id;
else if ( 'group' == $object )
$item_id = $bp->groups->current_group->id;
else if ( 'blog' == $object )
$item_id = $current_blog->id;
$item_id = apply_filters( 'bp_core_avatar_item_id', $item_id, $object );
if ( !$item_id ) return false;
}
if ( !$avatar_dir ) {
if ( 'user' == $object )
$avatar_dir = 'avatars';
else if ( 'group' == $object )
$avatar_dir = 'group-avatars';
else if ( 'blog' == $object )
$avatar_dir = 'blog-avatars';
$avatar_dir = apply_filters( 'bp_core_avatar_dir', $avatar_dir, $object );
if ( !$avatar_dir ) return false;
}
if ( 'user' == $object ) {
/* Delete any legacy meta entries if this is a user avatar */
delete_usermeta( $item_id, 'bp_core_avatar_v1_path' );
delete_usermeta( $item_id, 'bp_core_avatar_v1' );
delete_usermeta( $item_id, 'bp_core_avatar_v2_path' );
delete_usermeta( $item_id, 'bp_core_avatar_v2' );
}
$avatar_folder_dir = apply_filters( 'bp_core_avatar_folder_dir', WP_CONTENT_DIR . '/blogs.dir/' . BP_ROOT_BLOG . '/files/' . $avatar_dir . '/' . $item_id, $item_id, $object, $avatar_dir );
if ( !file_exists( $avatar_folder_dir ) )
return false;
if ( $av_dir = opendir( $avatar_folder_dir ) ) {
while ( false !== ( $avatar_file = readdir($av_dir) ) ) {
if ( ( preg_match( "/-bpfull/", $avatar_file ) || preg_match( "/-bpthumb/", $avatar_file ) || preg_match( "/-bporg/", $avatar_file ) ) && '.' != $avatar_file && '..' != $avatar_file )
@unlink( $avatar_folder_dir . '/' . $avatar_file );
}
}
closedir($av_dir);
@rmdir( $avatar_folder_dir );
do_action( 'bp_core_delete_existing_avatar', $args );
return true;
}
function bp_events_avatar_handle_crop( $args = '' ) {
global $bp;
$defaults = array(
'object' => 'user',
'avatar_dir' => 'avatars',
'item_id' => false,
'original_file' => false,
'crop_w' => BP_AVATAR_FULL_WIDTH,
'crop_h' => BP_AVATAR_FULL_HEIGHT,
'crop_x' => 0,
'crop_y' => 0
);
$r = wp_parse_args( $args, $defaults );
extract( $r, EXTR_SKIP );
if ( !$original_file )
return false;
if ( !file_exists( WP_CONTENT_DIR . '/' . $original_file ) )
return false;
if ( !$item_id )
$avatar_folder_dir = apply_filters( 'bp_core_avatar_folder_dir', WP_CONTENT_DIR . dirname( $original_file ), $item_id, $object, $avatar_dir );
else
$avatar_folder_dir = apply_filters( 'bp_core_avatar_folder_dir', WP_CONTENT_DIR . '/blogs.dir/' . BP_ROOT_BLOG . '/files/' . $avatar_dir . '/' . $item_id, $item_id, $object, $avatar_dir );
if ( !file_exists( $avatar_folder_dir ) )
return false;
require_once( ABSPATH . '/wp-admin/includes/image.php' );
require_once( ABSPATH . '/wp-admin/includes/file.php' );
/* Delete the existing avatar files for the object */
bp_core_delete_existing_avatar( array( 'object' => $object, 'avatar_path' => $avatar_folder_dir ) );
/* Make sure we at least have a width and height for cropping */
if ( !(int)$crop_w )
$crop_w = BP_AVATAR_FULL_WIDTH;
if ( !(int)$crop_h )
$crop_h = BP_AVATAR_FULL_HEIGHT;
/* Set the full and thumb filenames */
$full_filename = wp_hash( $original_file . time() ) . '-bpfull.jpg';
$thumb_filename = wp_hash( $original_file . time() ) . '-bpthumb.jpg';
$org_filename = wp_hash( $original_file . time() ) . '-bporg.jpg';
/* Crop the image */
$full_cropped = wp_crop_image( WP_CONTENT_DIR . $original_file, (int)$crop_x, (int)$crop_y, (int)$crop_w, (int)$crop_h, BP_AVATAR_FULL_WIDTH, BP_AVATAR_FULL_HEIGHT, false, $avatar_folder_dir . '/' . $full_filename );
$thumb_cropped = wp_crop_image( WP_CONTENT_DIR . $original_file, (int)$crop_x, (int)$crop_y, (int)$crop_w, (int)$crop_h, BP_AVATAR_THUMB_WIDTH, BP_AVATAR_THUMB_HEIGHT, false, $avatar_folder_dir . '/' . $thumb_filename );
rename (WP_CONTENT_DIR . $original_file, $avatar_folder_dir . '/' . $org_filename );
/* Remove the original */
@unlink( WP_CONTENT_DIR . $original_file );
return true;
}
?>Thanks allot @ all,
It helps me to make my decision.
I will wait until the end of the day
For a moment it looks like a tasty meal.
And I want to eat it without thinking.
I’m so hungry of a Media Gallery for buddypress

tomorrow will be big
In the moment, I do what Andy has offered above.
Members:
<?php echo bp_core_fetch_avatar(
'item_id=' . get_the_author_id() . '&type=full&width=100&height=100' ) ?>Groups:
<?php echo bp_core_fetch_avatar( 'item_id=' . bp_get_the_site_group_id()
. '&object=group&type=full&width=100&height=100' ) ?>Just I think this is the same as doing it in the css.
I like to know how to change the original size at the moment when its created.
But I don’t want to define these with custom values in wp-config.php.
I’m looking for a solution to have control of the Avatar size in custom components.
for example: In the bp-events Plugin, I would like to change the Avatar format to a Flyer format.
Most of the Event Flyer, people want to upload, do not feed the Avatar size from Buddypress.
So they just get a cuted piece of there flayer.
I relay would like to change this.
Is it possible to use Kaltura in groups and other components if needed.
There must be a way to implement kaltura in other components so people are able to develop based on the kaltura plugin. Similar to the wire, forum components and so on.
Thanks a lo for your help, its working now.
I did it like this:
first I need to change the body class:
<?php
function new_body(){
return 'directory forums';
}
add_filter( 'body_class', 'new_body', 0, 2 );
?>and then I need to modify the index.php from the forum directory.
with the modified version I can call the forum directory everywhere.
<?php include (STYLESHEETPATH . '/directories/forums/index.php'); ?><?php
global $site_groups_template;
$defaults = array(
'type' => 'type=most-forum-topics&max=6',
'per_page' => 10,
'max' => 6
);
$r = wp_parse_args( $args, $defaults );
extract( $r, EXTR_SKIP );
// type: active ( default ) | random | newest | popular
if ( $max ) {
if ( $per_page > $max )
$per_page = $max;
}
$site_groups_template = new BP_Groups_Site_Groups_Template( $type, $per_page, $max );
?>
<?php if ( $site_groups_template->has_groups() ) : ?>….
could it be possible, that just from my user account the activity stream has stop working?
Now I try to use my favorites to find my active topics. But I also have no favorites button in my profile.
If i use the url https://buddypress.org/forums/profile/svenl77/favorites
I see my favorites.
It’s not easy to use the forum for me like this.
any idea?
Hi JasonG, thanks for your help.
You wrote: Here is the case breakout of the types.
Where did you find this? Do you have a function name for me?
I still have problems to bring it to work. Hire is the original function from the parent theme on the forum index page. It calls bp_has_site_groups( ‘type=most-forum-topics&max=6’ )
If I look into this function I cant find the switch case from your post.
How to use groups_get_by_most_forum_topics()??
Do you have an example?
I’m looking forwart to your replay!
<?php if ( bp_has_site_groups( 'type=most-forum-topics&max=6' ) ) : ?>
<div id="popular-group-forum-listing">
<h3><?php _e( 'Popular Group Forums', 'buddypress' ) ?></h3>
<?php do_action( 'bp_before_directory_popular_group_forums' ) ?>
<?php while ( bp_site_groups() ) : bp_the_site_group(); ?>
<div class="group-forum">
<div class="item-avatar">
<a href="<?php bp_the_site_group_link() ?>/forum/"><?php bp_the_site_group_avatar_thumb() ?></a>
</div>
<div class="item">
<div class="item-title"><a href="<?php bp_the_site_group_link() ?>/forum/"><?php bp_the_site_group_name() ?></a> (<?php bp_the_site_group_forum_topic_count( 'showtext=true' ) ?>, <?php bp_the_site_group_forum_post_count( 'showtext=true' ) ?>)</div>
<div class="item-meta desc"><?php bp_the_site_group_description_excerpt() ?></div>
<?php do_action( 'bp_directory_popular_group_forums_item' ) ?>
</div>
</div>
<?php endwhile; ?>
<?php do_action( 'bp_after_directory_popular_group_forums' ) ?>
</div>
<?php endif; ?>Yes i know.
It is in the plugin and not in the plugin/buddypress folder.
I don’t know, but for me it looks like this could be the same error I have with the forum directory.
I posted my question hire, but no replay till now.
I installed the plugin for testing purpose and I didn’t like it at all.
The chat software it self is nice stuff.
Build by https://blueimp.net/ajax/
I daunt like to have advertising stuff integrated. And there is add-sense in this Plugin.
I think this is not the finest way of making money.
If you want to test it, you need to install the chat client too.
For me it look like you just installed the plugin.
Go to the plugin directory. There must be a directory chat. Go in there and read the readme file.
After you fallow the instillation process of the chat software.
You will be able to chat and the Page will show up.
You will need to enter your mysql connection information.
I don’t know, but I think it is the best not to use the wordpress database for this.
Actually it is not a plugin and has nothing to do with wordpress it self.
The chat has its own connection to the db.
SOME HELP PLEASE!!!
I’m very confused.
If I look into the function, I can’t find the parameter ” most-forum-topics “.
There is just active ( default ) | random | newest | popular.
But its working in the directory/forums view.
function bp_has_site_groups( $args = '' ) {
global $site_groups_template;
$defaults = array(
'type' => 'active',
'per_page' => 10,
'max' => false
);
$r = wp_parse_args( $args, $defaults );
extract( $r, EXTR_SKIP );
// type: active ( default ) | random | newest | popular
if ( $max ) {
if ( $per_page > $max )
$per_page = $max;
}
$site_groups_template = new BP_Groups_Site_Groups_Template( $type, $per_page, $max );
return apply_filters( 'bp_has_site_groups', $site_groups_template->has_groups(), &$site_groups_template );
}Is there nobody how could help me?
Is it a bug or what I’m doing wrong? In the docs it says place the script in the bp-custom.php in your plugin directory.
That’s exactly what I did
https://codex.buddypress.org/how-to-guides/modifying-the-buddypress-admin-bar/
I will update the plugin for 1.1.1
The plugin was made for a early beta of buddypress and is not programmed properly.
I’s a quick and dirty try.
I just started to rebuild my template for the new theme architecture.
Next step will be to rewrite the Seo for Buddypress Plugin and extend it properly.
Thanks a lot Travel-junkie, its working now!
Thanks a lot Andy,
get_stylesheet_directory_uri() points me to the child theme directory. This is exactly what I was looking for.
One question……….
There must be a way to handling this situation. I have the same on my site.
And I think everybody has the same situation.
If you are a registered user and you click on this link:
https://buddypress.org/wp-admin
you will get to the wpmu Dashboard.
If you try to click somewhere, you will get to a 404.
But if you write a new article from the Quick Press, it is working…
if you use this url, you will see all posts from Andy and your own one.
https://buddypress.org/wp-admin/edit.php
I think the normal user couldn’t get to this place.
It’s is very confusing…
Because I need it and I don’t want spend much time getting into it, I just use the static way. May be not the correct way to do it, but for me it’s working.
<script type=”text/javascript”>
function check_search_url() {
var form = document.getElementById(‘search-form’);
var which = document.getElementById(‘search-which’);
var terms = document.getElementById(‘search-terms’);
if( which.selectedIndex == 0 ) {
form.setAttribute(“action”,”http://yourdomain.com/?s=”+terms.value) ;
}
}
</script>
<form id=”search-form” method=”post” action=”http://yourdomain.com/search”>
<input type=”text” value=”” name=”search-terms” id=”search-terms”/>
<select id=”search-which” name=”search-which”>
<option value=”blog”>Blog</option>
<option value=”blogs”>Blogs</option>
<option value=”members”>Mitglieder</option>
<option value=”groups”>Gruppen</option>
<option value=”forum”>Forum</option>
</select>
<input type=”submit” onclick=”check_search_url()” value=”Suche” id=”search-submit” name=”search-submit”/>
</form>
I found the problem, but I do not understand it.
Could somebody please give me some information about way it is working now?
If I go to wp-content/plugins/buddypress/bp-core/bp-core-settings.php
on line 27 an comment out require_once( WPINC . ‘/registration.php’ );
All is running without error.
I can change my password.
tray this deep integration script instead, this should fix your problem.
if ( !defined( ‘ABSPATH’ ) & !defined( ‘XMLRPC_REQUEST’ )) {
define( ‘WP_USE_THEMES’, false );
include_once( ‘/your/absolute/path/to/wordpress/wp-config.php’ );
$wp->init();
$wp->register_globals();
There is a bug in the deep integration script
if ( !defined( ‘ABSPATH’ ) & !defined( ‘XMLRPC_REQUEST’ )) {
define( ‘WP_USE_THEMES’, false );
include_once( ‘/your/absolute/path/to/wordpress/wp-blog-header.php’ );
header( “HTTP/1.1 200 OK†);
header( “Status: 200 All rosy†);
It looks like everything is working fine, but a user from the german buddypress forum ( mt ) find out, that wordpress overwrites the buddypress header and so there comes header 200 back and often it is a 302 or even a 404.
this is the new script from mt.
if ( !defined( ‘ABSPATH’ ) & !defined( ‘XMLRPC_REQUEST’ )) {
define( ‘WP_USE_THEMES’, false );
include_once( ‘/your/absolute/path/to/wordpress/wp-config.php’ );
$wp->init();
$wp->register_globals();
I post it hire because I think it must be interesting for everyone. In fact it is really important for seo and the german forum is far away from hire…
Thanks for the replay,
It’s working now.
@ Nicola, I want to know more details. Where can I find the Information about the changes in 1.1 Is there a special place I have to look for ?
Ok, I really want to know it. It is already a test for me.
What, if this happens to me on a live site. I want to handle this error without loosing the running installation.
I deleted all buddypress files and renewed all with a fresh download of buddypress. The error is still there.
The same I did with mu. I deleted all mu files except the wp-content folder.
but the error still accursed.
So I think it must be the db.
I tried to change my password from the admin aria, there I can change my password without problem.
But from the profile site, I get a blank page.
Some idea ?
hi Jeff Sayre, I did the hole thing…. but I still can’t change the password.
I copied the db and data to a new working domain for messing around.
I switched to the default home and member theme. Turned off all plugins and deleted all mu plugins.
Any idea? the rest of mu and buddypress is doing his job correct…..