Buddyblog and mycred delete user's post
-
Hello everybody
I have a social website with buddypress.
Each user can create post with gravity forms and each post is automaticly publish. I use buddyblog to display posts of each user in their account. No backoffice access for them, all in front.
I have the option on buddyblog to give the ability to user to delete their posts. This way under each user’s post, you have the delete button.
Now i have mycred system, each time a user created a post, he receives XXX points. If the user wants to delete one of his post, i need mycred to deduct the same amount of point.
thanks to mycred i found this code
add_action( 'transition_post_status', 'fired_on_post_change_staus', 10, 3 ); function fired_on_post_change_staus( $new_status, $old_status, $post ) { if ( $new_status == 'trash' ) { if ( ! function_exists( 'mycred_add' ) ) return; if ( isset( $post->post_author ) ) { mycred_add( 'deleted_post', $post->post_author, -10, '%plural% deduction for deleted post' ); } } }
Only problem is that with buddyblog option, i can only delete post directly and not trash them. So this function doesn’t work because it deduct points only if post goes to trash.
I need to apply the good conditionnal but `$new_status == ‘delete’ doesn’t exist and my php knowledge are not strong enaugh…
Many thanks for your time
- The topic ‘Buddyblog and mycred delete user's post’ is closed to new replies.