Birgir Erlendsson (birgire)
Forum Replies Created
-
Forum: Themes and Templates
In reply to: [Nisarg] Missing strings in nisarg.potgreat thanks @falguni
Forum: Plugins
In reply to: [Event Organiser] Agenda widget number of eventsps: and here’s a CSS workaround to only display 5 days in the ‘week’ mode and remove the agenda’s navigation bar:
.eo-agenda-widget .eo-agenda-widget-nav, .eo-agenda-widget ul.dates li.date:nth-child(6), .eo-agenda-widget ul.dates li.date:nth-child(7) { display: none; }
Forum: Plugins
In reply to: [Event Organiser] Agenda widget number of events@stephenharris: Thanks for a great plugin.
@blazeking and @kwida:
I just wanted to share with you my findings regarding
a likely reason for the cluttered agenda widget list in the ‘week’ or ‘month’ mode.I selected the ‘week’ mode and then dug through the code and found that the
group_change()
method only works for the ‘day’ mode.I’m not sure though why this mode restriction is added?
Here’s the relevant part from the
frontend.js
file:eventorganiser.agenda_widget.prototype.group_change = function( previous, current ){ if( previous === false ){ return true; } //------------------------------------------------------------ // This check is doesn't work well in 'week' or 'month' mode if( this.param.mode !== 'day' ){ return false; } //------------------------------------------------------------ return previous.format( 'YYYY-MM-DD' ) !== current.format( 'YYYY-MM-DD' ); };
The inline comment is added by myself for clarification.
I wouldn’t recommend modifying the plugin files though.
Hope this helps.
Forum: Plugins
In reply to: [YASR - Yet Another Star Rating Plugin for WordPress] Anonymize IP-Addresses?… and just one thing more to watch out for ??
Maybe add a check to avoid the case of trying to store empty/null IPs, since that might give db error.
Forum: Plugins
In reply to: [YASR - Yet Another Star Rating Plugin for WordPress] Anonymize IP-Addresses?ps: we must have the second input argument for
apply_filters()
to avoid warnings.Forum: Plugins
In reply to: [YASR - Yet Another Star Rating Plugin for WordPress] Anonymize IP-Addresses?sorry @dudo for that typo, these suggestions were of course for you ??
That’s great and hopefully it will help others that have problems with storing real IP addresses.
Have a nice weekend.
Forum: Plugins
In reply to: [YASR - Yet Another Star Rating Plugin for WordPress] Anonymize IP-Addresses?Thanks and greetings to K?ln ??
But you shouldn’t edit the plugin code directly and try this as a separate plugin instead. The Codex has some good examples on how to do that.
@ulrich To avoid registering actual IPs, maybe it would be beneficial to some users if there was a filter inside the
yasr_get_ip()
function?Example:
$REMOTE_ADDR = apply_filters( 'yasr_ip', $REMOTE_ADDR );
Then users could adjust that to their needs,
Example:
add_filter( 'yasr_ip', function( $ip ) { return '127.0.0.1'; } );
But we can’t have it empty because of how the field is defined:
ip varchar(45) COLLATE utf8_unicode_ci NOT NULL,
otherwise we could simply use:
add_filter( 'yasr_ip', '__return_null' );
ps: I see you use
CREATE TABLE IF NOT EXISTS
but then you’re not using the powers of dbDelta() if you later want to modify your db schema
I did recently some unrelated dbDelta testing here:
Here are some checks, Just in case other plugins mess up the
srcset
sources:/** * Force https scheme on srcset urls */ add_filter( 'wp_calculate_image_srcset', function( $sources ) { if( ! is_array( $sources ) ) return $sources; foreach( $sources as &$source ) { if( isset( $source['url'] ) ) $source['url'] = set_url_scheme( $source['url'], 'https' ); } return $sources; }, PHP_INT_MAX );
Previously posted on:
Forum: Fixing WordPress
In reply to: Embed .mov file via 'Add Media' not workinghehe, many thanks for the correction @claytonjames, the uploading is indeed supported and been for a long time ??
I was just too hasty here recalling the problem – the question wasn’t about uploading problems, but regarding the embedding via the “Add Media”.
By default the
wp_get_video_extensions()
returns'mp4', 'm4v', 'webm', 'ogv', 'wmv', 'flv'
where we can add
'mov'
via thewp_video_extensions
filter.Forum: Plugins
In reply to: [Contact Form 7] Function CallHi, skimming through the plugin code, you might try (untested):
if( function_exists( 'wpcf7_contact_form_tag_func' ) ) echo wpcf7_contact_form_tag_func( [ 'id' => 123, 'title' => '', 'html_id' => '', 'html_name' => '', 'html_class' => '', 'output' => 'form' ], '', 'contact-form-7' );
or
if ( function_exists( 'wpcf7_contact_form' ) && $contact_form = wpcf7_contact_form( $id = 123 ) ) $contact_form->form_html( [ 'id' => 123, 'title' => '', 'html_id' => '', 'html_name' => '', 'html_class' => '', 'output' => 'form' ] );
where I assume PHP 5.4+.
Forum: Fixing WordPress
In reply to: Embed .mov file via 'Add Media' not workingHi, I just stumbled in here ??
If we want to upload the
.mov
file, we will need the above filter, because it’s not supported by default.If we already have the
.mov
file uploaded to our site (like via ftp), we can use the shortcode directly, just as Brad Dalton mentioned.@dozza – note that I wrote the above filter example with PHP 5.3+ in mind, so most likely you got an older PHP version. If that’s the case, then this should work:
/** * Add support for the QuickTime (.mov) video format (PHP < 5.3 ) */ add_filter( 'wp_video_extensions', 'wpse_support_mov_format' ); function wpse_support_mov_format( $exts ) { $exts[] = 'mov'; return $exts; }
Forum: Plugins
In reply to: [MimeTypes Link Icons] pause_mtli() not workingsure, I wasn’t aware of the GitHub repo.
I just sent you a PR with priority changes in
pause_mtli()
andunpause_mtli()
, hope they are OK ??Thanks
No need to modify plugin code for this:
/** * Remove the YASR dashboard widget log */ add_action( 'plugins_loaded', function() { remove_action ( 'wp_dashboard_setup', 'yasr_add_dashboard_widget_log' ); }, 11 );
Forum: Plugins
In reply to: [YASR - Yet Another Star Rating Plugin for WordPress] Anonymize IP-Addresses?@JasperSteuerberater
Instead of editing the plugin after each update, you could simply remove the dashboard widget with:
/** * Remove the YASR dashboard widget log */ add_action( 'plugins_loaded', function() { remove_action ( 'wp_dashboard_setup', 'yasr_add_dashboard_widget_log' ); }, 11 );
and then just add your own modified dashboard widget, without the IP numbers.
You could also take the lazy road with:
/** * Replace IPs with xxx in the YASR dashboard widget log */ add_action( 'plugins_loaded', function() { // Remove the current YASR widget log: remove_action ( 'wp_dashboard_setup', 'yasr_add_dashboard_widget_log' ); // Add our modified YASR widget log: add_action( 'wp_dashboard_setup', function() { wp_add_dashboard_widget ( 'yasr_widget_log_dashboard', 'Recent Ratings', 'jasper_remove_ips' ); } ); }, 11 ); function jasper_remove_ips() { if( function_exists( 'yasr_display_dashboard_log_wiget' ) ) { ob_start(); yasr_display_dashboard_log_wiget(); echo preg_replace( '#(<span style="color:blue">)([^<]*)(</span>)#', '\1xxx\3', ob_get_clean() ); } }
You could then try to modify the above regex in a more general way, to keep it more future proof.
Well this would be easier if there would be a filter to handle this ??
Forum: Plugins
In reply to: [WooCommerce] Trigger Email on Refund OrderYou must register the
woocommerce_order_status_refund
hook first with thesend_transactional_email
callback.I think I found a way around this limitation here.
I hope it works for you.