Skip to content

Commit

Permalink
Change the method name to be more relevant.
Browse files Browse the repository at this point in the history
  • Loading branch information
ve3 committed Dec 11, 2024
1 parent f87f661 commit e37fbd2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion App/Controllers/Admin/Plugin/Uninstall.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ private function doUninstallAction()

// reset order number in `posts` table.
$PostOrder = new \RdPostOrder\App\Models\PostOrder();
$PostOrder->resetPosts();
$PostOrder->setMenuOrderToZero();
unset($PostOrder);

// remove option related to this plugin.
Expand Down
4 changes: 3 additions & 1 deletion App/Controllers/Admin/Settings/MultisiteSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ public function networkSettingsPageAction()

$resetPostOrders = filter_input(INPUT_POST, 'rd-postorder-remove-order-numbers', FILTER_SANITIZE_NUMBER_INT);
if ($resetPostOrders == '1') {
// if setting to remove order numbers (reset post orders).
// reset post orders on all site.
global $wpdb;

$blog_ids = $wpdb->get_col('SELECT blog_id FROM '.$wpdb->blogs);
Expand All @@ -62,7 +64,7 @@ public function networkSettingsPageAction()
foreach ($blog_ids as $blog_id) {
switch_to_blog($blog_id);
// reset post order.
$PostOrder->resetPosts();
$PostOrder->setMenuOrderToZero();
}// endforeach;
unset($PostOrder);
}
Expand Down
6 changes: 3 additions & 3 deletions App/Models/PostOrder.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ public function getLatestMenuOrder()


/**
* Reset `menu_order` column on `posts` table to zero (its default value).
* Set `menu_order` column on `posts` table to zero (its default value).
*
* This will be use on uninstall or reset all posts order on multi-site admin settings.
*
* @global \wpdb $wpdb WordPress DB class.
*/
public function resetPosts()
public function setMenuOrderToZero()
{
global $wpdb;

Expand Down Expand Up @@ -79,7 +79,7 @@ public function resetPosts()
unset($row);
}
unset($results);
}// resetPosts
}// setMenuOrderToZero


/**
Expand Down

0 comments on commit e37fbd2

Please sign in to comment.