Tagged: hook
I want to hook my code once the user profile avatar is moderated and approved to get the moderated profile avatar URL.
Which I want to update in usermeta table for custom-built functionality.I found this hook “bpavmod_avatar_approved” by looking into the code but it is not working.
Hi Darren,
Welcome to BuddyDev forums.I had a look at the code and it is working fine for me.
How are you using(It is an action). Please share your code and I will assist.
Regards
Brajeshhere is the sample code.
add_action( ‘bpavmod_avatar_approved’, function($avatar) {
var_dump($avatar); die;
} );This works on the very next manual reload of page “wp-admin/admin.php?page=user-avatar-moderation&action=approve&id=13&nonce=*********” but once the “Approve” button is clicked and page reloads with successful moderation, this code does nothing.
and returning me an instance of the “BPAVMOD_Moderation_Log” class
- This reply was modified 3 years ago by Darren Burn.
Hi Darren,
I am not sure what you want.The code is working fine on approval. Approval happens when you click on the button. The next page is a redirect.
The code works fine as it gives you access to moderation object when you click on approve. The next page is not the approval action. The next page is where you go after successful approval.
If your goal is to access the user id, you can use `$avatar>uploaded_by’
Regards
BrajeshPlease use the following sample code.
add_action( 'bpavmod_avatar_approved', function ( $avatar ) { $url = bp_core_fetch_avatar( array( 'object' => $avatar->item_type, 'item_id' => $avatar->item_id, 'type' => 'full', 'html' => false, ) ); // do something with the $url. } );
Regards
Brajesh
You must be logged in to reply to this topic.