Site icon Hip-Hop Website Design and Development

Redirecting takes me the consumer again to the login web page

So I am making an attempt to arrange a characteristic for the Occasions Supervisor plugin. The characteristic is a search bar that permits customers to be searched from the database after which chosen. This has all been achieved utilizing SELECT2 and AJAX.

However the issue is when a consumer is searched after which chosen from the drop-down, I must redirect to that consumer’s reserving web page. Which is similar web page because the search was carried out on: "http://{$sitedomain}/staged/wp-admin/edit.php?post_type=event&page=events-manager-bookings". However with this parameter added to the url: "&person_id={$the_id_of_the_selected_user}".

On my localhost website, the whole lot works positive. However once I uploaded the code onto the stay website I could not get it to work.

Every part works positive up till the redirect. As a substitute of redirecting to my URL. The positioning redirect lands on the wp-login.php?redirect_to= mainly to the right url above, with the right consumer id of the chosen consumer.

Once I click on login, I’m nonetheless not redirected to the web page I used to be in search of. Within the console, one thing is logged once I log again in: "key: undefined wp-memory-fix-config-manager.js?ver=2.13:9".

I’ve tried two strategies for redirecting.

  1. Utilizing jQuery:
   $('#search_bookings_users').on("change", perform(e){
       // console.log(e)
       if($('#search_bookings_users').select2('knowledge') !== null){
           window.location="http://domain/staged/wp-admin/edit.php?post_type=event&page=events-manager-bookings&person_id=" + $('#search_bookings_users').select2('knowledge')[0].id; 
       };
   });
  1. utilizing PHP kind submit:

add_action('em_bookings_admin_page', 'render__em_bookings_search_bar_adria');

perform render__em_bookings_search_bar_adria(){
    echo'<kind motion="" technique="GET" identify="bookings_search_form_adria"><label for"search_bookings_users">Search Customers:</label><choose identify="search_bookings_users[]" id="search_bookings_users">
    <possibility worth="search" chosen="selected" disabled hidden>-- Search By Title Or Electronic mail --</possibility>
    </choose><enter sort="submit" identify="bookings_search_form_submit_adria" class="button-primary" worth="Go" /></kind>';
}

add_action( 'admin_enqueue_scripts', 'hsb_select2_enqueue' );
perform hsb_select2_enqueue($hook){
    if('event_page_events-manager-bookings' === $hook){
        wp_enqueue_style('select2', plugins_url().'/woocommerce/property/css/select2.css' );
        wp_enqueue_script('select2', plugins_url().'/woocommerce/property/js/select2/select2.min.js', array('jquery') );
        wp_enqueue_script('events_manager_search_adria', get_stylesheet_directory_uri() . '/js/emSearchBarHSB.js', array( 'jquery', 'select2' ) ); 
        wp_localize_script('events_manager_search_adria', 'wp_ajax', array( 'url' => admin_url('admin-ajax.php'), 'nonce' => wp_create_nonce('********') ) );
    }

    if( isset($_GET['bookings_search_form_submit_adria']) ){
        $selected_users_id_adria=$_GET['search_bookings_users'][0];
        wp_safe_redirect("http://domain/staged/wp-admin/edit.php?post_type=event&page=events-manager-bookings&person_id=".$selected_users_id_adria);
        exit;       
    }
}

Each end in the identical error. So at this level, I’d guess this has nothing to do with the best way I’m redirecting. I am not skilled sufficient with WordPress or PHP to determine the issue. I simply began working with each simply round 2 months in the past.

That is my first ever put up, I can normally work issues out by studying different folks’s posts. If I missed one thing, or if you need extra info on something please let me know. Any form of suggestions can be drastically appreciated. Thanks upfront.