Tibetan | Software Engineer | Application Dev
Edit User Profile Redundancy
Edit User Profile Redundancy

Edit User Profile Redundancy

// Redirect WooCommerce checkout page to a custom thank you page
add_action( ‘woocommerce_thankyou’, ‘pfwp_redirect_woo_checkout’);
function pfwp_redirect_woo_checkout( $order_id ){
$order = wc_get_order( $order_id );
$url = ‘https://resultrna.wpengine.com/my-account/view-order/’. get_last_order_id();
if ( ! $order->has_status( ‘failed’ ) ) {
wp_safe_redirect( $url );
exit;
}
}

// add_action( ‘woocommerce_admin_order_data_after_billing_address’, ‘wpblog_order_customer_information’);
// function wpblog_order_customer_information( $order ){
// global $post;

// $customer_user = get_post_meta( $post->ID, ‘_customer_user’, true );
// echo ‘<p><strong style=”display: block;”>’.__(‘Order Customer name’).’:</strong> <a href=”/user-edit.php?user_id=’ . $customer_user . ‘”>’ . get_user_meta( $customer_user, ‘customername’, true ) . ‘</a></p>’;
// }

 

function awb_remove_user_profile_fields_with_css() {
//Hide unwanted fields in the user profile
$fieldsToHide = [
‘rich-editing’,
‘admin-color’,
‘comment-shortcuts’,
‘admin-bar-front’,
‘user-login’,
‘role’,
‘super-admin’,

//’first-name’,
//’last-name’,
‘nickname’,
‘display-name’,
//’email’,
‘description’,
//’pass1′,
//’pass2′,
‘sessions’,
‘capabilities’,
‘syntax-highlighting’,
‘url’,
‘facebook’,
‘instagram’,
‘linkedin’,
‘myspace’,
‘pinterest’,
‘soundcloud’,
‘tumblr’,
‘twitter’,
‘youtube’,
‘wikipedia’,
‘application-passwords-section’
];

//add the CSS
foreach ($fieldsToHide as $fieldToHide) {
echo ‘<style>tr.user-‘.$fieldToHide.’-wrap{ display: none; }</style>’;
}

//fields that don’t follow the wrapper naming convention
echo ‘<style>tr.user-profile-picture{ display: none; }</style>’;

//all subheadings
echo ‘<style>#your-profile h2{ display: none; }</style>’;
}
add_action( ‘admin_head-user-edit.php’, ‘awb_remove_user_profile_fields_with_css’ );
add_action( ‘admin_head-profile.php’, ‘awb_remove_user_profile_fields_with_css’ );

Leave a Reply

Your email address will not be published. Required fields are marked *

0
    0
    Your Cart
    Your cart is emptyReturn to Shop
      Calculate Shipping
      Apply Coupon