Skip to content

Instantly share code, notes, and snippets.

View yawalkar's full-sized avatar
🏠
Working from home

Nitin Yawalkar yawalkar

🏠
Working from home
View GitHub Profile
@yawalkar
yawalkar / functions.php
Last active September 26, 2022 14:39
Upload base64 encoded image to WordPress using FlowMattic
<?php
/**
* Save the base64 encoded image in WP.
*
* @param string $title Image title without extension.
* @param string $base64_img Base64 encoded image string.
*/
function flowmattic_save_base64_image( $title, $base64_img ) {
// Upload dir.
@yawalkar
yawalkar / function.php
Created September 12, 2022 13:14
Get user details on logout with custom action
add_action( 'wp_logout', 'flowmattic_custom_logout' );
function flowmattic_custom_logout( $user_id ) {
$user_details = array();
$current_user = get_user_by( 'ID', $user_id );
$user_details['username'] = $current_user->user_login;
$user_details['user_email'] = $current_user->user_email;
$user_details['user_first_name'] = $current_user->user_firstname;
$user_details['user_last_name'] = $current_user->user_lastname;
$user_details['user_display_name'] = $current_user->display_name;