I solved this issue by doing as shown below.
I used Woo commerce Gift registry plugin replace the code with the below code in magenest-giftregistry-admin.php
<?php
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
if (! defined ( 'ABSPATH' ))
exit (); // Exit if accessed directly
class Magenest_Giftregistry_Admin {
/**
* Constructor.
*/
public function __construct() {
}
public function giftregistry_manage() {
if (isset ( $_REQUEST ['delete'] )) {
if (isset ( $_REQUEST ['id'] ))
$this->delete ( $_REQUEST ['id'] );
} elseif (isset ( $_REQUEST ['edit'] )) {
if (isset ( $_REQUEST ['id'] ))
$this->edit ( $_REQUEST ['id'] );
} elseif (isset ( $_REQUEST ['delete'] )) {
} else {
$this->index ();
}
}
public function giftregistry_manages() {
$rows_per_page = 10;
$current = (intval(get_query_var('paged'))) ? intval(get_query_var('paged')) : 1;
//$rows = $wpdb->get_results('SELECT * FROM subscriber ORDER BY sub_lname ASC');
$rows = Magenest_Giftregistry_Model::get_all_giftregistry();
$start = ($current - 1) * $rows_per_page;
$end = $start + $rows_per_page;
$end = (sizeof($rows) < $end) ? sizeof($rows) : $end;
$pagination_args = array(
'base' => esc_url_raw(@add_query_arg('paged','%#%')),
'format' => '?page=%#%',
'total' => ceil(sizeof($rows)/$rows_per_page) + 1,
'current' => $current,
'show_all' => False,
'prev_next' => True,
'prev_text' => __(' Previous'),
'next_text' => __('Next '),
'type' => 'plain',
'add_args' => False
);
echo paginate_links($pagination_args);
}
public static function index() {
// Test the use of paginate_links
$rows_per_page = 5;
$current = (isset($_REQUEST['paged'])&&intval($_REQUEST['paged']) ) ? intval($_REQUEST['paged']) : 1;
// $rows is the array that we are going to paginate.
$rows = Magenest_Giftregistry_Model::get_all_giftregistry();
$max_page = ceil(sizeof($rows)/$rows_per_page);
global $wp_rewrite,$wp_query;
$pagination_args = array(
'base' => esc_url_raw(@add_query_arg('paged','%#%')),
'format' => '',
'total' => ceil(sizeof($rows)/$rows_per_page),
'current' => $current,
'show_all' => false,
'type' => 'plain',
);
//if( $wp_rewrite->using_permalinks() )
// $pagination_args['base'] = user_trailingslashit( trailingslashit( remove_query_arg('s',get_pagenum_link(1) ) ) . 'page/%#%/', 'paged');
if( !empty($wp_query->query_vars['s']) )
$pagination_args['add_args'] = array('s'=>get_query_var('s'));
echo paginate_links($pagination_args);
$start = ($current - 1) * $rows_per_page;
$end = $start + $rows_per_page;
$end = (sizeof($rows) < $end) ? sizeof($rows) : $end;
echo '<table id="wishlit-tbl" class="wp-list-table widefat fixed">';
?>
<thead>
<tr>
<th>
<?php echo __('User id')?>
</th>
<th>
<?php echo __('Registrant name')?>
</th>
<th>
<?php echo __('Registrant email')?>
</th>
<th>
<?php echo __('Date Time')?>
</th>
<th>
<?php echo __('Delete')?>
</th>
<th>
<?php echo __('Edit')?>
</th>
</tr>
</thead>
<?php
for ($i=$start;$i < $end ;++$i ) {
$row = $rows[$i];
$phpdate = strtotime( $row['event_date_time'] );
$order_date = date('d M, Y h:i A', $phpdate);
$http_schema="http://";
if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']) {
$http_schema="https://";
}
$delete_link = $http_schema. $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] . '&delete=1';
$edit_link = $http_schema. $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] . '&edit=1';
echo '<tr>';
?>
<td><?php echo $row['user_id']?> </td>
<td><?php echo $row['registrant_firstname']?> </td>
<td><?php echo $row['registrant_email']?> </td>
<td><?php echo $order_date ?> </td>
<td><a href="https://wordpress.stackexchange.com/questions/203400/<?php echo $delete_link."&id='.$row['id'] ?>"><?php echo __('Delete', GIFTREGISTRY_TEXT_DOMAIN)?></a>
</td>
<td><a href="<?php echo $edit_link.'&id='.$row['id'] ?>"><?php echo __('Edit', GIFTREGISTRY_TEXT_DOMAIN)?></a>
</td>
<td></td>
<?php
echo '</tr>';
}
echo '</table>';
}
public function delete($id) {
Magenest_Giftregistry_Model::delete_giftregistry($id);
}
public function edit($id) {
?>
<br>
<button onclick="window.location.href="<?php echo get_admin_url(null,"admin.php?page=gift_registry')?>'" name="back" type="button" class="button button-primary button-large" id="back" accesskey="p" value="Back"><?php echo __('Gift registry manage')?> </button>
<?php
echo '<h2>Gift registry</h2>';
ob_start();
$template_path = GIFTREGISTRY_PATH.'template/account/';
$default_path = GIFTREGISTRY_PATH.'template/account/';
wc_get_template( 'add-giftregistry.php', array(
'wid' =>$id,
),$template_path,$default_path
);
echo ob_get_clean();
/////////////////////////////////////////////////////////////////////
/////////////////////////////GIFT REGISTRY ITEMS/////////////////////
////////////////////////////////////////////////////////////////////
$items = Magenest_Giftregistry_Model::get_items_in_giftregistry($id);
ob_start();
$template_path = GIFTREGISTRY_PATH.'template/account/';
$default_path = GIFTREGISTRY_PATH.'template/account/';
wc_get_template( 'my-giftregistry.php', array(
'items' =>$items,
'wid' =>$id
),$template_path,$default_path
);
echo ob_get_clean();
}
}