Skip to content

Instantly share code, notes, and snippets.

View nurul-umbhiya's full-sized avatar
🎯
Focusing

Nurul Umbhiya nurul-umbhiya

🎯
Focusing
View GitHub Profile
@nurul-umbhiya
nurul-umbhiya / dokan-vendor-limit-products.php
Last active February 1, 2024 12:16
Limit Vendor to Publish 6 Products Daily
add_filter( 'dokan_can_edit_product', function( $errors ) {
if ( ! isset( $_POST['dokan_update_product'] ) ) {
return $errors;
}
if ( ! isset( $_POST['dokan_edit_product_nonce'] ) || ! wp_verify_nonce( sanitize_key( $_POST['dokan_edit_product_nonce'] ), 'dokan_edit_product' ) ) {
return $errors;
}
$post_id = isset( $_POST['dokan_product_id'] ) ? absint( $_POST['dokan_product_id'] ) : 0;
@nurul-umbhiya
nurul-umbhiya / \dokan-lite\includes\functions.php
Last active February 11, 2021 10:29
Dokan store open-close fix
function dokan_is_store_open( $user_id ) {
$store_user = dokan()->vendor->get( $user_id );
$store_info = $store_user->get_shop_info();
$open_days = isset( $store_info['dokan_store_time'] ) ? $store_info['dokan_store_time'] : '';
$current_time = dokan_current_datetime();
$today = strtolower( $current_time->format( 'l' ) );
if ( ! isset( $open_days[ $today ] ) ) {
"use strict";
/* A version number is useful when updating the worker logic,
allowing you to remove outdated cache entries during the update.
*/
var version = 'v1::';
/* These resources will be downloaded and cached by the service worker
during the installation process. If any resource fails to be downloaded,
then the service worker won't be installed either.
{
"short_name": "madewithlove",
"name": "madewithlove",
"icons": [
{
"src": "img/launcher-icon@2x.png",
"sizes": "96x96",
"type": "image/png"
},
{
@nurul-umbhiya
nurul-umbhiya / sql_import.php
Created January 24, 2017 20:47 — forked from b4oshany/sql_import.php
PHP PDO sql file import.
<?php
namespace libs\mysql;
class PDODbImporter{
private static $keywords = array(
'ALTER', 'CREATE', 'DELETE', 'DROP', 'INSERT',
'REPLACE', 'SELECT', 'SET', 'TRUNCATE', 'UPDATE', 'USE',
'DELIMITER', 'END'
);
@nurul-umbhiya
nurul-umbhiya / php-wp-add-tinymce-button.php
Created June 3, 2016 15:08 — forked from rxnlabs/php-wp-add-tinymce-button.php
WordPress - Add button to TinyMCE editor in WordPress. Great for creating menus so users can add shortcodes without having to remember the syntax
<?php
/*Add this code to your functions.php file of current theme OR plugin file if you're making a plugin*/
//add the button to the tinymce editor
add_action('media_buttons_context','add_my_tinymce_media_button');
function add_my_tinymce_media_button($context){
return $context.=__("
<a href=\"#TB_inline?width=480&inlineId=my_shortcode_popup&width=640&height=513\" class=\"button thickbox\" id=\"my_shortcode_popup_button\" title=\"Add My Shortcode\">Add My Shortcode</a>");
}