#20305 closed defect (bug) (fixed)
update_blog_status should also handle delete/undelete cases
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 3.5 | Priority: | normal |
| Severity: | normal | Version: | 3.2.1 |
| Component: | Multisite | Keywords: | dev-feedback has-patch |
| Focuses: | Cc: |
Description
function update_blog_status defined in /includes/ms-blog.php fires the following actions:
... if ( 'spam' == $pref ) ( $value == 1 ) ? do_action( 'make_spam_blog', $blog_id ) : do_action( 'make_ham_blog', $blog_id ); elseif ( 'mature' == $pref ) ( $value == 1 ) ? do_action( 'mature_blog', $blog_id ) : do_action( 'unmature_blog', $blog_id ); elseif ( 'archived' == $pref ) ( $value == 1 ) ? do_action( 'archive_blog', $blog_id ) : do_action( 'unarchive_blog', $blog_id ); elseif ( 'archived' == $pref ) ( $value == 1 ) ? do_action( 'archive_blog', $blog_id ) : do_action( 'unarchive_blog', $blog_id ); ...
As you see 'archived' is handled twice, while 'deleted' is not handled at all.
The the code should go as follows:
... if ( 'spam' == $pref ) ( $value == 1 ) ? do_action( 'make_spam_blog', $blog_id ) : do_action( 'make_ham_blog', $blog_id ); elseif ( 'mature' == $pref ) ( $value == 1 ) ? do_action( 'mature_blog', $blog_id ) : do_action( 'unmature_blog', $blog_id ); elseif ( 'archived' == $pref ) ( $value == 1 ) ? do_action( 'archive_blog', $blog_id ) : do_action( 'unarchive_blog', $blog_id ); elseif ( 'deleted' == $pref ) ( $value == 1 ) ? do_action( 'delete_blog', $blog_id ) : do_action( 'undelete_blog', $blog_id ); ...
Please include in the next release. Thank you.
Attachments (3)
Change History (14)
#2
@
14 years ago
Then function update_blog_details defined in /includes/ms-blogs.php handles only changed on spam/ham:
...
// If spam status changed, issue actions.
if ( $details[ 'spam' ] != $current_details[ 'spam' ] ) {
if ( $details[ 'spam' ] == 1 )
do_action( "make_spam_blog", $blog_id );
else
do_action( "make_ham_blog", $blog_id );
}
...
Natural.ly, to be consistent, it should also handle archive/unarchived and delete/undelete.
#3
@
14 years ago
Hence the corresponding code should go into function update_blog_details defined in /includes/ms-blogs.php:
...
// If archived status changed, issue actions.
if ( $details[ 'archived' ] != $current_details[ 'archived' ] ) {
if ( $details[ 'archived' ] == 1 )
do_action( "archive_blog", $blog_id );
else
do_action( "unarchive_blog", $blog_id );
}
// If deleted status changed, issue actions.
if ( $details[ 'deleted' ] != $current_details[ 'deleted' ] ) {
if ( $details[ 'deleted' ] == 1 )
do_action( "make_delete_blog", $blog_id );
else
do_action( "make_undelete_blog", $blog_id );
}
...
#7
@
13 years ago
- Keywords dev-feedback added
$drop has to be true for tables to drop and this to be irreversible, should users be removed if $drop is false? They are currently.
#8
@
13 years ago
- Keywords has-patch added; needs-patch removed
- Milestone changed from Awaiting Review to 3.5
Note: See
TracTickets for help on using
tickets.
Just discovered that there is already an action 'delete_blog', which is triggered in function wpmu_delete_blog defined in /wp-admin/includes/ms.php
Thus we need to come up with better and more unique names: