Plugin Directory

Changeset 3250477


Ignore:
Timestamp:
03/04/2025 02:07:29 PM (13 months ago)
Author:
ifixcodes
Message:
  • Added support for up to ultimate member 2.10.0
  • Added support for PHP 8.X
  • Added support for WordPress 6.7
  • Fixed missing activation link from UM 2.8+
  • Fixed sending of duplicate email activation
Location:
email-re-validator/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • email-re-validator/trunk/email-re-validator.php

    r2825972 r3250477  
    11<?php
     2
    23/**
    34 * The Wordpress User Email Verification, Confirmation and Re-validation Plugin Solution for Ultimate Member
     
    67 *
    78 * @author    iFixcodes <info@ifixcodes.com>
    8  * @copyright Copyright (c) 2022, ifixcodes.com.
     9 * @copyright Copyright (c) 2022 - 2025, ifixcodes.com.
    910 * @license   GPLv2 or later http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
    1011 * @link      https://ifixcodes.com
     
    1617 * Description: The easiest solution that allows site owners the option to enable email re-validation for their users through the ultimate member plugin.
    1718 * Donate link: https://ifixcodes.com/email-re-validator-plugin-for-ultimate-member/donation/
    18  * Version:     1.0.0
     19 * Version:     2.0.0
    1920 * Author:      iFixCodes.com
    2021 * Author URI:  https://ifixcodes.com
     
    4142
    4243if ( ! defined( 'IFXERV_VERSION' ) ) {
    43     define( 'IFXERV_VERSION', '1.0.0' );
     44    define( 'IFXERV_VERSION', '2.0.0' );
    4445}
    4546
     
    4748
    4849/*
    49 * IPX_PLUGIN_CHECK Class
     50* ifxerv_plugin_checks function
    5051*  handles processes on plugin activation
    5152*
     
    5354*/
    5455
    55 register_activation_hook( __FILE__, array('IFXERV_PLUGIN_CHECK','ifxerv_plugin_checks') );
    56 class IFXERV_PLUGIN_CHECK{
     56
     57register_activation_hook( __FILE__, 'ifxerv_plugin_checks');
    5758  function ifxerv_plugin_checks() {
    5859   
     
    6667  }
    6768
    68 }
    6969
    7070
     
    7878function ifxerv_email_revalidate(){
    7979  global $wp_query;
     80 
     81  $wp_query->ifx_custom =false;
    8082  $current_user = wp_get_current_user();
    8183  $ifxerv_args=array();
     84  $slug='ifxerv_approved_email';
    8285 
    83   if (isset($_POST['user_email']) && isset($current_user->data->user_email) && isset(UM()->options()->options['ifxerv_approved_email_on']) && UM()->options()->options['ifxerv_approved_email_on']) {
     86  if (isset($_POST['user_email']) && isset($current_user->data->user_email) && UM()->options()->get( $slug . '_on' )!==false){
     87               
    8488                $ifxerv_args['user_email'] = sanitize_email( $_POST['user_email'] );
    8589                if($ifxerv_args['user_email'] !== $current_user->data->user_email){
    86           um_reset_user();
    87           ifxerv_email_pending();         
     90         $wp_query->ifx_custom =true;
     91          um_reset_user();
     92          ifxerv_email_pending();
    8893          wp_logout();         
    8994          exit( wp_redirect(  add_query_arg( 'err', esc_attr( 'awaiting_new_email_confirmation' ), get_page_link(UM()->config()->permalinks['login']) ) ) );
     
    97102//Sets user status to awaiting confirmation and send out re-validation template with activation link
    98103function ifxerv_email_pending() {
    99             UM()->user()->assign_secretkey();
    100             UM()->user()->set_status( 'awaiting_email_confirmation' );
    101 
    102             //clear all sessions for email confirmation pending users
    103             $user = \WP_Session_Tokens::get_instance( um_user( 'ID' ) );
     104            $user_id = um_user( 'ID' );
     105            UM()->common()->users()->assign_secretkey( $user_id );         
     106            UM()->common()->users()->set_status( $user_id , 'awaiting_email_confirmation' );
     107
     108            //clear all sessions for email confirmation pending users           
     109            $user = \WP_Session_Tokens::get_instance( $user_id );
    104110            $user->destroy_all();
    105 
    106             UM()->mail()->send( um_user( 'user_email' ), 'ifxerv_approved_email' );
     111           
     112            //create activation link but prevent default activation email from being send out
     113            add_filter( 'um_disable_email_notification_sending', 'my_disable_email_notification_sending', 10, 4 );
     114            UM()->common()->users()->send_activation( $user_id, true );         
     115           
     116            //send out activtion link using custom email re-validator template
     117            remove_filter( 'um_disable_email_notification_sending', 'my_disable_email_notification_sending', 10, 4 );
     118            UM()->mail()->send( um_user( 'user_email' ), 'ifxerv_approved_email', $args );
     119           
     120           
     121           
    107122        }
     123
    108124       
    109125/**
     
    129145
    130146    /* Default settings */
    131     UM()->options()->options = array_merge( array(
    132         'ifxerv_approved_email_on'   => 1,
    133         'ifxerv_approved_email_sub'  => '{site_name} - Verify your new email',
    134         ), UM()->options()->options );
     147     foreach ( $custom_emails as $slug => $custom_email ){
     148       
     149        // Default settings.
     150            UM()->options()->update( $slug.'_on' , 1);//empty( $custom_email['default_active'] ) ? 0 : 1;
     151            UM()->options()->update( $slug.'_sub' , '{site_name} - Verify your new email');//$custom_email['subject'];
     152       
     153        // Template file.
     154        $located = um_email_locate_template( $slug );       
     155       
     156        if ( ! file_exists( $located ) ) {
     157          wp_mkdir_p( dirname( $located ) );
     158          file_put_contents( $located, $custom_email['body'] );
     159        }
     160
     161        $emails[ $slug ] = $custom_email;
     162       
     163        }
    135164
    136165    return array_merge( $custom_emails, $emails );
    137166}add_filter( 'um_email_notifications','ifxerv_custom_um_email_notifications');
     167
     168
     169
    138170
    139171/**
     
    157189add_filter( 'um_custom_error_message_handler', 'ifxerv_custom_error_message_handler', 800, 2 );
    158190
    159 
     191/*Newly added*/
     192
     193
     194if ( ! function_exists( 'um_email_locate_template' ) ) {
     195    /**
     196     * Locate a template and return the path for inclusion.
     197     */
     198    function um_email_locate_template( $template_name ) {
     199        $blog_id = is_multisite() ? '/' . get_current_blog_id() : '';
     200
     201        $template = locate_template(
     202            array(
     203                trailingslashit( 'ultimate-member/email' . $blog_id ) . $template_name . '.php',
     204                trailingslashit( 'ultimate-member/email' ) . $template_name . '.php',
     205            )
     206        );
     207
     208        if ( ! $template ) {
     209            $template = wp_normalize_path( STYLESHEETPATH . '/ultimate-member/email/' . $template_name . '.php' );
     210        }
     211
     212        return apply_filters( 'um_locate_email_template', $template, $template_name );
     213    }
     214}
  • email-re-validator/trunk/readme.txt

    r2826021 r3250477  
    77Requires PHP: 5.6
    88Requires at least: 6.0
    9 Tested up to: 6.1
    10 Stable tag: 1.0.0
     9Tested up to: 6.7
     10Stable tag: 2.0.0
    1111License: GNU Version 2 or Any Later Version
    1212License URI: http://www.gnu.org/licenses/gpl-3.0.txt
     
    5454
    5555= Do I need to know any coding to use the Email Re-Validator plugin? =
    56   No, be sure ultimate member is installed and configured, then simply install and activate the plugin and you're ready to go.
     56  No. Be sure you have the most current version of Ultimate Member installed and configured correctly. Then install and activate the email re-validator plugin.
    5757
    5858= Will the plugin break my site? =
    59   No. We have not used any external javascript or css. All code is custom built around the built-in wordpress and the ultimate plugin classes and functions to reduce maximum interruptions.
     59  Normally, no. But we understand that all servers are not made equally. We at iFixCodes have not used any external javascript or css. All code is custom built around the built-in wordpress and the ultimate plugin classes and functions to reduce maximum interruptions.
    6060
    6161= Does the plugin work with any WordPress theme? =
     
    9191* To learn more about version 1.0 please see this [email verification](https://ifixcodes.com/email-re-validator-plugin-for-ultimate-member/)
    9292
     93= 2.0.0: November, 2022 =
     94
     95* Added support for up to ultimate member 2.10.0
     96* Added support for PHP 8.X
     97* Added support for WordPress 6.7
     98* Fixed missing activation link from UM 2.8+
     99* Fixed sending of duplicate email activation
     100
    93101= 1.0.0: November, 2022 =
    94102
Note: See TracChangeset for help on using the changeset viewer.