Skip to content

Commit a20810d

Browse files
committed
Add CF7 to recommended actions & plugins tab #206
1 parent 91e8a8b commit a20810d

File tree

4 files changed

+40
-3
lines changed

4 files changed

+40
-3
lines changed

functions.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ function shapely_setup() {
105105

106106
$shapely_recommended_plugins = array(
107107
'contact-form-7' => array(
108-
'recommended' => true,
108+
'recommended' => false,
109109
),
110110
'fancybox-for-wordpress' => array(
111111
'recommended' => false,
@@ -146,6 +146,13 @@ function shapely_setup() {
146146
'check' => Shapely_Notify_System::shapely_has_plugin( 'jetpack' ),
147147
'plugin_slug' => 'jetpack',
148148
),
149+
array(
150+
'id' => 'shapely-req-ac-install-contact-form-7',
151+
'title' => Shapely_Notify_System::shapely_cf7_title(),
152+
'description' => Shapely_Notify_System::shapely_cf7_description(),
153+
'check' => Shapely_Notify_System::shapely_has_plugin( 'contact-form-7' ),
154+
'plugin_slug' => 'contact-form-7',
155+
),
149156
array(
150157
'id' => 'shapely-req-import-content',
151158
'title' => esc_html__( 'Import content', 'shapely' ),

inc/admin/welcome-screen/class-shapely-notify-system.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,20 @@ public static function shapely_jetpack_title() {
161161
return esc_html__( 'Install: Jetpack by WordPress', 'shapely' );
162162
}
163163

164+
public static function shapely_cf7_title() {
165+
$installed = self::check_plugin_is_installed( 'contac-form-7' );
166+
if ( ! $installed ) {
167+
return esc_html__( 'Install: Contact Form 7', 'shapely' );
168+
}
169+
170+
$active = self::check_plugin_is_active( 'contac-form-7' );
171+
if ( $installed && ! $active ) {
172+
return esc_html__( 'Activate: Contact Form 7', 'shapely' );
173+
}
174+
175+
return esc_html__( 'Install: Contact Form 7', 'shapely' );
176+
}
177+
164178
/**
165179
* @return string
166180
*/
@@ -197,6 +211,21 @@ public static function shapely_jetpack_description() {
197211
return esc_html__( 'Please install Jetpack by WordPress. Note that you won\'t be able to use the Testimonials and Portfolio widgets without it.', 'shapely' );
198212
}
199213

214+
public static function shapely_cf7_description() {
215+
$installed = self::check_plugin_is_installed( 'contac-form-7' );
216+
217+
if ( ! $installed ) {
218+
return esc_html__( 'Please install Contact Form 7. Note that you won\'t be able to use Contact widget without it.', 'shapely' );
219+
}
220+
221+
$active = self::check_plugin_is_active( 'contac-form-7' );
222+
if ( $installed && ! $active ) {
223+
return esc_html__( 'Please activate Contact Form 7. Note that you won\'t be able to use Contact widget without it.', 'shapely' );
224+
}
225+
226+
return esc_html__( 'Please install Contact Form 7. Note that you won\'t be able to use Contact widget without it.', 'shapely' );
227+
}
228+
200229
public static function shapely_yoast_description() {
201230
$installed = self::check_plugin_is_installed( 'wordpress-seo' );
202231
if ( ! $installed ) {

inc/admin/welcome-screen/class-shapely-welcome.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,10 @@ public function shapely_dismiss_required_action_callback() {
129129

130130
switch ( esc_html( $_GET['todo'] ) ) {
131131
case 'add';
132-
$shapely_show_required_actions[ absint( $action_id ) ] = true;
132+
$shapely_show_required_actions[ $action_id ] = true;
133133
break;
134134
case 'dismiss';
135-
$shapely_show_required_actions[ absint( $action_id ) ] = false;
135+
$shapely_show_required_actions[ $action_id ] = false;
136136
break;
137137
default:
138138
return new WP_Error( 'Action denied!', __( 'I\'ve fallen and can\'t get up', 'shapely' ) );

inc/admin/welcome-screen/sections/actions-required.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
global $shapely_required_actions;
1515
if ( ! empty( $shapely_required_actions ) ) :
1616
$shapely_show_required_actions = get_option( 'shapely_show_required_actions' );
17+
1718
$hooray = true;
1819

1920
foreach ( $shapely_required_actions as $shapely_required_action_key => $shapely_required_action_value ) :

0 commit comments

Comments
 (0)