Skip to content

Instantly share code, notes, and snippets.

🤓
in the zone

Myles McNamara tripflex

🤓
in the zone
Block or report user

Report or block tripflex

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@tripflex
tripflex / functions.php
Created Aug 22, 2019
Remove application field sanitizer method (to use standard text sanitizer)
View functions.php
<?php
add_filter( 'submit_job_form_fields', 'smyles_remove_application_sanitizer' );
function smyles_remove_application_sanitizer( $fields ) {
if ( isset( $fields['job'], $fields['job']['application'], $fields['job']['application']['sanitizer'] ) ){
unset( $fields['job']['application']['sanitizer'] );
}
@tripflex
tripflex / crontab.c
Created Aug 20, 2019
Mongoose OS Crontab Register Callback in mJS
View crontab.c
#include "mgos.h"
#include "mgos_cron.h"
#include "mgos_crontab.h"
struct mgos_cronmanager_mjs_data
{
void (*cb)(const char *, void *);
void *ud;
};
@tripflex
tripflex / functions.php
Created Aug 20, 2019
Customize Google Auto Complete field options when using WP Job Manager Field Editor
View functions.php
<?php
add_filter( 'job_manager_Field_editor_autocomplete_field_options', 'smyles_custom_autocomplete_options', 10, 4 );
function smyles_custom_autocomplete_options( $options, $key, $args, $field ){
// @see https://developers.google.com/places/supported_types
$options['types'] = array( '(cities)' );
// @see https://developers.google.com/maps/documentation/javascript/places-autocomplete
@tripflex
tripflex / functions.php
Created Aug 8, 2019
Prepend URL scheme (http/https) to value saved when submitting a listing in WP Job Manager (if missing in field value filled out by user)
View functions.php
<?php
add_filter( 'job_manager_get_posted_fields', 'smyles_set_url_scheme_if_not_exists', 10, 2 );
function smyles_set_url_scheme_if_not_exists( $values, $fields ){
// Enter any Job, Company, or Resume fields you want to make sure have http or https in the field value before being saved
$url_fields = array( 'job_field_with_url', 'resume_field_with_url' );
// Set default scheme to http://
$scheme = 'http://';
@tripflex
tripflex / functions.php
Created Aug 6, 2019
Remove auto output li actions from automatically using <li> on output
View functions.php
<?php
add_filter( 'field_editor_auto_output_li_actions', 'smyles_remove_li_actions' );
function smyles_remove_li_actions( $actions ){
if( isset( $actions['single_resume_meta_start'] ) ){
unset( $actions['single_resume_meta_start'] );
}
@tripflex
tripflex / minmjs.js
Created Jul 26, 2019
Gulp tasks for Mongoose OS to minify mJS code to save space on devices
View minmjs.js
var gulp = require('gulp');
var pump = require('pump');
var strip = require('gulp-strip-comments');
var cleanhtml = require('gulp-cleanhtml');
var flatten = require('gulp-flatten');
var replace = require('gulp-replace');
gulp.task('mindeps', function () {
return gulp.src('deps/**/**/*.js', { base: "./" })
.pipe(strip())
@tripflex
tripflex / functions.php
Last active Jul 16, 2019
Require a specific field value (password) to submit a listing when using WP Job Manager Field Editor
View functions.php
<?php
add_filter( 'submit_job_form_validate_fields', 'smyles_validate_password_to_submit', 9999999, 3 );
function smyles_validate_password_to_submit( $has_error, $fields, $values ) {
$field_meta_key = "job_submit_password";
$password_value = "l33tpw";
// Return $has_error if this field doesn't exist (to prevent errors if you dont have field created)
@tripflex
tripflex / functions.php
Created Jun 25, 2019
Custom excerpt number of words for Job Description when using WP Job Manager Visibility plugin
View functions.php
<?php
add_filter( 'job_manager_visibility_job_description_num_words', 'smyles_custom_description_excerpt_length' );
function smyles_custom_description_excerpt_length( $length ){
// Default is 55 words, return the number of words to customize length of excerpt
return 25;
}
@tripflex
tripflex / style.css
Created Jun 6, 2019
Fix JobHunt Chosen.JS multi-select dropdown expanding after initial selection
View style.css
/* To fix JobHunt Chosen Multiselect dropdown showing expanded when has search selections */
fieldset > .field > .chosen-container-multi >.chosen-choices > .search-field > input[type="text"] {
margin: 0.75em 1em;
padding: 0px;
}
@tripflex
tripflex / functions.php
Created May 6, 2019
Remove auto populate current user email for application meta key in admin area on new listings for WP Job Manager
View functions.php
<?php
add_filter( 'job_manager_job_listing_data_fields', 'smyles_remove_auto_populate_application_email', 999999999, 2 );
/**
* Remove Auto Populate application meta key with user email in admin area
*
* @see https://github.com/Automattic/WP-Job-Manager/issues/1591
*
* @param $fields
You can’t perform that action at this time.