Type: php
PHP: Prevent Apostrophe in Email
/* WordPress */ function prevent_apostrophe_in_email($errors, $sanitized_user_login, $user_email) { if (strpos($user_email, “‘”) !== false) { $errors->add(‘invalid_email’, __(‘Error: Email addresses cannot contain apostrophes.’, ‘mytheme’)); } } add_filter(‘registration_errors’, ‘prevent_apostrophe_in_email’, 10, 3); /* WooCommerce */ function prevent_apostrophe_in_checkout($posted) { if (isset($posted[‘billing_email’]) && strpos($posted[‘billing_email’], “‘”) !==…Continue reading
MemberPress: Enable MailPoet Confirmation Email
function mepr_custom_send_mailpoet_confirm($request_args) { $request_args[‘send_confirmation_email’] = true; return $request_args; } add_filter(‘mepr-mailpoet-subscribe-args’, ‘mepr_custom_send_mailpoet_confirm’);Continue reading
MemberPress: Remove a User Role After Subscription to a Specific Membership Expires
add_action(‘mepr-event-subscription-expired’, function($event) { $txn = $event->get_data(); // Get the transaction data from the event $user = $txn->user(); // Get the user associated with the transaction // Check if the expired subscription is for the specific membership if ($txn->product_id == ‘123’)…Continue reading
MemberPress: Change the Member’s User Role After a Specific Membership Subscription Cancelation
add_action(‘mepr-event-subscription-stopped’, function($event) { $subscription = $event->get_data(); if(123 != (int) $subscription->product_id) { return; } $user = $subscription->user(); $wp_user = get_user_by(‘id’, $user->ID); if(!$wp_user) { return; } // Remove role $wp_user->remove_role( ‘subscriber’ ); // Add role $wp_user->add_role( ‘editor’ ); });Continue reading
NextGEN Ecommerce – apply the default pricelist to all of the existing galleries
use Imagely\NGG\Settings\Settings; use Imagely\NGGPro\Commerce\DataMappers\Gallery as GalleryMapper; function apply_default_pricelist_to_all_galleries() { $settings = Settings::get_instance(); $default_pricelist = $settings->get(‘ecommerce_default_pricelist’, null); if (!$default_pricelist) { return; } $mapper = GalleryMapper::get_instance(); $all_galleries = $mapper->find_all(); if ($all_galleries) { foreach ($all_galleries as $gallery) { $gallery->pricelist_id = $default_pricelist; $mapper->save($gallery); }…Continue reading
[advanced_tbsa_calculator]
/** * Shortcode: [advanced_tbsa_calculator] */ function advanced_tbsa_calculator_shortcode($atts) { ob_start(); ?> Parkland Modified Brooke Galveston Shriners–Cincinnati Rule of TenContinue reading
Shipstation live rates Gemini
/** * ShipStation Integration for WooCommerce – FINAL v5 * * – Fixes Apply Rate scope issue by making methods public. * – Ensures JS uses refreshed nonces correctly. */ if ( ! defined( ‘ABSPATH’ ) ) exit; // —…Continue reading
هوش مصنوعی
custom-email-activation-mailer-send
add_action(‘fluentform_submission_inserted’, function ($entryId, $formData, $form) { // Only run for a specific form ID (replace 5 with your form ID) if ($form->id != 5) { return; } $email = sanitize_email($formData[’email’]); $password = sanitize_text_field($formData[‘password’]); $username = sanitize_user($formData[‘username’] ?? explode(‘@’, $email)[0]); $display_name…Continue reading