Skip to content

Instantly share code, notes, and snippets.

View cuxaro's full-sized avatar

Ivan Barreda cuxaro

View GitHub Profile
function is_ficharme_boss(){
return (current_user_can('administrator') || current_user_can( 'empresa' )) ? true : false;
}
function buzz_logout_redirect( $url ) {
return home_url( '/wp-login.php' );
}
add_filter( 'logout_redirect', 'buzz_logout_redirect' );
function buzz_redirect_to_login(){
// Si en Multisite queremos evitar está funcionalidad en alguna de las páginas tenemos que añadir esto
if (get_current_blog_id() == 1) {
return;
}
if ( !is_page(array('wp-admin', 'wp-login.php')) && !is_user_logged_in() ){
wp_redirect( home_url( '/wp-login.php' ) );
function ficharme_create_plugin_database_table()
{
global $table_prefix, $wpdb;
$tblname = 'buzz_registro_fichaje';
$wp_track_table = $table_prefix . "$tblname";
#Check to see if the table exists already, if not, then create it
if($wpdb->get_var( "show tables like '$wp_track_table'" ) != $wp_track_table)
#!/bin/bash
#Executa this script with sudo command
##cd /var/www
find . -type d -exec chmod 750 {} \;
find . -type f -exec chmod 640 {} \;
chmod 400 wp-config.php
@cuxaro
cuxaro / install-imapsync-brew.txt
Created September 29, 2018 18:30
Instalar IMAP SYNC con brew
brew install imapsync
@cuxaro
cuxaro / imapsync-comando.txt
Created September 29, 2018 18:29
Sincronizar cuentas de email en IMAP con Imapsync
imapsync --host1 DOMINIO_O_IP_IMAP_ORIGEN --user1 USUARIO_ORIGEN --password1 'PASSWORD' --host2 DOMINIO_O_IP_IMAP_DESTINO --user2 USUARIO_DESTINO --password2 'PASSWORD' --no-modulesversion
@cuxaro
cuxaro / buzz_remove_fields_woocommerce.php
Created July 18, 2018 14:10
Remove Fields in WooCoomerce Checkout
function buzz_393_billing_fields( $fields ) {
global $woocommerce;
// if the total is more than 0 then we still need the fields
if ( $woocommerce->cart->total != 0) {
//return $fields;
}
<?php
/**
* Change the add to cart text on single product pages
*/
add_filter('woocommerce_product_single_add_to_cart_text', 'woo_custom_cart_button_text');
function woo_custom_cart_button_text() {
foreach( WC()->cart->get_cart() as $cart_item_key => $values ) {
@cuxaro
cuxaro / cux-all-search.php
Created June 7, 2018 16:39
Buscar por todos los custom fields en admin
<?php
/**
* Extend WordPress search to include custom fields
*
* https://adambalee.com
*/
/**
* Join posts and postmeta tables