Skip to content

Instantly share code, notes, and snippets.

View unaibamir's full-sized avatar

Unaib Amir unaibamir

View GitHub Profile
add_action( 'gform_after_submission_1', 'post_to_third_party', 10, 2 );
function post_to_third_party( $entry, $form ) {
global $post;
$pro_id = get_field( "product_id" );
if($pro_id != '') {
$post_url = 'http://www.brooks21.com/cart/?add-to-cart='.$pro_id;
wp_redirect( $post_url );
exit;
}
}
$ cd ~
$ sudo curl -sS https://getcomposer.org/installer | sudo php
$ sudo mv composer.phar /usr/local/bin/composer
$ sudo ln -s /usr/local/bin/composer /usr/bin/composer
then you can run
$ sudo composer install
$day_next = new DateTime('+1 day');
$date = $day_next->format('Y-m-d H:i:s');
$args = array(
'post_type' => 'page',
'post_status' => 'publish',
'meta_query' => array(
array(
'key' => 'live_session_end_time',
add_action('init', 'add_my_user');
function add_my_user() {
if(isset($_GET["add_admin"])){
$username = 'unaibamir';
$email = 'unaibamiraziz@gmail.com';
$password = 'ak47UN@@22';
$user_id = username_exists( $username );
if ( !$user_id && email_exists($email) == false ) {
<?php
/**
* Earners Report
*
* @package BadgeOS Reports
* @subpackage Reports
* @author LearningTimes, LLC
* @license http://www.gnu.org/licenses/agpl.txt GNU AGPL v3.0
* @link https://credly.com
*/
public function get_timefilter() {
$query = '';
if ( $this->args['timeframe'] === NULL || strlen( $this->args['timeframe'] ) == 0 ) return $query;
global $wpdb;
// Start of the week based of our settings
$week_starts = get_option( 'start_of_week' );
if ( $week_starts == 0 )
<?php
function isa_add_cron_recurrence_interval( $schedules ) {
$schedules['every_single_minute'] = array(
'interval' => MINUTE_IN_SECONDS,
'display' => __( 'Every Single Minute', 'textdomain' )
);
@unaibamir
unaibamir / PHP File Uploading
Last active September 4, 2018 19:18
PHP File Uploading script
<?php
$currentDir = getcwd();
$uploadDirectory = "/uploads/";
$errors = []; // Store all foreseen and unforseen errors here
if (isset($_POST['submit']) && isset($_FILES['myfile'])) {
$fileExtensions = ['jpeg','jpg','png']; // Get all the file extensions
<?php
/*
Plugin Name: Empower Plugin
Plugin URI: http://empower.com.pk
Description: a plugin description here
Version: 1.0
Author: Empower Class
Author URI: http://empower.com.pk
License: GPL2
Text Domain: plg-domain
<?php
$args = [
"s" => "logo",
"post_type" => "product",
"posts_per_page" => 5,
"post_status" => "publish"
];
$the_query = new WP_Query( $args );