Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
Bulk Actions Cron Offload
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
WP Plugins
Bulk Actions Cron Offload
Commits
079f67a5
Commit
079f67a5
authored
7 years ago
by
Erick Hitter
Browse files
Options
Downloads
Patches
Plain Diff
Start notices for pending move actions
parent
79f33fd2
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
includes/class-delete-all.php
+1
-1
1 addition, 1 deletion
includes/class-delete-all.php
includes/class-move-to-trash.php
+33
-1
33 additions, 1 deletion
includes/class-move-to-trash.php
with
34 additions
and
2 deletions
includes/class-delete-all.php
+
1
−
1
View file @
079f67a5
...
...
@@ -115,7 +115,7 @@ class Delete_All {
if
(
isset
(
$_REQUEST
[
self
::
ADMIN_NOTICE_KEY
]
)
)
{
if
(
1
===
(
int
)
$_REQUEST
[
self
::
ADMIN_NOTICE_KEY
]
)
{
$class
=
'notice-success'
;
$message
=
__
(
'Success! The trash will be emptied s
oon
.'
,
'bulk-edit-cron-offload'
);
$message
=
__
(
'Success! The trash will be emptied s
hortly
.'
,
'bulk-edit-cron-offload'
);
}
else
{
$class
=
'notice-error'
;
$message
=
__
(
'A request to empty the trash is already pending for this post type.'
,
'bulk-edit-cron-offload'
);
...
...
This diff is collapsed.
Click to expand it.
includes/class-move-to-trash.php
+
33
−
1
View file @
079f67a5
...
...
@@ -14,7 +14,7 @@ class Move_To_Trash {
/**
* Class constants
*/
const
CRON_EVENT
=
'bulk_edit_cron_offload_move_to_trash'
;
const
ADMIN_NOTICE_KEY
=
'bulk_edit_cron_offload_move_to_trash'
;
/**
* Register this bulk process' hooks
...
...
@@ -22,6 +22,8 @@ class Move_To_Trash {
public
static
function
register_hooks
()
{
add_action
(
Main
::
build_hook
(
'trash'
),
array
(
__CLASS__
,
'process'
)
);
add_action
(
Main
::
build_cron_hook
(
'trash'
),
array
(
__CLASS__
,
'process_via_cron'
)
);
add_action
(
'admin_notices'
,
array
(
__CLASS__
,
'admin_notices'
)
);
}
/**
...
...
@@ -84,6 +86,36 @@ class Move_To_Trash {
do_action
(
'bulk_edit_cron_offload_move_to_trash_request_no_posts'
,
$vars
->
posts
,
$vars
);
}
}
/**
* Let the user know what's going on
*/
public
static
function
admin_notices
()
{
$screen
=
get_current_screen
();
if
(
isset
(
$_REQUEST
[
self
::
ADMIN_NOTICE_KEY
]
)
)
{
if
(
1
===
(
int
)
$_REQUEST
[
self
::
ADMIN_NOTICE_KEY
]
)
{
$class
=
'notice-success'
;
$message
=
__
(
'Success! The selected posts will be moved to the trash shortly.'
,
'bulk-edit-cron-offload'
);
}
else
{
$class
=
'notice-error'
;
$message
=
__
(
'An unknown error occurred.'
,
'bulk-edit-cron-offload'
);
}
}
// TODO: show a notice if any move requests are pending for this post type ($screen->post_type).
// Nothing to display.
if
(
!
isset
(
$class
)
||
!
isset
(
$message
)
)
{
return
;
}
?>
<div
class=
"notice
<?php
echo
esc_attr
(
$class
);
?>
"
>
<p>
<?php
echo
esc_html
(
$message
);
?>
</p>
</div>
<?php
}
}
Move_To_Trash
::
register_hooks
();
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment