Skip to content

Instantly share code, notes, and snippets.

View getmanzooronline's full-sized avatar
👨‍💻
Working from Home

Mansoorkhan T K getmanzooronline

👨‍💻
Working from Home
View GitHub Profile
function readUTMParams() {
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
const utmParams = {};
const utmPrefix = "utm_";
for (const param of urlParams.entries()) {
if (param[0].startsWith(utmPrefix)) {
utmParams[param[0]] = param[1];
}
@getmanzooronline
getmanzooronline / functions.php
Created January 5, 2021 03:39
Redirect default WordPress Registration and Login pages.
// Redirect Registration / Login Page
function pro_registration_page_redirect()
{
global $pagenow;
if ( ( strtolower($pagenow) == 'wp-login.php') && ( strtolower( $_GET['action']) == 'register' ) ) {
wp_redirect( home_url('/registration'));
}
if ( ( strtolower($pagenow) == 'wp-login.php') ) {
wp_redirect( home_url('/my-account'));
@getmanzooronline
getmanzooronline / mantis-bug-tracker-life-cycle.md
Created November 10, 2020 11:25
MantisBT - Bug Life Cycle

The normal workflow for bug lifecycle in Mantis Bug Tracker is as below:

  • When a new issue is reported, the default status is set to “New”.
  • It is assigned to a person from “Assigned To” dropdown.
  • The assigned person will receive a notification to an issue assigned to him.
  • The assigned person will open a bug and go through it details.
    • It will acknowledge the bug or
    • Ask for any feedback.
    • Confirm the bug and set the status
  • If the bug is confirmed and set to open, the status will be set to “confirmed” and the assigned developer will start resolving the bug.
@getmanzooronline
getmanzooronline / gist:a16605fb8e657280dc207356a8ff3e67
Created October 22, 2020 05:22 — forked from mikejolley/gist:c4606aa52754b334f0f1bbe7e5b5ca6b
WooCommerce - remove payment method from emails
<?php // Do not include this if already open!
/**
* Code goes in theme functions.php.
*/
add_filter( 'woocommerce_get_order_item_totals', 'custom_woocommerce_get_order_item_totals' );
function custom_woocommerce_get_order_item_totals( $totals ) {
unset( $totals['payment_method'] );
return $totals;
@getmanzooronline
getmanzooronline / wc_order_status_changes.php
Created April 19, 2020 04:23 — forked from abegit/wc_order_status_changes.php
WooCommerce Hooks for Order Status Changes
function mysite_pending($order_id) {
error_log("$order_id set to PENDING", 0);
}
function mysite_failed($order_id) {
error_log("$order_id set to FAILED", 0);
}
function mysite_hold($order_id) {
error_log("$order_id set to ON HOLD", 0);
}
function mysite_processing($order_id) {
@getmanzooronline
getmanzooronline / checkout-refresh-place-order-button.js
Last active April 10, 2020 08:02
Woocommerce: Refresh place order section while changing the payment gateway
jQuery(function($){
//To display the Custom Payment Button.
$('form.checkout').on( 'change', 'input[name^="payment_method"]', function() {
var t = { updateTimer: !1, dirtyInput: !1,
reset_update_checkout_timer: function() {
clearTimeout(t.updateTimer)
}, trigger_update_checkout: function() {
t.reset_update_checkout_timer(), t.dirtyInput = !1,
$(document.body).trigger("update_checkout")
}
<?php
/*
This function saved my life.
found on: http://www.sitepoint.com/forums//showthread.php?t=438748
by: crvandyke
It takes an object, and when all else if/else/recursive functions fail to convert the object into an associative array, this one goes for the kill. Who would'a thunk it?!
*/
$array = json_decode(json_encode($object), true);
/**
* CURL funtion to post some data to an URL
* @param string $url
* @param array $post
* @return string
*/
private function curl($url,$post="")
{
$curl = curl_init();
$userAgent = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)';
@getmanzooronline
getmanzooronline / wp_style_tables.php
Created February 2, 2015 09:44
WordPress admin style table with sorting and pagination
<?php
if (!class_exists('WP_List_Table'))
{
require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
}
class My_Example_List_Table extends WP_List_Table
{
@getmanzooronline
getmanzooronline / php_substring_html.php
Last active September 10, 2023 20:53
PHP Substring without breaking words and HTML tags
<?php
/**
* Truncates text.
*
* Cuts a string to the length of $length and replaces the last characters
* with the ending if the text is longer than length.
*
* @param string $text String to truncate.
* @param integer $length Length of returned string, including ellipsis.
* @param string $ending Ending to be appended to the trimmed string.