Skip to content

Instantly share code, notes, and snippets.

View amityweb's full-sized avatar

Laurence Cope amityweb

View GitHub Profile
@amityweb
amityweb / change-php-version-virtualmin-cli
Last active June 22, 2020 22:13
change-php-version-virtualmin-cli
virtualmin modify-web --domain example.com --php-version 7.0
@amityweb
amityweb / list-sites-using-php-versions.sh
Last active June 16, 2020 09:37
list-sites-using-php-versions
find -L /home/*/etc/php.ini -xtype l -exec ls -l {} \; | grep 'php5'
find -L /home/*/etc/php.ini -xtype l -exec ls -l {} \; | grep 'php7'
# Virtualmin update php version from CLI with:
virtualmin modify-web --domain domain.com --php-version 7.3
@amityweb
amityweb / list-virtualmin-wordpress-domains.sh
Last active April 25, 2019 18:30
List All Virtualmin Domains that Are Wordpress Sites
virtualmin list-domains --name-only --no-alias | while read line ; do
path=$(virtualmin list-domains --enabled --domain $line --home-only)
if [ $(find $path -maxdepth 2 -name 'wp-config.php') ]; then
echo $line
fi
done
@amityweb
amityweb / .htaccess
Last active November 2, 2018 20:02
My .htaccess redirects for with or without www and with HTTPS
# REDIRECT TO WWW and HTTPS
#RewriteEngine On
#RewriteCond %{HTTP_HOST} !^www.domainname.co.uk$ [OR]
#RewriteCond %{SERVER_PORT} 80
#RewriteRule (.*) https://www.domainname.co.uk/$1 [R=301,L]
# REDIRECT TO WITHOUT WWW and HTTPS
#RewriteEngine On
#RewriteCond %{HTTP_HOST} !^domainname.co.uk$ [OR]
#RewriteCond %{SERVER_PORT} 80
@amityweb
amityweb / instagantt-improvements.js
Created April 18, 2018 09:45
Tampermonkey Instagantt Improvements
function addGlobalStyle(css) {
var head, style;
head = document.getElementsByTagName('head')[0];
if (!head) { return; }
style = document.createElement('style');
style.type = 'text/css';
style.innerHTML = css;
head.appendChild(style);
}
@amityweb
amityweb / asana-improvements.js
Last active April 28, 2020 14:39
Tampermonkey Asana Improvements
// ==UserScript==
// @name Asana
// @namespace http://example.com
// @version 0.1
// @description Forced width of Asana is very obnoxius, so this will adjust the min width.
// @author You
// @match https://app.asana.com/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
// @grant none
@amityweb
amityweb / Change Wordpress User Password
Created January 15, 2018 15:59
Show All Wprdpress Users
/***********************
CHANGE USER PASS
Function to programmatically change the users password if you know the ID, and do not have access to the admin interface
***********************/
wp_set_password( 'yourpassword', id ); //
@amityweb
amityweb / add_admin_to_wordpress.php
Last active March 18, 2024 16:25
Function to add new user to Wordpress
/***********************
ADD USER
Useful script to programatically add an admin user to Wordpress if you dont have access to the admin, but do have access to the file system
***********************/
function wpb_admin_account()
{
$user = 'adminusername'; // Your username
$pass = 'adminpassword'; // Your password
$email = 'info@mydomain.co.uk'; // Your email
@amityweb
amityweb / update_pmpro_members_expiry_dates
Created December 22, 2017 16:07
Paid Memberships Pro SQL to Update Expiry Dates for Member Groups
UPDATE wp_pmpro_memberships_users
SET enddate = '2018-01-30 23:59:59'
WHERE (membership_id = 10 OR membership_id = 11)
AND enddate = '0000-00-00 00:00:00'
AND status = 'active';
@amityweb
amityweb / acf.php
Created January 15, 2017 11:42
Work in progress of using PHP to create ACF fields in Wordpress. Posting here in an effort to improve and make more efficient and easier to manage
<?php
if( function_exists('acf_add_local_field_group') ):
// Main Content Group
acf_add_local_field_group(array
(
'key' => 'content_1',
'title' => 'Content',
'fields' => array (