Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $query = $this->db->update(
- //do something
- );
- if($query == 0)
- {
- $this->setMessage('error', 'There was an error: ' . $this->db->print_error());
- }
- else
- {
- wp_redirect(site_url('/user_data/'));
- }
- public function redirect($url = false)
- {
- if(headers_sent())
- {
- $destination = ($url == false ? 'location.reload();' : 'window.location.href="' . $url . '";');
- echo die('<script>' . $destination . '</script>');
- }
- else
- {
- $destination = ($url == false ? $_SERVER['REQUEST_URI'] : $url);
- header('Location: ' . $destination);
- die();
- }
- }
- add_action ('wp_loaded', 'clean_admin_referer');
- function clean_admin_referer() {
- if ( isset( $_REQUEST['condition1']) && isset($_REQUEST['condition2']) ) {
- if (current_user_can('administrator')) {
- <!-- do your database magic -->
- $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'condition1', 'condition2' ));
- wp_redirect($_SERVER['REQUEST_URI']);
- }
- }
Add Comment
Please, Sign In to add comment