Skip to content
David Kittell
David Kittell

Application & System: Development / Integration / Orchestration

  • Services
    • Application Development
    • Online Application Integration
  • Code
  • Online Tools
  • Tech Support
David Kittell

Application & System: Development / Integration / Orchestration

PHP WordPress – Check User Existence CLI

Posted on November 3, 2015November 3, 2015 By David Kittell
require(dirname(__DIR__) . '/html/wp-config.php');

$email = 'test@test.tld';
$user_data = get_user_by( 'email', $email ); // return WP_User object otherwise return false if not found 
if ( empty( $user_data ) ) {	
	echo "\nNo user exists with this email address\n";
}
else
{
echo "\nUser exists with this email address\n";

}
require(dirname(__DIR__) . '/html/wp-config.php');

$user_login = 'admin';
$user_data = get_user_by( 'login', $user_login ); // return WP_User object otherwise return false if not found 
if ( empty( $user_data ) ) {	
	echo "\nNo user exists with this user login\n";
}
else
{
echo "\nUser exists with this user login\n";
}
All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development) system it is suggested you test it and fully understand what it is doing not just what it appears it is doing. I accept no responsibility for any damage you may do with this code.

Related

Code PHP WordPress

Post navigation

Previous post
Next post

Related Posts

GitLab – Uninstall

Posted on November 29, 2016

If you’ve ran into a problem with GitLab and need to remove all pieces of it to install fresh this may help. DISCLAIMER: BACKUP YOUR DATA FIRST sudo yum -y remove gitlab-ce sudo rm -rf /opt/gitlab/ sudo rm -rf /var/opt/gitlab sudo rm -rf /var/log/gitlab sudo rm -rf /etc/gitlab All information…

Read More

Ektron Rename Templates

Posted on October 23, 2013October 26, 2015

This script will rename template paths SET XACT_ABORT ON DECLARE @currval NVARCHAR(500) DECLARE @newval NVARCHAR(500) DECLARE @search NVARCHAR(500) DECLARE @replace NVARCHAR(500) SET @search = ‘/Index.aspx’ –string to find SET @replace = ‘/Default.aspx’ –replacement string DECLARE @pos INT DECLARE @id BIGINT BEGIN TRAN DECLARE curs CURSOR LOCAL FAST_FORWARD FOR SELECT template_id…

Read More

PowerShell Extract Zip Files

Posted on September 11, 2015May 8, 2018

function Expand-ZipFile([string]$File, [string]$Destination) #The targets to run. { $Shell = new-object -com shell.application # Get the name of the Zip file $Zip = $Shell.NameSpace($File) #Expand/Extract each file from the zip file foreach($Item in $Zip.items()) { $Shell.Namespace($Destination).copyhere($Item) } } Expand-ZipFile –File "C:\file.zip" –Destination "C:\tempfile" Reference: http://www.howtogeek.com/tips/how-to-extract-zip-files-using-powershell/ Originally Posted on September 11,…

Read More

Code

Top Posts & Pages

  • PowerShell - Rename Pictures to Image Taken
  • Front Page
  • C# - Start/Stop/Restart Services
  • MacPorts / HomeBrew - Rip CD tracks from terminal
  • PowerShell - Show File Extensions

Recent Posts

  • Javascript – Digital Clock with Style
  • BASH – Web Ping Log
  • BASH – Picture / Video File Name Manipulation
  • Mac OSX Terminal – Create SSH Key
  • Bash – Rename Picture

Top Posts

  • PowerShell - Rename Pictures to Image Taken
  • C# - Start/Stop/Restart Services
  • MacPorts / HomeBrew - Rip CD tracks from terminal
  • PowerShell - Show File Extensions
  • Open On Screen Keyboard (OSK)
  • SQLite - Auto-Increment / Auto Generate GUID
©2025 David Kittell | WordPress Theme by SuperbThemes