GeoDirectory and Theme My Login

This topic contains 9 replies, has 3 voices, and was last updated by  Stiofan O’Connor 7 years, 4 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #384560
    #384567

    Paolo
    Site Admin
    Post count: 31206

    Hi,

    I flagged this for Stiofan.

    He’ll let you know asap.

    Thanks

    #384589

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    The plugin is messing with queries when its functionality should not seem it needs to.
    you should go through the TML pluign and remove the add_action and add_filter calls untill its fixed, if u find that i’ll write a snippet to remove it.

    Stiofan

    #384613

    T L
    Expired Member
    Post count: 48

    Easy Peasy! 🙂

    In /includes/class-theme-my-login.php
    In the Load() function
    This is the culprit:

    add_action( 'pre_get_posts',           array( $this, 'pre_get_posts'           ) );

    I commented that out and the spurious search results went away.

    Tom

    #384614

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    i forget if it was just search or other things it was messing up, you can try this and if u see problems anywhere let let me know

    
    
    if(isset($_REQUEST['geodir_search'])){
        remove_action( 'pre_get_posts', array( 'Theme_My_Login, 'pre_get_posts' ) );
    }

    Stiofan

    #384625

    T L
    Expired Member
    Post count: 48

    Thanks Stiofan. Oddly, in the most recent versions, I was not able to get your code to actually remove the pre_get_posts action.

    After some playing, I found the following works:

    
    
    function _my_geodir_search_init () {
      if(isset($_REQUEST['geodir_search'])){
        remove_action( 'pre_get_posts', array( Theme_My_Login::get_object(), 'pre_get_posts' ) );
    	}
    }
    
    add_action('init','_my_geodir_search_init');
    #384626

    T L
    Expired Member
    Post count: 48

    ….and for others, added a check for the class in case you deactivate the plug-in, your site won’t die. 😉

    
    
    function _my_geodir_search_init () {
      if(isset($_REQUEST['geodir_search'])){
    	if(class_exists( 'Theme_My_Login' )) {
        	remove_action( 'pre_get_posts', array( Theme_My_Login::get_object(), 'pre_get_posts' ) );
    		}
    	}
    }
    
    add_action('init','_my_geodir_search_init');
    #384629

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    Thanks for this, please come back after you have tested if for a while, maybe its something we can integrate into core if its that simple.

    Thanks,

    Stiofan

    #385714

    T L
    Expired Member
    Post count: 48

    So far so good. Perhaps others can test this as well if added as a “Beta” feature in the product.

    #385771

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    Thanks for getting back to me, i’ll look at adding this.

    Stiofan

Viewing 10 posts - 1 through 10 (of 10 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
20% Discount Offer
Hurry! Get your 20% discount before it expires. Get 20% Discount