• Resolved tnijland3

    (@tnijland3)


    Hi all,

    Is there any option for $$EMAIL$$ like what $$USER$$ is doing?

    In my case I really need to filter on email addresses instead of $$USERID$$ or $$USER$$. Is there something im missing? Is this already a feature?

    Or does anybody else have another solution?

    With kind regards,
    Tim

    • This topic was modified 3 years, 2 months ago by tnijland3.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter tnijland3

    (@tnijland3)

    Managed to fix it,

    I forked the WPDA.php file.
    Added this after rule 773:

    public static function get_current_user_email() {
    			global $current_user;
    			if ( isset( $current_user->user_email ) ) {
    				return $current_user->user_email;
    			} else {
    				$wp_user = wp_get_current_user();
    				if ( isset( $wp_user->data->user_email ) ) {
    					return $wp_user->data->user_email;
    				} else {
    					return 'anonymous';
    				}
    			}
    		}
    

    And this after 794:

    
    if ( strpos( $where_clause, '$$EMAIL$$' ) ) {
    				$user_email      = WPDA::get_current_user_email();
    				$where_clause = str_replace( '$$EMAIL$$', $user_email, $where_clause );
    			}
    
    Plugin Author Passionate Programmer Peter

    (@peterschulznl)

    Hi @tnijland3,

    Thank you for doing my work! 🙂

    I will add your code to the next release to make sure you won’t lose it and others can benefit from it as well.

    Thanks you for your contribution,
    Peter

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Where clause option for $$EMAIL$$?’ is closed to new replies.