Last active
August 24, 2025 16:01
-
-
Save samhernandez/1c53b7c75c64f8842fb6da27b9263e9d to your computer and use it in GitHub Desktop.
Revisions
-
samhernandez revised this gist
Dec 2, 2022 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,7 +6,8 @@ {% set values = { username: 'me', password: craft.app.security.hashPassword('mypassword'), email: '[email protected]', passwordResetRequired: 0 } %} {% set where = { -
Sam Hernandez revised this gist
Jun 24, 2019 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -10,12 +10,12 @@ } %} {% set where = { id: craft.query().select('id').from('{{%users}}').where({admin: 1}).scalar() } %} {% set rowsAffected = craft.query() .createCommand() .update('{{%users}}', values, where) .execute() %} -
Sam Hernandez created this gist
Nov 7, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ {# Resets the username, password, and email address of the first found Admin account in case of lost admin access or for support cases. #} {% set values = { username: 'me', password: craft.app.security.hashPassword('mypassword'), email: '[email protected]' } %} {% set where = { id: craft.query().select('id').from('users').where({admin: 1}).scalar() } %} {% set rowsAffected = craft.query() .createCommand() .update('users', values, where) .execute() %} Rows affected: {{ rowsAffected }}