Skip to content

Instantly share code, notes, and snippets.

@max-kk
max-kk / filter_user_mail.php
Last active May 28, 2016 13:32
Add Description and Full desccription to User notify emails
<?php
add_filter( 'fv_user_mail_body', 'fv_filter_user_mail_body', 10, 2 );
function fv_filter_user_mail_body($body, $photo) {
$body = str_replace('{contestant_description}', $photo->description, $body);
$body = str_replace('{contestant_full_description}', $photo->full_description, $body);
return $body;
}
@max-kk
max-kk / video_filtet_form_title.php
Created July 6, 2016 13:59
Change Video form title
<?php
add_filter('fv_template_variables', 'fv_filter_upload_form_title', 10, 3);
function fv_filter_upload_form_title($variables, $type, $template_path) {
if ( !class_exists('FvAddon_Video') || $variables['contest']->type != FvAddon_Video::TYPE_VIDEO ) {
return $variables;
}
@max-kk
max-kk / fv-pinterest.css
Created July 19, 2016 06:59
How to change color of blue circle in Piterest theme?
/* Yellow */
.is-gallery .clg-head-view:before {
background-color:rgba(255, 196, 0, 0.7) !important;
}
/* Or Pink */
.is-gallery .clg-head-view:before {
background-color:rgba(255,105,180, 0.7) !important;
}
@max-kk
max-kk / check_is_customer_or_redirect_contest.php
Last active August 3, 2016 09:11
Redirect Woo cutomsers to profile and Not Woo Customers to Another page
function check_is_customer_or_redirect_contest() {
// Redirect if User does not have permissions
$user = new WP_User( $user_ID );
$is_customer = false;
if ( !empty( $user->roles ) && is_array( $user->roles ) && in_array( 'customer', $user->roles ) ) {
$is_customer = true;
}
if ( $is_customer ) {
$myaccount_page_id = get_option( 'woocommerce_myaccount_page_id' );
@max-kk
max-kk / fv_upload_add_photo_data.php
Created August 22, 2016 09:04
Add first photo data to upload response array (in wp-foto-vote\public\class-fv-public-ajax.php)
<?php
add_filter('fv/public/upload/response', 'fv_upload_add_photo_data', 11, 1);
function fv_upload_add_photo_data($response) {
if ( !empty($response['inserted_photo_ids'][0]) ) {
$photo0 = ModelCompetitors::query()->findByPK( $response['inserted_photo_ids'][0] );
if ( !empty($photo0) ) {
$response['inserted_photo_datas'][0] = FV_Public::_prepare_contestant_to_js($photo0);
}
@max-kk
max-kk / unlimited_voting.php
Last active February 8, 2017 13:47
>> WP Foto Vote <<How can I allow for users to vote as many times as they wish for any photos?
<?php
/**
>> WP Foto Vote <<How can I allow for users to vote as many times as they wish for any photos?
Add it to your theme functions.php for example.
#### Note: you must have option Fast Voting (Photo Contest => Settings => Voting) disabled. ####
*/
// Allow for all
@max-kk
max-kk / maskedinput_async.js
Last active September 6, 2016 08:54
maskedinput_async
jQuery.cachedScript = function( url, options ) {
// Allow user to set any option except for dataType, cache, and url
options = $.extend( options || {}, {
dataType: "script",
cache: true,
url: url
});
// Use $.ajax() since it is more flexible than $.getScript
@max-kk
max-kk / wp_rocketscript_excluder.php
Created September 15, 2016 14:17
text/rocketscript excluder
<?php
add_filter( 'script_loader_tag', function ( $tag, $handle ) {
//var_dump($handle);
$handles_to_exclude = array('fv_main_js'=> 0,'fv_theme_story'=>0, 'fv_lib_js'=>0, 'fv_evercookie'=>0, 'jquery-core'=>0, 'jquery-migrate'=>0);
if ( !isset($handles_to_exclude[$handle]) ) return $tag;
if ( 'fv_main_js' == $handle ) {
global $wp_scripts;
$tag = '<script data-cfasync="false">' . $wp_scripts->print_extra_script( $handle, false ) . '</script>' . $tag;
@max-kk
max-kk / edd_save_receiver_email.php
Last active September 26, 2016 13:06
How to save Paypal "receiver_email" on Paypal Standart payments (if you want see later to what emails payment was send).
<?php
/**
* Lets save Paypal "receiver_email"
*/
add_action( 'edd_paypal_web_accept', 'my001_edd_process_paypal_web_accept_and_cart', 11, 2 );
function my001_edd_process_paypal_web_accept_and_cart( $data, $payment_id )
{
if ($data['txn_type'] != 'web_accept' && $data['txn_type'] != 'cart' && $data['payment_status'] != 'Refunded') {
return;
@max-kk
max-kk / fv_moderation_link.php
Last active October 3, 2016 10:02
Add moderation count + link to admin menu ZIP: https://yadi.sk/d/ZLu5-zRBw7y8r