// هدایت نقش “sarparast-support” به لیست کاربران “customer” یا “poshtiban” function redirect_sarparast_support_to_customers_page() { if ( is_admin() && current_user_can(‘sarparast-support’) ) { global $pagenow; if ( ‘users.php’ == $pagenow ) { // اگر هیچ نقشی تعیین نشده است، کاربر را به صفحه…Continue reading
function add_custom_message_with_updated_styles_and_text() { ?>Continue reading
// افزودن ستون “عناوین خریداری شده” add_filter(‘woocommerce_my_account_my_orders_columns’, ‘add_order_details_column_custom’); function add_order_details_column_custom($columns) { // اضافه کردن ستون بعد از ستون وضعیت $new_columns = []; foreach ($columns as $key => $name) { $new_columns[$key] = $name; if ($key === ‘order-status’) { $new_columns[‘order-details’] = ‘محصول’;…Continue reading
add_action(‘admin_head’, function () { echo ‘ ‘; });Continue reading
// Function to duplicate a menu function duplicate_menu_action() { // Check if the action is to duplicate a menu if (isset($_GET[‘action’]) && $_GET[‘action’] === ‘duplicate_menu’ && isset($_GET[‘menu_id’])) { // Verify the user has the required capability if (!current_user_can(‘edit_theme_options’)) { wp_die(__(‘You…Continue reading
// Delete from WordPress when deleted in Formidable add_action(‘frm_before_destroy_entry’, ‘delete_user_with_entry’); function delete_user_with_entry($entry_id) { $form_id = 2; // Replace 2 with the ID of your form $field_id = 180; // Replace 6 with the ID of your userID field $entry =…Continue reading
function convert_to_cst_for_import( $utc ) { if ( empty( $utc ) ) return ”; try { $dt = new DateTime( $utc, new DateTimeZone( ‘UTC’ ) ); $dt->setTimezone( new DateTimeZone( ‘America/Chicago’ ) ); // CST/CDT auto-handled return $dt->format( ‘Y-m-d H:i:s’ ); }…Continue reading