Skip to content

Commit

Permalink
Merge pull request #136 from 10up/fix/135
Browse files Browse the repository at this point in the history
Fix/135 Re-adding "Square" Crop ability
  • Loading branch information
peterwilsoncc authored Jun 22, 2022
2 parents a6d3af8 + 8f4864f commit 9d66f67
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions assets/js/simple-local-avatars.js
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@ function simple_local_avatar_calculate_image_select_options(attachment, controll
y1,
x2: xInit + x1,
y2: yInit + y1,
aspectRatio: `${xInit}:${yInit}`,
};
}

Expand Down
9 changes: 9 additions & 0 deletions includes/class-simple-local-avatars.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ public function __construct() {
* Register actions and filters.
*/
public function add_hooks() {
global $pagenow;

add_filter( 'plugin_action_links_' . SLA_PLUGIN_BASENAME, array( $this, 'plugin_filter_action_links' ) );

Expand Down Expand Up @@ -133,6 +134,14 @@ public function add_hooks() {

add_filter( 'avatar_defaults', array( $this, 'add_avatar_default_field' ) );
add_action( 'wpmu_new_blog', array( $this, 'set_defaults' ) );

if ( 'profile.php' === $pagenow ) {
add_filter( 'media_view_strings', function ( $strings ) {
$strings['skipCropping'] = esc_html__( 'Default Crop', 'simple-local-avatars' );

return $strings;
}, 10, 1 );
}
}

/**
Expand Down

0 comments on commit 9d66f67

Please sign in to comment.