Skip to content

Instantly share code, notes, and snippets.

View nmedia82's full-sized avatar

Najeeb Ahmad nmedia82

View GitHub Profile
@nmedia82
nmedia82 / gist:2875ca133caab3c90ddd
Last active August 29, 2015 14:22
N-Media Website Contact Form Filters
/**
** Following filter can be used to change FROM Email When Form is Submitted
** Plugin URL: http://najeebmedia.com/wordpress-plugin/wp-contact-form-file-upload/
**/
add_filter('webcontact_from_email', 'set_my_email', 10, 2);
/**
** @param:
** $email - default email
@nmedia82
nmedia82 / gist:2413afbc20bb7559de12
Last active August 29, 2015 14:23
N-Media File upload and download manager plugin hooks - wordpress plugin
// visit plugin url: http://najeebmedia.com/wordpress-plugin/wp-front-end-file-upload-and-download-manager/
/**
* change FROM EMAIL
* Notification when file uploaded by user
**/
add_filter('fileupload_from_email', 'change_from_email');
function change_from_email($dedault_email){
return 'any@otheremail.com';
@nmedia82
nmedia82 / secure-wp-query.php
Last active September 5, 2016 05:11
Wordpress secure way query into Database
// assumng col is a int value
$wpdb->query( $wpdb->prepare ("INSERT into table_name (col1, col2, col3) VALUES (%d, %s, %s)",
array('$value1','$value2', '$value3')
)
);
{
"name" : "File Upload and Download Manager",
"slug" : "nm-file-upload-manager-pro",
"download_url" : "",
"version" : "10.7",
"author" : "N-Media",
"sections" : {
"description" : "<h2>10.6 September 21, 2016 </h2>
<ul>
<li>Bug fixed: Files were renaming to 'blob', now it's fixed.</li>
@nmedia82
nmedia82 / wp-dynamic-css.php
Created October 6, 2016 04:43
How add dynamic css in WP plugin while rendering shortcode
function render_shortcode_template($atts){
extract(shortcode_atts(array(), $atts));
if($this -> get_option("_show_icons") == 'yes'){
wp_enqueue_style('font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css');
}
wp_enqueue_style($this->plugin_meta['shortname'].'-styles', $this->plugin_meta['url'].'templates/post-frontend-style.css');
//getting dynamic css
@nmedia82
nmedia82 / files-in-um-profile-tabs
Last active October 9, 2016 03:35
Adding Profile Tab in Ultimate Member Plugin to show Member Uploaded Files on Frontend
// this will add tab heading
add_filter('um_profile_tabs', 'user_files', 1000 );
function user_files($tabs) {
$tabs['userfiles'] = array(
'name' => 'My Files', // you can change this
'icon' => 'um-faicon-file', // you can change this
);
return $tabs;
@nmedia82
nmedia82 / nm-wp-helper-functions.php
Created March 16, 2017 12:32
N-Media Helper Functions File
/**
* WPML
* registering and translating strings input by users
*/
if( ! function_exists('nm_wpml_register') ) {
function nm_wpml_register($field_value, $domain) {
$field_name = $domain . ' - ' . sanitize_key($field_value);
@nmedia82
nmedia82 / nmInputs.php
Last active September 21, 2017 04:24
NM Input Class
<?php
/**
* Inputs rendering class
**/
// constants/configs
define( 'ECHOABLE', false );
class NM_Form {
"use strict"
var successCallback = function(data) {
var checkout_form = jQuery( 'form.woocommerce-checkout' );
// add a token to our hidden input field
console.log(data);
var token = data.response.token.token;
checkout_form.find('#twoco_token').val(token);
@nmedia82
nmedia82 / gist:a0ec36cc08cc581719b2c5458ebd77c2
Created April 9, 2019 05:22
Setting Up Site on AWS - Ubuntu
create host file in /etc/apache2/sites-available
make sure AWS Route 53 as Host/Zone Entry for this
For WordPress Permissions Issue
> sudo chown www-data:www-data /var/www/ -R