Skip to content

Instantly share code, notes, and snippets.

@timersys
timersys / gist:759afb8352a662a47be9
Created December 13, 2014 13:23
Hybridauth - You cannot access this page directly
/******* IN wp-config.php add the following: ******/
/* WSI HYBRIDAUTH SESSIONS HANDLING */
define('WSI_PHP_SESSION', dirname(__FILE__) . '/phpsession');
session_save_path(WSI_PHP_SESSION);
/******* wp-content/plugins/wordpress-social-inivtations/wp-social-invitations.php and wp-content/plugins/wordpress-social-inivtations/hybridauth/index.php add the following: ******/
/* WSI HYBRIDAUTH SESSIONS HANDLING */
session_save_path(WSI_PHP_SESSION);
@timersys
timersys / gist:948088de7187dcf8c31a
Created January 9, 2015 12:25
Laravel pass model to create dropdown in views
/**
* IF you have a States model and you want to create a simple dropdown in your views you can pass the array very easily doing:
**/
public function create()
{
// first parameter is option label and second the option value
$states = State::lists('state', 'id');
return View::make('anuncios.create', compact('states'));
}
@timersys
timersys / gist:4480bccf64a1147abb3d
Last active February 22, 2021 18:42
wp_remote_get debug script
<?php
/**
* Plugin Name: Wp Remote Test
* Plugin URI:
* Version: 0.1
* Description: Debug wp_remote_get and wp_remote_post
* Author: Damian Logghe
* Author URI: http://wp.timersys.com
*/
@timersys
timersys / mamp-curl
Created February 9, 2015 23:01
Update MAMP / MAMP pro Curl
download curl from http://ftp.sunet.se/pub/www/utilities/curl/curl-7.40.0.tar.bz2
Configure it with ./configure --prefix=/Applications/MAMP/Library/
make && make install
@timersys
timersys / anti-poodle
Last active August 29, 2015 14:15
wp_remote_get filter to avoid ssl connection problems
/**
* As many of you know after Poodle was released sslv3 was deactivated all over the internet and new problems arises
* when ciphers mismatch. If you get with wp_remote_ errors like: routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
* routines:SSL3_READ_BYTES:sslv3 alert handshake failure or Cannot communicate securely with peer: no common encryption algorithm(s).
* Try to add the following action to modify curl.
**/
add_action( 'http_api_curl', 'timersys_api_curl', 10, 3 );
function timersys_api_curl(&$handle, $args, $url){
@timersys
timersys / gist:82434b7e81b81e62dbba
Created February 16, 2015 14:01
serving icon fonts from CDN
# Apache config
<FilesMatch ".(eot|ttf|otf|woff)">
Header set Access-Control-Allow-Origin "*"
</FilesMatch>
@timersys
timersys / bp.php
Created February 19, 2015 12:32
add text to wordpress social invitations buddypress screen
// hook to wsi bp screen
add_action('wsi/bp/screen_one' , 'attach_my_screen');
function attach_my_screen() {
// hook to bp template
add_action( 'bp_template_content' , 'bp_template_content_func',9 );
}
// My actual text
function bp_template_content_func() {
echo "My content goes here";
}
@timersys
timersys / gist:13af6af06ea0bbb38c73
Created March 6, 2015 17:09
Protect files in Easy Digital Downloads + Nginx
#EDD + Nginx - protect your files
location ~ ^/wp-content/uploads/edd/(.*?)\.zip$ {
rewrite / permanent;
}
@timersys
timersys / gist:d68690a85aed14a02318
Last active September 25, 2024 20:09
Wordpress popups - Open popup with link
// To open popup with ID 3 on same page (preferred)
<a href="" class="spu-open-3" title="Click here">Click here</a>
// Another way
<a href="#spu-3" title="Click here">Click here</a>
// To go to a new page and open a popup there
<a href="http://mydomain.com/new-page/#spu-3" title="Click here">Click here</a>
@timersys
timersys / tips.php
Created April 8, 2015 12:33
Debug tips, get all errors and check where class was defined
<?php
/**
* Display all errors no matter what
* /
error_reporting(E_ALL);
ini_set('display_errors', 1);
/**
* Find where the class was defined