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 | |
// Hook the appropriate WordPress action | |
add_action('init', 'prevent_wp_login'); | |
function prevent_wp_login() { | |
// WP tracks the current page - global the variable to access it | |
global $pagenow; | |
// Check if a $_GET['action'] is set, and if so, load it into $action variable | |
$action = (isset($_GET['action'])) ? $_GET['action'] : ''; |
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 | |
// connect to FTP server | |
$ftp_server = "80....."; | |
$ftp_conn = ftp_connect($ftp_server) or die("Could not connect to $ftp_server"); | |
// login | |
if (@ftp_login($ftp_conn, "user", "pass")) | |
{ | |
echo "Connection established."; | |
} |
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
# Block executables | |
<FilesMatch "\.(php|phtml|php3|php4|php5|pl|py|jsp|asp|html|htm|shtml|sh|cgi|suspected)$"> | |
deny from all | |
</FilesMatch> |
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( 'woocommerce_thankyou', 'ecommercehints_create_user_account_after_payment', 10, 1 ); | |
function ecommercehints_create_user_account_after_payment( $order_id ) { | |
// If user is logged in, do nothing because they already have an account | |
if( is_user_logged_in() ) return; | |
// Get the newly created order | |
$order = wc_get_order( $order_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 | |
/*$users = include WPMU_PLUGIN_DIR .'/wp_users.php'; | |
foreach($users as $user) { | |
$ID = $user['ID']; | |
$user_login = $user['user_login']; | |
echo $ID.'|'.$user_login.'|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
<!DOCTYPE html> | |
<html lang="fa"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"> | |
<title>زوم با Transform Scale</title> | |
<style> | |
body, html { | |
margin: 0; | |
padding: 0; |
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_filter('http_request_args', 'bal_http_request_args', 100, 1); | |
function bal_http_request_args($r) //called on line 237 | |
{ | |
$r['timeout'] = 15; | |
return $r; | |
} | |
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
``` | |
SELECT p.ID, p.user_login, p.user_email, p.display_name, phone.meta_value AS phone, | |
(SELECT SUM(CASE WHEN t.type = 'credit' THEN t.amount ELSE -t.amount END) as balance FROM wp_woo_wallet_transactions AS t WHERE t.user_id=p.ID AND t.deleted=0) as balance | |
FROM wp_users AS p LEFT JOIN wp_usermeta AS phone ON p.ID = phone.user_id AND 'billing_phone' = phone.meta_key; | |
``` | |
// More: | |
https://stackoverflow.com/questions/26319613/improving-a-query-using-a-lot-of-inner-joins-to-wp-postmeta-a-key-value-table |
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 | |
_enable_role_based_price | |
0 or 1 | |
enable_role_based_price: on | |
role_based_price[subscriber][regular_price]: 10 | |
role_based_price[subscriber][selling_price]: 20 | |
role_based_price[contributor][regular_price]: 30 | |
role_based_price[contributor][selling_price]: 40 |
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 | |
if ( $product->is_type('bundle') ) { | |
$hasqty = 5; | |
$bundleditems = $product->get_bundled_items(); | |
foreach ( $bundled_items as $bundleditem ) { | |
if ( $bundleditem->is_optional('yes')) { | |
$hasqty = 1; | |
echo "<h2> 1 product optional </h2>"; | |
} else { |
NewerOlder