Created
September 23, 2015 03:44
-
-
Save SeanChDavis/7f4ae0ee60fe83ae1274 to your computer and use it in GitHub Desktop.
EDD FES Use Vendor Display Name As Store Name
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // DO NOT COPY THIS LINE | |
/** | |
* User vendor's display name for store name if unedited | |
*/ | |
function sd_fes_store_name_username() { | |
if ( class_exists( 'EDD_Front_End_Submissions' ) ) { | |
$the_vendor = wp_get_current_user(); | |
$vendor_name = get_user_meta( $the_vendor->ID, 'display_name', true ); | |
$vendor_store_name = get_user_meta( $the_vendor->ID, 'name_of_store', true ); | |
if ( ! $vendor_store_name ) { | |
update_user_meta( $the_vendor->ID, 'name_of_store', $vendor_name ); | |
} | |
} | |
} | |
add_action( 'init', 'sd_fes_store_name_username' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment