Skip to content

Instantly share code, notes, and snippets.

View kkarpieszuk's full-sized avatar

Konrad Karpieszuk kkarpieszuk

View GitHub Profile
#!/usr/bin/python
# 1. create file install.py inside of this directory with .sql files
# 2. place it inside of file (adjust dbname dbuser and dbpass)
# 3. run python install.py
from os import listdir
from os.path import isfile, join
from os import system
protected function save( $dest, $html_templates ) {
$order_language = get_post_meta( $this->order->id, 'wpml_language', true );
$user_id = get_current_user_id();
$temp_language = null;
if (is_numeric($user_id)) {
$temp_language = get_user_meta( $user_id, 'icl_admin_language_for_edit', true );
update_user_meta($user_id, 'icl_admin_language_for_edit', $order_language);
do_action('wpml_switch_language', $order_language);
}
/**
* Changes array of items into string of items, separated by comma and sql-escaped
*
* @see https://coderwall.com/p/zepnaw
*
* @global wpdb $wpdb
* @param array $items items to be joined into string
* @param string $format %s or %d
* @return string Items separated by comma and sql-escaped
*/
<?php
// action is icl_register_admin_string and we want to handle it only for administrators
add_action( 'wp_ajax_icl_register_admin_string', 'icl_register_admin_string' );
add_action( 'wp_ajax_nopriv_icl_register_admin_string', 'icl_register_admin_string_nopriv' );
function icl_register_admin_string() {
// add code for http://codex.wordpress.org/Function_Reference/check_ajax_referer
if (curent_user_can('manage_options')) {