Forum Replies Created
-
@r-a-y This is what I came up with and the echo prints out this “Banned Users: Array” am I even close? lol
function my_bp_update_post_add_cppoints() {
global $bp;
$bpcpspam = array($bpcpspamlist);$getspamlist = get_option( ‘bp_spammer_cp_bp’ );
$bpcpspamlist = explode(“,”, $getspamlist);echo(‘Banned Users: ‘ . $bpcpspamlist . “
“);if ($bp->loggedin_user->id != get_option( ‘bp_spammer_cp_bp’ ) ) {
foreach ($bpcpspam as $bpcpspamlist) {
if( function_exists(‘cp_alterPoints’) ){
cp_alterPoints($bp->loggedin_user->id, get_option(‘bp_update_post_add_cp_bp’) );
cp_log(‘Comment’, $bp->loggedin_user->id, get_option(‘bp_update_post_add_cp_bp’), BuddyPress);
}
}
}
}
add_action(‘bp_activity_posted_update’,’my_bp_update_post_add_cppoints’);Here are the results:
File Count: 0
Path: /home/tosh/public_html/3blogtest/wp-content/uploads/avatars/59Cuz I’m still learning PHP, sorry
I’m really grateful for your help btw!That did work! 
If a admin where to put in more than one user id separated by a comma like:59, 120, 33
etc. How would I accomplish that from the input field on the admin backend.
Cool thank. I tried to upload 2 avatars. Still gives points. It gave an error with your original code. I just changed it slightly to this.
function my_bp_avatar_add_cppoints() {
global $bp;$path = BP_AVATAR_UPLOAD_PATH . ‘/avatars/’ . $bp->loggedin_user->id;
$filecount = count(glob(“” . $path . “*.jpg”));
// this means that the user only has one avatar
if($filecount <= 2) {
if( function_exists(‘cp_alterPoints’) && is_user_logged_in() ){
cp_alterPoints(cp_currentUser(), get_option(‘bp_avatar_add_cp_bp’) );
cp_log(‘Avatar Uploaded’, cp_currentUser(), get_option(‘bp_avatar_add_cp_bp’), BuddyPress);
}
}
}
add_action(‘xprofile_avatar_uploaded’, ‘my_bp_avatar_add_cppoints’ );Tried going about this another way. Still not working correctly. Says user id 59 is not a spammer, but that user is marked as so. Any ideas?
I tried to echo it out. Nothing comes out for the user id ..
echo(‘User ID: ‘ . $bp->loggedin_user->id . “n”);/* *********************** START Spammmer! ********************************* */
global $bp;
// 59 for testing
// if( $bp->loggedin_user->id == get_option(‘bp_spammer_cp_bp’)){global $current_user;
global $user_id;if ($userinfo->ID == 59) {
function my_bp_update_post_add_cppoints() {
if( function_exists(‘cp_alterPoints’) && is_user_logged_in() ){
cp_alterPoints(cp_currentUser(), 0 );
cp_log(‘Comment’, cp_currentUser(), 0, BuddyPress);
echo ‘spammer
‘;
echo(‘User ID: ‘ . $user_info->ID . “n”);
}
}
add_action(‘bp_activity_posted_update’,’my_bp_update_post_add_cppoints’);} else {
// Add Points for a update
function my_bp_update_post_add_cppoints() {
if( function_exists(‘cp_alterPoints’) && is_user_logged_in() ){
cp_alterPoints(cp_currentUser(), get_option(‘bp_update_post_add_cp_bp’) );
cp_log(‘Comment’, cp_currentUser(), get_option(‘bp_update_post_add_cp_bp’), BuddyPress);
echo ‘spam free
‘;
echo(‘User ID: ‘ . $user_info->ID . “n”);
}
}
add_action(‘bp_activity_posted_update’,’my_bp_update_post_add_cppoints’);}
/* *********************** END Spammmer! ********************************* */I tried this as well. Not the desired outcome.
if ( !$no_grav ) {
Went back to this, because I’m sure I am getting closer .. When I test this with an account has an existing avatar, it still gives me points.
// Avatar Anti-Spam
global $bp;
$avatar_dir = ‘avatars’;
$avatar_dir = apply_filters( ‘bp_core_avatar_dir’, $avatar_dir, $object );
$item_id = $bp->displayed_user->id;
$object = ‘user’;$avatar_folder_url = apply_filters( ‘bp_core_avatar_folder_url’, str_replace( WP_CONTENT_DIR, BP_AVATAR_URL, BP_AVATAR_UPLOAD_PATH ) . ‘/’ . $avatar_dir . ‘/’ . $item_id, $item_id, $object, $avatar_dir );
$avatar_folder_dir = apply_filters( ‘bp_core_avatar_folder_dir’, BP_AVATAR_UPLOAD_PATH . ‘/’ . $avatar_dir . ‘/’ . $item_id, $item_id, $object, $avatar_dir );if ( file_exists( $avatar_folder_dir ) ) {
// Avatar has been upload so zero points// ZERO Points for Avatar Upload if they already uploaded at least 1
function my_bp_avatar_add_cppoints() {
if( function_exists(‘cp_alterPoints’) && is_user_logged_in() ){
cp_alterPoints(cp_currentUser(), 0 );
cp_log(‘Avatar Uploaded’, cp_currentUser(), 0, BuddyPress);
echo ‘zero points’;
}
}
add_action(‘xprofile_avatar_uploaded’,’my_bp_avatar_add_cppoints’);} else {
// Add Points Avatar Upload
function my_bp_avatar_add_cppoints() {
if( function_exists(‘cp_alterPoints’) && is_user_logged_in() ){
//cp_alterPoints(cp_currentUser(), get_option(‘bp_avatar_spam_add_cp_bp’) );
cp_alterPoints(cp_currentUser(), get_option(‘bp_avatar_add_cp_bp’) );
cp_log(‘Avatar Uploaded’, cp_currentUser(), get_option(‘bp_avatar_add_cp_bp’), BuddyPress);
echo ‘add points’;
}
}
add_action(‘xprofile_avatar_uploaded’,’my_bp_avatar_add_cppoints’);}
I had that a little higher in my code, but I added another.
Edit: Tried that code you just added. Same

I’ll try again next week. Going out of town for the weekend tomorrow
$avatar_dir = ‘avatars’;
$item_id = $bp->displayed_user->id;
$object = ‘user’;$avatar_folder_url = apply_filters( ‘bp_core_avatar_folder_url’, str_replace( WP_CONTENT_DIR, BP_AVATAR_URL, BP_AVATAR_UPLOAD_PATH ) . ‘/’ . $avatar_dir . ‘/’ . $item_id, $item_id, $object, $avatar_dir );
$avatar_folder_dir = apply_filters( ‘bp_core_avatar_folder_dir’, BP_AVATAR_UPLOAD_PATH . ‘/’ . $avatar_dir . ‘/’ . $item_id, $item_id, $object, $avatar_dir );f ( file_exists( $avatar_folder_dir ) ) {
// Run code if user hasn’t uploaded a avatar
} else {
// Run code if they have a avatar uploaded already
}
Correct? Thanks for your help Ray.
I just copied over this stuff:
$avatar_folder_url = apply_filters( ‘bp_core_avatar_folder_url’, str_replace( WP_CONTENT_DIR, BP_AVATAR_URL, BP_AVATAR_UPLOAD_PATH ) . ‘/’ . $avatar_dir . ‘/’ . $item_id, $item_id, $object, $avatar_dir );
$avatar_folder_dir = apply_filters( ‘bp_core_avatar_folder_dir’, BP_AVATAR_UPLOAD_PATH . ‘/’ . $avatar_dir . ‘/’ . $item_id, $item_id, $object, $avatar_dir );I’ll tinker later.. feels like it’s getting closer at least lol
I tried this:
if ( file_exists( $avatar_folder_dir ) ) {
// Run code if user hasn’t uploaded a avatar
} else {
// Run code if they have a avatar uploaded already
}
It thinks they uploaded a avatar either way. I created a new user and uploaded a avatar and it ran the else.
Interesting idea, how would I got about checking if a user_id folder is there?
The avatars folder for each person user id is here:
/wp-content/uploads/avatars/678/found this code online.. trying to think how to modify it to find the “wp-content” folder to start out on.
WP_CONTENT_DIR
https://codex.wordpress.org/Determining_Plugin_and_Content_Directories$dirname = $_POST[“DirectoryName”];
$filename = “/folder/{$dirname}/”;if (file_exists($filename)) {
echo “The directory {$dirname} exists”;
} else {
mkdir(“folder/{$dirname}”, 0777);
echo “The directory {$dirname} was successfully created.”;
}@stwc I’ve been keeping that old favorite link open in a tab in a separate browser i don’t use much so I don’t loose those, lol.
What about adding a table to a database that says this user has uploaded at least 1 avatar? And based on if that’s true.
So something like this?
If avatar is uploaded
run this and tag them in the database that they uploaded a avatar
else
run this
No go, very odd ..
Is this right?
global $bp;
if( $bp->loggedin_user->id == ’59’ ){I did actually, still shows the spammer as spam free.
Tried that but now it treats the spammer and the person not marked as spam. As spam free.
Check out CubePoints Buddypress Integration

Version 1.6.2 is live! Main update is support for BuddyPress Gifts. [Change log]
Version 1.6.1 is live! Check out the change log.
Version 1.5.1 is now live. Adds support for the BuddyPress Links Plugin by Marshall Sorenson (MrMaz) and for sending messages. Adds a very basic admin page. Still in the process of getting a fully functional one working. I may need help with this..
@mrmaz Just added support for your plugin to my “CubePoints Buddypress Integration” plugin
I’m using the following do_action’s (bp_links_create_complete, bp_links_cast_vote_success, bp_links_posted_update, bp_links_delete_link). So if you ever change them please let me know because it will stop working on my plugin.[Update] Version 1.6.1 embeds it in for you now

I just got points, donate link and rank (if enabled) displaying on the BuddyPress Profile
You’ll have to edit 1 file though. Here is the updated code.So how it displays on mine is:
User @ user
1635 points [Donate Points] Expertactive 6 hours, 32 minutes ago
Cancel Friendship
Mention this User
Send Private MessageHow would I incorporate this into my plugin though? I got this to show up on the profile. But it’s not where I want it, how would I control it without just editing the file directly.