Skip to content

Instantly share code, notes, and snippets.

View JudeRosario's full-sized avatar

Jude Rosario JudeRosario

View GitHub Profile
@JudeRosario
JudeRosario / Append from BuddyPress.php
Last active August 29, 2015 14:14
Locations addon A+
// Process Confirmation and Reminders
add_filter( 'app_confirmation_message', 'append_location_to_app_email', 10, 3 );
add_filter( 'app_reminder_message', 'append_location_to_app_email', 10, 3 );
function append_location_to_app_email( $msg, $r, $app_id) {
// Get Worker Address from BuddyPress
$worker_location = xprofile_get_field_data( 'address', $r->worker );
if ( $worker_location ) {
$msg = str_replace( 'LOCATION', 'Location: ' . $worker_location, $msg );
}
@JudeRosario
JudeRosario / Gateway Code.php
Created February 4, 2015 15:29
Membership Authorize.NET
public function process_purchase() {
global $M_options;
if ( empty( $M_options['paymentcurrency'] ) ) {
$M_options['paymentcurrency'] = 'USD';
}
if ( ! is_ssl() ) {
wp_die( __( 'You must use HTTPS in order to do this', 'membership' ) );
exit;
}
@JudeRosario
JudeRosario / Emergency Trigger.php
Created February 5, 2015 10:46
Membership Force Communications
function emergency_mail_send()
{
global $wpdb;
$expiring_users = $wpdb->get_results("
SELECT `ID` , `sub_id` , `level_id`, `user_email` , `user_login` , `display_name`
FROM `wp_m_membership_relationships`
INNER JOIN `wp_users` ON wp_m_membership_relationships.user_id = wp_users.ID
WHERE `expirydate`
BETWEEN '2015-01-30 23:59:59'
@JudeRosario
JudeRosario / Lightbox Fix.php
Created February 5, 2015 11:01
MarketPress Lightbox Fix
// Some themes cause issues with the product list MarketPress displays, especially the Lightboxes
add_filter('mp_product_image','fix_lightbox',10,4);
function fix_lightbox( $image, $context, $post_id, $size ) {
// Apply this fix only when its a product list
if ($context === 'list') :
$thumb_html = get_the_post_thumbnail($post_id, $size);
@JudeRosario
JudeRosario / Activity+ SiteWideActivity.js
Last active August 29, 2015 14:14
Integrate SiteWide Activity and Activity+
var _swabpfbActiveHandler = false;
(function($){
$(function() {
var $form;
var $text;
var $textContainer;
@JudeRosario
JudeRosario / NoConflict.js
Last active August 29, 2015 14:14
BP & Activity+ NoConflict
<script>
$.noConflict();
// Explicitly put code in noConflict mode and wrap around with ready.fn.()
jQuery( document ).ready(function( $ ) {
var _bpfbActiveHandler=false;(function(e){e(function(){function u(){var e='<div class="bpfb_actions_container bpfb-theme-'+_bpfb_data.theme.replace(/[^-_a-z0-9]/ig,"")+" bpfb-alignment-"+_bpfb_data.alignment.replace(/[^-_a-z0-9]/ig,"")+'">'+'<div class="bpfb_toolbar_container">'+'<a href="#photos" class="bpfb_toolbarItem" title="'+l10nBpfb.add_photos+'" id="bpfb_addPhotos"><span>'+l10nBpfb.add_photos+"</span></a>"+"&nbsp;"+'<a href="#videos" class="bpfb_toolbarItem" title="'+l10nBpfb.add_videos+'" id="bpfb_addVideos"><span>'+l10nBpfb.add_videos+"</span></a>"+"&nbsp;"+'<a href="#links" class="bpfb_toolbarItem" title="'+l10nBpfb.add_links+'" id="bpfb_addLinks"><span>'+l10nBpfb.add_links+"</span></a>"+"</div>"+'<div class="bpfb_controls_container">'+"</div>"+'<div class="bpfb_preview_container">'+"</div>"+'<div class="bpfb_action_container">'+"</div>"+'<input type="b
@JudeRosario
JudeRosario / CoursePress Unit Progress Circle JS.js
Last active August 29, 2015 14:14
CoursePress customize colors knob.js
add_action('wp_footer', 'custom_dial_colors', 100);
function custom_dial_colors() {
$script = <<< EOT
<script type="text/javascript">
jQuery(document).ready(function($) {
if ( $( ".knob" ).length ) {
jQuery(".knob").trigger(
'configure',
{
@JudeRosario
JudeRosario / JS Changes.js
Created February 5, 2015 13:43
MarketPress Feature : Find product by Tag
// Modify two functions in your ajax-cart.js file.
// It can be found in the marketpress-includes/js folder.
// Simply copy/paste and //replace the 2 functions there with the code from here
// `mp_store_listeners` and `get_and_insert_products`
//general store listeners (e.g. pagination, etc)
function mp_store_listeners(){
// on next/prev link click, get page number and update products
$(document).on('click', '#mp_product_nav a', function(e){
e.preventDefault();
@JudeRosario
JudeRosario / One Blog Only.php
Created February 5, 2015 13:51
Force Single Blog Max Cap WP MS
// Special Thanks to Ashok and Tyler Postle for this code ( UNTESTED )
function wpms_one_blog_only($active_signup) {
// Get an array of the current user's blogs
$blogs = get_blogs_of_user( get_current_user_id() );
if ($blogs["1"]) unset($blogs["1"]);
$n = count($blogs);
if(n > 0){
$active_signup = 'none';
echo '';
@JudeRosario
JudeRosario / Custom Sidebars PRO.js
Last active August 29, 2015 14:14
Randomize DOM
// Explicitly pass the sidebar to the randomizer function
jQuery( document ).ready(function() {
jQuery(".sidebar").randomize("ul", "li");
});