Skip to content

Instantly share code, notes, and snippets.

View JudeRosario's full-sized avatar

Jude Rosario JudeRosario

View GitHub Profile
@JudeRosario
JudeRosario / Better Logic.md
Last active August 29, 2015 14:15
Authorize.Net ARB : Membership

Better Processing Logic for Authorize.Net ARB (Membership)

Add this logic to the _process_serial_purchase function. Replace this line (~ Line number 900)

        $subscription->totalOccurrences = $total_occurencies;

With whats given below

@JudeRosario
JudeRosario / Query.php
Created February 12, 2015 20:07
Membership Pull List from DB
global $wpdb;
$heroes = $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 `level_id` = 1 AND `sub_id` = 2 ");
foreach ($heroes as $hero) {
// Do stuff here
}
@JudeRosario
JudeRosario / List by Join Date.sql
Created February 13, 2015 08:33
E-Newsletter SQL Fu
SELECT member_fname, member_lname, member_email, join_date
FROM wp_enewsletter_members
#Specify Range here if needed
WHERE join_date
BETWEEN 2015-01-30 23:59:59
AND 2015-02-01 23:59:59
#Sort Order
ORDER BY wp_enewsletter_members.join_date ASC
@JudeRosario
JudeRosario / The Pledges Query.sql
Last active August 29, 2015 14:15
Fundraising Exports
# You can pull additional data in the SELECT if needed
SELECT post_name, post_date, post_author,
post_status, post_parent, meta_value
# Both tables contain all the data you'll ever need with the plugin
FROM wp_posts
INNER JOIN wp_postmeta
ON wp_posts.ID = wp_postmeta.post_id
# You can set this to funder if you want to pull details on funds
@JudeRosario
JudeRosario / List Sites.php
Created February 24, 2015 16:43
WP Multisite list sites by user
// The user ID whose sites to display
$queried_user_id = '1' ;
// Select the list of valid Blogs you want to filter from
$site_args = array(
'network_id' => $wpdb->siteid,
'public' => null,
'archived' => null,
'mature' => null,
'spam' => null,
@JudeRosario
JudeRosario / Override Default Form.php
Last active November 22, 2016 10:35
M2 + Gravity Forms Registration
add_filter('ms_frontend_custom_registration_form','gravity_register_form') ;
function gravity_register_form($form) {
if(!is_user_logged_in())
return do_shortcode('[gravity_form id =1]');
return $form ;
}
@JudeRosario
JudeRosario / Custom Text Domain.php
Created March 19, 2015 22:59
Appointments+ Custom Text Domain
add_action('load_textdomain', 'load_custom_language_files_for_app_plugin', 10, 2);
function load_custom_language_files_for_app_plugin($domain, $mofile)
{
if ('appointments' === $domain && plugin_dir_path($mofile) === WP_PLUGIN_DIR.'/appointments/languages/')
{
// Put any path here
load_textdomain('appointments', WP_LANG_DIR.'/appointments/'.$domain.'-'.get_locale().'.mo');
}
}
@JudeRosario
JudeRosario / Center Anchor.js
Last active August 29, 2015 14:17
Appointments+ Center page after service selection
<script type="text/javascript">
jQuery(document).ready(function () {
if(window.location.href.indexOf("app_service_id") > -1
&& !(window.location.href.indexOf("app_provider_id") > -1) ) {
jQuery(document).scrollTop( jQuery('.my-appointments').offset().top );
}
});
</script>
@JudeRosario
JudeRosario / Custom Registration.php
Last active August 29, 2015 14:17
Protected Content + Gravity Forms
add_filter('ms_frontend_custom_registration_form', 'custom_registration');
function custom_registration () {
// Put your registration form shortcode here.
return do_shortcode('[gravityform id="1" title="false" description="false"]') ;
}
@JudeRosario
JudeRosario / Is Device Tablet.java
Last active August 29, 2015 14:17
Android Check Screen size for Tablet
boolean isTablet() {
DisplayMetrics metrics = new DisplayMetrics();
this.getWindowManager().getDefaultDisplay().getMetrics(metrics);
float yInches = metrics.heightPixels / metrics.ydpi;
float xInches = metrics.widthPixels / metrics.xdpi;
double diagonalInches = Math.sqrt(xInches * xInches + yInches * yInches);
if (diagonalInches >= 5.5) {
return true;
} else {