Skip to content

Instantly share code, notes, and snippets.

View milbar's full-sized avatar

Bartalovics Milán milbar

  • Pécs
View GitHub Profile
@denisbaranov
denisbaranov / Add several tabs to the profile.php
Last active December 13, 2020 12:59
This example shows how to add several tabs with custom shortcodes into the Profile page of the Ultimate Member.
<?php
/**
* This example shows how to add several tabs with custom shortcodes into the Profile page of the Ultimate Member.
* You can add custom code to the end of the file functions.php in the active theme directory.
* Important! Each tab must have a unique key.
*
* Ultimate Member documentation: https://docs.ultimatemember.com/
* Ultimate Member support (for customers): https://ultimatemember.com/support/ticket/
*/
@damiencarbery
damiencarbery / wc-defer-order-emails.php
Last active January 9, 2024 15:54
Defer WooCommerce emails for a few minutes - Defer WooCommerce emails for a specified time after the normal delivery time. https://www.damiencarbery.com/2020/04/defer-woocommerce-emails-for-a-few-minutes/
<?php
/*
Plugin Name: Defer WooCommerce emails for a few minutes (use Action Scheduler)
Plugin URI: https://www.damiencarbery.com/2020/04/defer-woocommerce-emails-for-a-few-minutes/
Description: Defer WooCommerce emails for a specified time after the normal delivery time. Use Action Scheduler instead of WP Cron. Call do_action() instead of remove_action() and calling trigger.
Author: Damien Carbery
Author URI: https://www.damiencarbery.com
Version: 0.8
*/
@denisbaranov
denisbaranov / Add new profile tab with a form.php
Last active January 25, 2024 01:16
This example shows how to add a new tab into the Profile page of the Ultimate Member.
<?php
/**
* This example shows how to add a new tab into the Profile page of the Ultimate Member.
* See the article https://docs.ultimatemember.com/article/69-how-do-i-add-my-extra-tabs-to-user-profiles
*
* This example adds the tab 'mycustomtab' that contains the field 'description'. You can add your own tabs and fields.
* Important! Each profile tab has an unique key. Replace 'mycustomtab' to your unique key.
*
* You can add this code to the end of the file functions.php in the active theme (child theme) directory.
@paaljoachim
paaljoachim / functions.php
Last active May 29, 2022 00:49
Tutorial: WooCommerce Checkout: Add multiple custom fields to billing area. This code adds priority placement of field. Shows the custom fields in the backend Order Details screen and in e-mails to the admin and customer. I have also adjusted the checkbox field to give a text result instead of a value of 1. Checkbox is also pre-selected.
/* --------- Adds custom fields using filters. ------
The below custom fields shows various types one can use.
It is then displayed in the backend Order Details page and in admin and customer e-mails.
Checkboxes by default result only show the number 1 when clicked. I have added code so that when the a checkbox is clicked it will
show text such as On and Yes. Checkbox is also pre-selected.
Tutorial: https://easywebdesigntutorials.com/woocommerce-modifying-the-checkout-page/
*/
// Initial inspiration: https://businessbloomer.com/woocommerce-add-shipping-phone-checkout/
// My Custom Fields
@joecampo
joecampo / fail2ban.md
Last active May 25, 2024 14:17
fail2ban – stop HTTP(S) route abuse/brute forcing

If you're not familiar: What is fail2ban? fail2ban is an awesome linux service/monitor that scans log files (e.g. auth.log for SSH) for potentially malicious behavior. Once fail2ban is tripped it will ban users for a specified duration by adding rules to Iptables. If you're unfamiliar with fail2ban Chris Fidao has a wonderful (& free!) series about security including setting up fail2ban here.

Recently Laravel released a new feature in 5.1 to throttle authentication attempts by simply adding a trait to your authentication controller. The Laravel throttle trait uses the inputted username, and IP address to throttle attempts. I love seeing this added to a framework out of the box, but what about some of our other apps not built on Laravel? Like a WordPress login? Or even an open API etc.? Ultimately,

@hakre
hakre / dl-file.php
Created January 2, 2012 21:41
Wordpress login to download uploaded files
<?php
/*
* dl-file.php
*
* Protect uploaded files with login.
*
* @link http://wordpress.stackexchange.com/questions/37144/protect-wordpress-uploads-if-user-is-not-logged-in
*
* @author hakre <http://hakre.wordpress.com/>
* @license GPL-3.0+