Title: sergio79's Replies | WordPress.org

---

# sergio79

  [  ](https://wordpress.org/support/users/sergio79/)

 *   [Profile](https://wordpress.org/support/users/sergio79/)
 *   [Topics Started](https://wordpress.org/support/users/sergio79/topics/)
 *   [Replies Created](https://wordpress.org/support/users/sergio79/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/sergio79/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/sergio79/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/sergio79/engagements/)
 *   [Favorites](https://wordpress.org/support/users/sergio79/favorites/)

 Search replies:

## Forum Replies Created

Viewing 15 replies - 1 through 15 (of 41 total)

1 [2](https://wordpress.org/support/users/sergio79/replies/page/2/?output_format=md)
[3](https://wordpress.org/support/users/sergio79/replies/page/3/?output_format=md)
[→](https://wordpress.org/support/users/sergio79/replies/page/2/?output_format=md)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Waitlist Woocommerce ( Back in stock notifier )] Emails sent to all users with field A:](https://wordpress.org/support/topic/emails-sent-to-all-users-with-field-a/)
 *  Thread Starter [sergio79](https://wordpress.org/support/users/sergio79/)
 * (@sergio79)
 * [1 year, 3 months ago](https://wordpress.org/support/topic/emails-sent-to-all-users-with-field-a/#post-18345821)
 * Yes I use premium. I wrote in the past for another problem, but never got a response
   from that form, I hope better this time. Thank you.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Waitlist Woocommerce ( Back in stock notifier )] Emails sent to all users with field A:](https://wordpress.org/support/topic/emails-sent-to-all-users-with-field-a/)
 *  Thread Starter [sergio79](https://wordpress.org/support/users/sergio79/)
 * (@sergio79)
 * [1 year, 3 months ago](https://wordpress.org/support/topic/emails-sent-to-all-users-with-field-a/#post-18345770)
 * I’m using version 3.1.1, which I honestly believe never automatically updated—
   I’m going from memory. What is the latest version?
 * Unfortunately, I cannot give access to the site because it is a very complex 
   ecommerce, in production.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[User Switching] Strange cookie behaviour](https://wordpress.org/support/topic/strange-cookie-behaviour/)
 *  Thread Starter [sergio79](https://wordpress.org/support/users/sergio79/)
 * (@sergio79)
 * [1 year, 11 months ago](https://wordpress.org/support/topic/strange-cookie-behaviour/#post-17886228)
 * Hi John,
 * actually in a custom function of mine I had tried to extend the cookie expiration:
 * add_filter(‘auth_cookie_expiration’, ‘extend_cookie_expiration’, 10, 3);
   function
   extend_cookie_expiration($length, $user_id, $remember) {return 60 * 60 * 168;}
 * Commented out this function, now everything seems to work correctly. Does this
   make sense?
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[FileBird - WordPress Media Library Folders & File Manager] Empty Media popup when setting product foto](https://wordpress.org/support/topic/empty-media-popup-when-setting-product-foto/)
 *  Thread Starter [sergio79](https://wordpress.org/support/users/sergio79/)
 * (@sergio79)
 * [2 years ago](https://wordpress.org/support/topic/empty-media-popup-when-setting-product-foto/#post-17785412)
 * Hi Mia, did you carry out that test with the Lite or Pro version?
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[FileBird - WordPress Media Library Folders & File Manager] Empty Media popup when setting product foto](https://wordpress.org/support/topic/empty-media-popup-when-setting-product-foto/)
 *  Thread Starter [sergio79](https://wordpress.org/support/users/sergio79/)
 * (@sergio79)
 * [2 years ago](https://wordpress.org/support/topic/empty-media-popup-when-setting-product-foto/#post-17783323)
 * I’m on the free version right now (I’ll be purchasing it soon), so I can’t open
   tickets on ninjateam … I just wanted to report this glitch (waiting for a bug
   fix).
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[FileBird - WordPress Media Library Folders & File Manager] Empty Media popup when setting product foto](https://wordpress.org/support/topic/empty-media-popup-when-setting-product-foto/)
 *  Thread Starter [sergio79](https://wordpress.org/support/users/sergio79/)
 * (@sergio79)
 * [2 years ago](https://wordpress.org/support/topic/empty-media-popup-when-setting-product-foto/#post-17783179)
 * Sure!
 * [https://ibb.co/26nyXpg](https://ibb.co/26nyXpg)
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[User Switching] Use for woocommerce user switching and order entry](https://wordpress.org/support/topic/use-for-woocommerce-user-switching-and-order-entry/)
 *  Thread Starter [sergio79](https://wordpress.org/support/users/sergio79/)
 * (@sergio79)
 * [2 years, 1 month ago](https://wordpress.org/support/topic/use-for-woocommerce-user-switching-and-order-entry/#post-17692827)
 * Hi John, I wanted to know one last thing:
 * when I switch from admin (or other role) to a user, I am redirected to the /account
   page (but I can also change it by adding the redirect_to query argument) and 
   the URL is “clean”.
 * However, when I click on the link to return to the starting user, the URL is 
   enriched with “user_switched=true&switched_back=true”. Are these parameters necessary?
   Can I somehow remove them?
 * Thanks so much!
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[User Switching] Use for woocommerce user switching and order entry](https://wordpress.org/support/topic/use-for-woocommerce-user-switching-and-order-entry/)
 *  Thread Starter [sergio79](https://wordpress.org/support/users/sergio79/)
 * (@sergio79)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/use-for-woocommerce-user-switching-and-order-entry/#post-17555116)
 * I’d like to update you, I think I’ve solved it:
 * in my process, I call an AJAX action that I call with a dropdown populated with
   a list of users.
 * With the function explained here [https://wordpress.org/plugins/user-switching/#can%20i%20add%20a%20custom%20%22switch%20to%22%20link%20to%20my%20own%20plugin%20or%20theme%3F](https://wordpress.org/plugins/user-switching/#can%20i%20add%20a%20custom%20%22switch%20to%22%20link%20to%20my%20own%20plugin%20or%20theme%3F)
   unfortunately the URL contained the & encoded, so I had to add an “htmlspecialchars_decode”
   to the generated $url, and now everything works! <3
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[User Switching] Use for woocommerce user switching and order entry](https://wordpress.org/support/topic/use-for-woocommerce-user-switching-and-order-entry/)
 *  Thread Starter [sergio79](https://wordpress.org/support/users/sergio79/)
 * (@sergio79)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/use-for-woocommerce-user-switching-and-order-entry/#post-17553700)
 * I think (maybe) I understand the problem.
 * I tried to simulate user switching on the frontend side, this time as an administrator,
   and not as a custom role (to be enabled for the user switching function).
 * When I am in the user list (backend), the “Switch to” button has an address like
   this:
 * `wp-login.php?action=switch_to_user&user_id=1234&nr=1&_wpnonce=d6d1234aa1`
 *  … clicking it works , I am redirected to that user’s dashboard. If I open the
   frontend obviously I find myself on the website logged in as that user. Everything
   works.
 * In my case I was trying to insert a user list (a filtered drop down menu with
   a list of “customer” type users) on the frontend, and when selected a user I 
   wanted to activate your function, but always send him back to the home of the
   site.
 * When I compose my drop-down, on each option I put the User ID, and then via jQuery
   on “on select” I make a location.href towards the URL created with your function:
 * `user_switching::maybe_switch_url( $MyWPuser )`
 * In fact the URL is identical:
 * `wp-login.php?action=switch_to_user&user_id=1234&nr=1&_wpnonce=d6d1234aa1`
 * … but I get a blank page and the error “Could not switch users” … There’s something
   I’m missing 🙁
    -  This reply was modified 2 years, 2 months ago by [sergio79](https://wordpress.org/support/users/sergio79/).
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[User Switching] Use for woocommerce user switching and order entry](https://wordpress.org/support/topic/use-for-woocommerce-user-switching-and-order-entry/)
 *  Thread Starter [sergio79](https://wordpress.org/support/users/sergio79/)
 * (@sergio79)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/use-for-woocommerce-user-switching-and-order-entry/#post-17552051)
 * Of course I followed the FAQ, and I also inserted:
 * `add_filter( 'user_has_cap', function( $allcaps, $caps, $args, $user ) {
   if ('
   switch_to_user' === $args[0] ) {if (in_array('agent', $user->roles)){$allcaps['
   switch_users'] = true;}}return $allcaps;}, 9, 4 );
 * But when I switch with the generated URL, I get “Could not switch users”…
 * From the backend, with the administrator level however this does not happen and
   it works smoothly.
 * Thanks.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[User Switching] Use for woocommerce user switching and order entry](https://wordpress.org/support/topic/use-for-woocommerce-user-switching-and-order-entry/)
 *  Thread Starter [sergio79](https://wordpress.org/support/users/sergio79/)
 * (@sergio79)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/use-for-woocommerce-user-switching-and-order-entry/#post-17551750)
 * In my case there are Commercial Agents, who should send orders on behalf of customers,
   using the frontend.
   I therefore have my “agent” role defined like this:
 * `function add_agenti_role() {
   add_role('agent','Commercial Agent',array('read'
   => true,'list_users' => true));$role = get_role('agent');$role->add_cap('switch_users');}
   add_action('init', 'add_agenti_role');
 * I tried to get the URL for the user switch like this:
 * `if ( method_exists( 'user_switching', 'maybe_switch_url' ) ) {
   $wpUser = get_user_by('
   id', $selectedUserID);$url = user_switching::maybe_switch_url( $wpUser );}
 * But the generated URL sends me back to the login page to enter the credentials
   again, so I also logged out… what am I doing wrong?
 * PS: the use I would like to make of it is for “internal” use, the frontend functionality
   will therefore only appear for that small group of users, do you think that the
   security problems you were talking about could also occur in this way?
 * Thanks so much <3
    -  This reply was modified 2 years, 2 months ago by [sergio79](https://wordpress.org/support/users/sergio79/).
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Relevanssi Live Ajax Search] Custom search template with Oxygen builder & WPML](https://wordpress.org/support/topic/custom-search-template-with-oxygen-builder-wpml/)
 *  Thread Starter [sergio79](https://wordpress.org/support/users/sergio79/)
 * (@sergio79)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/custom-search-template-with-oxygen-builder-wpml/#post-17517698)
 * I understand, thanks Mikko.
   I did a test by calling up my custom template like
   this:
 * add_filter( ‘relevanssi_live_search_results_template’, function ( $location ){
   
   return plugin_dir_path(**FILE**) . ‘/live-ajax-search/search-results-query.php’;});
 * but I get this error 🙁
 * PHP Fatal error: Uncaught Error: Call to a member function have_posts() on null
   in /…/live-ajax-search/search-results-query.php:25
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Relevanssi - A Better Search] post__in filter for cpt](https://wordpress.org/support/topic/post__in-filter-for-cpt/)
 *  Thread Starter [sergio79](https://wordpress.org/support/users/sergio79/)
 * (@sergio79)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/post__in-filter-for-cpt/#post-17510769)
 * Ok perfect, so I better get the language from $post->ID (of relevanssi_content_to_index)
   and then make my query to have the content only in that language, fantastic approach!
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Relevanssi - A Better Search] post__in filter for cpt](https://wordpress.org/support/topic/post__in-filter-for-cpt/)
 *  Thread Starter [sergio79](https://wordpress.org/support/users/sergio79/)
 * (@sergio79)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/post__in-filter-for-cpt/#post-17509604)
 * Hi Mikko, fantastic, it’s the function I needed, it works great!
 * I still have some doubts:
 * 1) Can I make a single select on my external DB by concatenating the 3 fields
   I need (short description, description, keyword), filtering by $post->ID and 
   putting everything in $content?
   2) I use WPML on my site, should I differentiate
   the contents taken from the external DB based on the language?
 * Thanks as usual!
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Relevanssi - A Better Search] post__in filter for cpt](https://wordpress.org/support/topic/post__in-filter-for-cpt/)
 *  Thread Starter [sergio79](https://wordpress.org/support/users/sergio79/)
 * (@sergio79)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/post__in-filter-for-cpt/#post-17491154)
 * Thanks Mikko, your support is always special.
   With relevanssi_content_to_index
   I will then make a SELECT query on all the fields of my DB/Table external to 
   WP, and these data/fields will be automatically inserted into the index so that
   relevanssi can do searches on it? Is the association of this external data done
   automatically based on the post-ID?

Viewing 15 replies - 1 through 15 (of 41 total)

1 [2](https://wordpress.org/support/users/sergio79/replies/page/2/?output_format=md)
[3](https://wordpress.org/support/users/sergio79/replies/page/3/?output_format=md)
[→](https://wordpress.org/support/users/sergio79/replies/page/2/?output_format=md)