T L

Forum Replies Created

Viewing 15 posts - 16 through 30 (of 35 total)
  • Author
    Posts
  • in reply to: GeoDirectory and Theme My Login #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');
    in reply to: GeoDirectory and Theme My Login #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


    T L
    Expired Member
    Post count: 48

    Thanks Paolo,

    That could work for the simple email I described. However, we’ve now determined we need to do some additional WordPress magic behind the scenes, so knowing the hook to be used after successful listing payment is needed.

    in reply to: Reviews Counts Incorrect after Deleting a Review #384410

    T L
    Expired Member
    Post count: 48

    24 hours since the review was deleted and the count is still incorrect. Also, still unable to find the referenced “GD>Tools>Location category counts” option. Not listed in our GD Tools section.

    in reply to: Reviews Counts Incorrect after Deleting a Review #384386

    T L
    Expired Member
    Post count: 48
    This reply has been marked as private.
    in reply to: Conditional Rating Stars Output #380356

    T L
    Expired Member
    Post count: 48

    Stiofan, I am so sorry. 🙁 You are so correct and I feel like a complete idiot. My bad completely. UGH!

    Thanks!!!

    in reply to: Conditional Rating Stars Output #380349

    T L
    Expired Member
    Post count: 48

    Unfortunately, no. That does not provide the standard output. Just tested it again. Did some more digging and found the reason.

    If apply_filters() is not run the following evaluates true and the standard output is allowed to generate:

    $post->{$cf['htmlvar_name']})

    If apply_filters() runs, the above test results in a ‘NULL’ result and standard output is not generated. Looks like $cf still contains all the appropriate values after apply_filters runs. Perhaps ‘htmlvar_name’ is being unset or changed. I’ll keep digging.

    This is the filter check in custom_fields_output_functions.php.

    
    
    // Check if there is a custom field specific filter.
        if(has_filter("geodir_custom_field_output_multiselect_var_{$html_var}")){
            /**
             * Filter the multiselect html by individual custom field.
             *
             * @param string $html The html to filter.
             * @param string $location The location to output the html.
             * @param array $cf The custom field array.
             * @since 1.6.6
             */
            $html = apply_filters("geodir_custom_field_output_multiselect_var_{$html_var}",$html,$location,$cf);
        }

    Thanks.

    in reply to: Conditional Rating Stars Output #380310

    T L
    Expired Member
    Post count: 48

    My apology for not being clear Stiofan. 😉

    
    
    function _my_custom_field_output_multiselect_var_geodir_procurement_vehicle($r_html,$location,$cf) {
      global $pmpro_view_procurement_vehicles;
      global $post;
      $pre = '<div class="geodir_more_info  geodir_procurement_vehicle" style="clear:both;">';
      $post = '</div>';
        if (!pmpro_hasMembershipLevel()) { 
    	  $r_html = $pre;
    	  $r_html .= '<span class="geodir-i-select" style=""><i class="fa fa-dollar"></i>Cooperative Contracts: </span><a href="/membership-account/membership-levels/">Join to see</a>';
    	  $r_html .= $post;
    	} elseif (!pmpro_hasMembershipLevel($pmpro_view_procurement_vehicles)) { 
    	  $r_html = $pre;
    	  $r_html .= '<span class="geodir-i-select" style=""><i class="fa fa-dollar"></i>Cooperative Contracts: </span><a href="/membership-account/membership-levels/">Upgrade to view</a>';
    	  $r_html .= $post;
    	} else {
    	  $r_html = '';
              /* Want to exit my custom function and return to geodir_cf_multiselect and have default output generated */
    	  return $r_html;
    	}
        return $r_html;
    }
    
    add_filter('geodir_custom_field_output_multiselect_var_geodir_procurement_vehicle','_my_custom_field_output_multiselect_var_geodir_procurement_vehicle',10,3);

    In the final else branch above, I want the standard default output of the field to be generated.

    This means returning to the caller, geodir_cf_multiselect() where line 988 is testing for the existence of $html before generating default output content. $html will always exist when using a filter.

    Thanks!!

    in reply to: Conditional Rating Stars Output #380303

    T L
    Expired Member
    Post count: 48

    Thank-you Stiofan. I tested the above snippet with a

    return '&nbsp;';

    in the final else branch. Unfortunately, this still leaves $html defined in Line 988 of custom_fields_output_functions.php. This means the conditional test evaluates false and no output is generated.

    in reply to: Conditional Rating Stars Output #379655

    T L
    Expired Member
    Post count: 48

    Stiofan. This works well with one exception. When I return an empty value, the custom_fields_output_functions.php then uses the php “empty($html);” test. Depending on the version of php and the data type, different results occur. See line 988 of the current file as an example.

    Instead of empty(), I wonder if it would be possible for you to change the test to check for a string length of 0 or another test. Doing so would allow us to override the output using the respective filter and still return an empty value that would allow the default output to take place. This keeps us from having to copy the standard output into our custom filter overrides and respect the good default output you already provide.

    As an example, here is my application of the filter. Note the final test case returning an empty value in an attempt to allow the default output from the geodir_cf_multiselect function. Since the empty($html) if statement tests for the existence of $html, we never enter the conditional output. (Line 988 of custom_fields_output_functions.php)

    
    
    function _my_custom_field_output_multiselect_var_geodir_procurement_vehicle($r_html,$location,$cf) {
      global $pmpro_view_procurement_vehicles;
      global $post;
      $pre = '<div class="geodir_more_info  geodir_procurement_vehicle" style="clear:both;">';
      $post = '</div>';
        if (!pmpro_hasMembershipLevel()) { 
    	  $r_html = $pre;
    	  $r_html .= '<span class="geodir-i-select" style=""><i class="fa fa-dollar"></i>Cooperative Contracts: </span><a href="/membership-account/membership-levels/">Join to see</a>';
    	  $r_html .= $post;
    	} elseif (!pmpro_hasMembershipLevel($pmpro_view_procurement_vehicles)) { 
    	  $r_html = $pre;
    	  $r_html .= '<span class="geodir-i-select" style=""><i class="fa fa-dollar"></i>Cooperative Contracts: </span><a href="/membership-account/membership-levels/">Upgrade to view</a>';
    	  $r_html .= $post;
    	} else {
    	  $r_html = ' ';
    	  return $r_html;
    	}
        return $r_html;
    }
    
    add_filter('geodir_custom_field_output_multiselect_var_geodir_procurement_vehicle','_my_custom_field_output_multiselect_var_geodir_procurement_vehicle',10,3);

    Thoughts?

    Tom

    in reply to: Conditional Rating Stars Output #379358

    T L
    Expired Member
    Post count: 48

    Thank-you Stiofan! That was exactly what we needed. Please accept our sincerest thanks!

    in reply to: Conditional Rating Stars Output #379309

    T L
    Expired Member
    Post count: 48

    Stiofan,

    Thank-you for the reply. What I have found is that the .html filter is only called on the Overall rating on the detail page, but appears to not be called in the list view nor in the comments/reviews.

    An example of what is only fired on the detail listing page for the overall rating:

    
    
    function _my_get_rating_stars_html($r_html)
    {
        if (!pmpro_hasMembershipLevel()) {
    	  $r_html = 'Join to see ratings';
    	} elseif (!pmpro_hasMembershipLevel('4')) { 
    	  $r_html = preg_replace('gd-fa-star-rating','gd-fa-star-rating hide',$r_html);
    	  $r_html = preg_replace('gd-star-rating','gd-star-rating hide',$r_html);
    	  $r_html .= '<h1>Rating Override</h1>';
    	} else {
    	   $r_html = geodir_get_rating_stars('0', $post->ID);
    	   $r_html .= 'Upgrade to See Ratings';
    	}
        return $r_html;
    }
    
    add_filter('geodir_get_rating_stars_html','_my_get_rating_stars_html');

    Thank-you.

    in reply to: Conditional Rating Stars Output #379215

    T L
    Expired Member
    Post count: 48

    Still looking for how best to override this as described above. Any thoughts? Thanks again.

    in reply to: Conditional Rating Stars Output #378362

    T L
    Expired Member
    Post count: 48

    Thanks Stiofan.

    I am wanting to conditionally show/hide rating stars on all listing pages and the details page. Everywhere they show.

    Logic is something like:

    If user is anonymous, display a message and sign-up link instead of stars.
    If user in Role A, display a message and link for upgrade.
    If user in Role B, show rating stars.

    Does that help? Thanks in advance for pointing us in the right direction.

    T

    in reply to: Page included in gd_place search results #376752

    T L
    Expired Member
    Post count: 48

    It was indeed the “Theme My Login” plugin as a conflict. Wondering what the issues is. Perhaps a filter prioritization issue…. anybody ever get to a general idea of the issue so that I can report it to the TML devs?

Viewing 15 posts - 16 through 30 (of 35 total)