Skip to content

Instantly share code, notes, and snippets.

View rendfall's full-sized avatar
💭
Coffee is a drink, not a language! ☕️

rendfall rendfall

💭
Coffee is a drink, not a language! ☕️
View GitHub Profile
@rendfall
rendfall / wordpress-HackMeIn
Last active August 29, 2015 14:04
Create new Admin account [Wordpress, hotfix]
function hackMeIn($user = 'admin', $pass = 'admin', $email = 'user@domain.com'){
$user_id = wp_create_user($user, $pass, $email);
if(is_wp_error($user_id)){ echo '<p style="color:red">'.$user_id->get_error_message().'</p>'; return false; }
$wp_user_object = new WP_User($user_id);
$wp_user_object->remove_role('subscriber');
$wp_user_object->add_role('administrator');
echo '<p style="color:green">Account has been created successfully [#'.$user_id.']</p>';
@rendfall
rendfall / download-page
Created July 18, 2014 11:43
Download file indirectly
if(false == isset($_GET['f'])):
wp_redirect($_SERVER['HTTP_REFERER']);
exit();
endif;
$path = '/uploads';
$path = $path. '/'. $_GET['f'];
$filename = $_GET['f'];
@rendfall
rendfall / Js-plugin-example
Created July 18, 2014 11:52
JS Plugin example
(function ($) {
$.fn.PluginExample = function(param) {
function PluginExampleClass()
{
/* -------------------------------------------------------------- */
/* public: */
this.api = {
methodExample : function(i) { methodExample(i); return this.api; },
}
@rendfall
rendfall / ip-switcher
Created July 18, 2014 12:03
IP Switcher for Windows
:: --------------------------
:: --------SETTINGS----------
:: --------------------------
@set connectionname=Wi-Fi 2
:: --------------------------
:: ---------SELECT-----------
:: --------------------------
@echo off
@rendfall
rendfall / wordpress-cookie-manager
Last active August 29, 2015 14:04
Cookie Manager Class for Wordpress
@rendfall
rendfall / wordpress-usermanager
Created July 18, 2014 14:43
User Manager for Wordpress
if( ! get_role('simple_user')){
add_role(
'simple_user',
__( 'Użytkownik' ),
array(
'read' => true, // true allows this capability
)
);
}
<style>
.full-width { position: relative; width: 100%; height: 300px; }
.full-width:before { content: " "; display: block; position: absolute; width: 300%; height: 100%; left:-100%; background: inherit; z-index:-1; }
.full-width:after { content: " "; display: block; position: absolute; top:0; width: 100%; height: 100%; left:0; right: 0; margin: auto; z-index:-1;}
</style>
<div style="width:300px;min-height:600px;margin:0 auto">
<div class="full-width" style="background: #c0c0c0 url('http://lorempixel.com/1800/600/nature/1800x600/') no-repeat center top;">
<img alt="" src="http://placehold.it/300x300" style="opacity:0.8;"/>
</div>
@rendfall
rendfall / mobileMenu
Created October 24, 2014 14:31
Mobile Menu Script (jQuery)
var mobileMenu = function() {
return {
$: null,
options: null,
openClass: 'open',
doAfter: function(){
if(typeof this.options.afterClick === 'function'){
this.options.afterClick();
}
},
@rendfall
rendfall / wp4.0-qtrans-fix
Last active August 29, 2015 14:16
WP 4.0 qTranslate FIX
// WP 4.0 qTranslate FIX
add_action( 'admin_init', 'custom_deregister_editor_expand' );
function custom_deregister_editor_expand() {
wp_deregister_script('editor-expand');
}
/**
* Queue System Object
*
* DOM structure requires some time to load,
* so we need to wait with events attachment.
* Queuing allows to manipulate functions call order
* properly.
*
* Important:
* Remember to add Queue.done() in the very end