Replies
- Tosin on February 26, 2024 at 3:18 pm in reply to: Buddyblog limit submissions addon suggestion #51802
Hello Ravi,
I finally think this code work can you review it
add_filter( 'bblpro_user_can_create_post', function ( $can, $user_id, $post_type ) { // Not user's profile, return without modification if ( ! bp_is_my_profile() ) { return $can; } if ( 'post' === $post_type ) { $posts_limit = 5; // Adjust the daily limit as needed $today = date( 'Y-m-d' ); // Get today's date $args = array( 'numberposts' => -1, 'post_type' => $post_type, 'fields' => 'ids', 'author' => $user_id, 'date_query' => array( array( 'after' => $today . ' 00:00:00', 'before' => $today . ' 23:59:59', 'inclusive' => true, ), ), ); $posts_count = get_posts( $args ); if ( ! empty( $posts_count ) && count( $posts_count ) >= $posts_limit ) { $can = false; // User has reached the daily limit } } return $can; }, 15, 3 );
- Tosin on February 26, 2024 at 2:33 pm in reply to: Buddyblog limit submissions addon suggestion #51801
this is a rough work
add_filter( 'bblpro_user_can_create_post', function ( $can, $user_id, $post_type ) { // Check if it's a post creation attempt and the user is logged in. if ( 'post' !== $post_type || ! is_user_logged_in() ) { return $can; } // Get the posts limit. $posts_limit = 1; // Get the last post creation timestamp for the user. $last_post_time = get_user_meta( $user_id, 'last_post_time', true ); // If the last post time is not set or it's been more than 24 hours, reset the counter. if ( empty( $last_post_time ) || strtotime( $last_post_time ) < strtotime( '-1 day' ) ) { // Reset post count. update_user_meta( $user_id, 'post_count', 0 ); update_user_meta( $user_id, 'last_post_time', current_time( 'mysql' ) ); } // Get the current post count for the user. $post_count = get_user_meta( $user_id, 'post_count', true ); if ( $post_count >= $posts_limit ) { $can = false; // User has exceeded the daily limit. } else { // Increment the post count and update the last post time. $post_count++; update_user_meta( $user_id, 'post_count', $post_count ); update_user_meta( $user_id, 'last_post_time', current_time( 'mysql' ) ); } return $can; }, 15, 3 );
The problem is how to not restrict old users who have already published old posts over the post limit. I would have preferred the limit to start afresh for old users
- Tosin on February 26, 2024 at 2:24 pm in reply to: Buddyblog limit submissions addon suggestion #51800
Hello Ravi
I would prefer to limit post creation to 10 per day for all users
Maybe a buddyblog integration with this plugin can help https://wordpress.org/plugins/user-posts-limit/
- Tosin on February 23, 2024 at 3:36 pm in reply to: Buddyblog Pro – add/remove visibility option #51766
Ok Thanks for the detailed explanation, now I understand better
- Tosin on February 21, 2024 at 2:21 pm in reply to: Buddypress Member types pro photo issue with buddypress profile completion #51735
Hello Ravi
Gentle reminder
Thanks
- Tosin on February 21, 2024 at 2:20 pm in reply to: Buddyblog Pro – add/remove visibility option #51734
Hello Brajesh
Please how is development on this alos, would you still consider the follow integration since buddypress devs are considering adding the follow plugin into buddypress core
Thanks
- Tosin on January 27, 2024 at 1:34 pm in reply to: Buddypress Member types pro photo issue with buddypress profile completion #51552
This did not work.
I want all those codes enabled, they all work seamlessly when the feature (Override member avatar) is disabled in the member types pro plugin.
But when the (Override member avatar) feature is enabled new users are no longer forced to upload their profile picture
The Override is acting as if new users have already uploaded their profile photo mean while its meant to behave as if users have not uploaded their first pictures since they newly registered.
- Tosin on January 26, 2024 at 10:23 am in reply to: Buddypress Member types pro photo issue with buddypress profile completion #51547
I using this filter to redirect users to force profile completion
// filter buddypress profile completion redirect url to the (complete-profile) page. add_filter( 'buddypress_profile_completion_redirect', function ( $redirect_url ) { return home_url( '/complete-profile/' ); } );
other codes im using are
// Do not redirect users on user profile and activity directory pages. function buddydev_skip_urls_on_loggedin_user_profile_and_activity_directory_page( $skip ) { if ( bp_is_my_profile() || bp_is_activity_directory() ) { $skip = true; } return $skip; } add_filter( 'bp_force_profile_completion_skip_check', 'buddydev_skip_urls_on_loggedin_user_profile_and_activity_directory_page' ); // Redirect users on members directory pages. function buddydev_skip_urls_on_members_directory( $skip ) { if ( bp_is_members_directory() ) { $skip = false; } return $skip; } add_filter( 'bp_force_profile_completion_skip_check', 'buddydev_skip_urls_on_members_directory' ); // Do not redirect users on non bp pages. function buddydev_skip_redirect_on_non_bp_pages( $skip ) { if ( ! is_buddypress() ) { $skip = true; } return $skip; } add_filter( 'bp_force_profile_completion_skip_check', 'buddydev_skip_redirect_on_non_bp_pages' );
- Tosin on January 25, 2024 at 4:12 pm in reply to: Buddypress Member types pro photo issue with buddypress profile completion #51535
I think there is misunderstanding from start.
My intention is to change the default mystery man avatar based on member type
I enabled the feature to associate custom avatar enabled in the (member types pro) plugin while the (buddypress profile completion) is enabled (user must have profile photo).
THE PROBLEM
Since the default mystery man avatar has been changed buddypress profile completion plugin is no longer forcing members to change their avatar - Tosin on January 17, 2024 at 1:46 pm in reply to: Buddypress Member types pro photo issue with buddypress profile completion #51398
Hello Ravi,
Please note that this issue is not yet resolved, The custom member type photo is not displaying everywhere, it is only showing in the members directory its is not showing in activity and profile pages
Thanks