This file contains 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 characters
<?php | |
include(ABSPATH . 'wp-admin/includes/ms.php'); | |
$user = get_userdatabylogin('YOUR_USERNAME'); | |
grant_super_admin($user->ID); | |
?> |
This file contains 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 characters
<?php | |
file_put_contents(__DIR__.'/stack.log', print_r(debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT), true)); | |
?> |
This file contains 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 characters
# Working with data like this: | |
# HTTP request sent, awaiting response... .--2014-05-06 16:41:58-- http://xxx.com/xxx.jpg | |
# Resolving xxx.com... 1.1.1.1 | |
# Connecting to xxx.com|1.1.1.1|:80... ...............connected. | |
# HTTP request sent, awaiting response... .. .......... .... ....... .......--2014-05-06 16:41:58-- http://xxx.com/xxx.jpg | |
# Resolving xxx.com... .... .1.1.1.1 | |
# Connecting to xxx.com|1.1.1.1|:80... .........404 Not Found | |
# 2014-05-06 16:41:58 ERROR 404: Not Found. | |
# | |
# .....200 OK |
This file contains 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 characters
# This is a bash script meant to be run on the command line. Requires imagemagick (apt-get install imagemagick) | |
## THIS WILL OVERWRITE YOUR FILES, uses sudo and may not require it. | |
for file in /path/to/files/*/*.jpg; do sudo convert $file -resize '800x600>' -density 72 $file; done | |
### another method using resolution (800*600) | |
for file in /path/to/files/*/*.jpg; do sudo convert $file -resize '480000@>' -density 72 $file; done | |
### example of *not* overwriting files | |
for file in /path/to/files/*/*.jpg; do sudo convert $file -resize '800x600>' -density 72 converted-$file; done |
This file contains 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 characters
<?php | |
// add do_action('my_do_active_user_message_hook'); where you want the welcome message to display after redirect | |
add_action( 'activate_header', 'check_activation_key_redirect_to_page' ); | |
/** | |
* Check the wp-activate key and redirect the user to the apply page | |
* based on http://www.vanbodevelops.com/tutorials/how-to-skip-the-activation-page-and-send-the-user-straight-to-the-home-page-for-wordpress-multisite | |
*/ | |
function check_activation_key_redirect_to_page() { | |
// We check if the key is not empty |
This file contains 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 characters
# Grabbed for reference from http://www.wpbeginner.com/wp-tutorials/how-to-add-an-admin-user-to-the-wordpress-database-via-mysql/ | |
# Check the table prefix | |
# Check the user_id to make sure it is the next in sequence | |
# Replace my name and email to your own | |
# Username will be demo and the password will be 1234 | |
INSERT INTO `wp_users` (`ID`, `user_login`, `user_pass`, `user_nicename`, `user_email`, `user_url`, `user_registered`, `user_activation_key`, `user_status`, `display_name`) VALUES ('4', 'mgarrett', MD5('1234'), 'Mike Garrett', '[email protected]', '', '2011-06-07 00:00:00', '', '0', 'Mike Garrett'); | |
INSERT INTO `wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, '4', 'wp_capabilities', 'a:1:{s:13:"administrator";b:1;}'); | |
INSERT INTO `wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, '4', 'wp_user_level', '10'); | |
# Troubleshooting |
This file contains 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 characters
//Find your IP vis curl | |
curl ipecho.net/plain |
This file contains 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 characters
<?php | |
// in functions.php | |
add_action('wp_ajax_testing_axaj', 'ajax_function_to_execute', 1, 2); | |
add_action('wp_ajax_nopriv_testing_axaj', 'ajax_function_to_execute', 1, 2); | |
function ajax_function_to_execute() { | |
print_r($_REQUEST); | |
die(); |
This file contains 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 characters
<?php | |
add_action( 'wp', 'schedule_task' ); | |
/* Let's schedule some tasks! */ | |
function schedule_task() { | |
if ( ! wp_next_scheduled( 'task_hook' ) ) { | |
// Add scheduled daily task | |
wp_schedule_event( time(), 'daily', 'task_hook'); | |
} | |
} | |
add_action( 'task_hook', 'function_to_run' ); |
This file contains 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 characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
<title>Money Morning Ticket Export</title> | |
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script> | |
<script type="text/javascript"> | |
jQuery(document).ready(function($) { | |
$('.ticket-util').click( function(e) { | |
e.preventDefault(); |