GeoDirectory not installed – poorly handled

This topic contains 2 replies, has 2 voices, and was last updated by  Vikas 10 years ago.

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

Open Support Ticket
  • Author
    Posts
  • #1078

    Jeff
    Buyer
    Post count: 188

    Hi guys, while updating one of my plugins, I tried deactivating WPGeoDirectory to see how my check worked. I discovered that your add-on plugins are not handling the missing plugin gracefully.

    
    
    	// First check if geodir main pluing is active or not.
    	if (!get_option('geodir_installed')) {
    		$error = new WP_Error('broke', __('<span style="color:#FF0000">There was an issue determining where GeoDirectory Plugin is installed and activated. Please install or activate GeoDirectory Plugin.</span>', GEODIRAUTOCOMPLETER_TEXTDOMAIN));
    			echo $error->get_error_message();
    		die;
    	}

    This function takes the user to a new page and then DIEs. Leaving them with a blank screen & your error. Clicking back produces the same error again as the function runs again. I got caught in a pretty bad loop this way and had to work hard to get out of it.

    Might I suggest something more WordPress-y?

    
    
    if (!get_option('geodir_installed')) {
        if( !( function_exists('gd_not_installed_error') ) ){
            function gd_not_installed_error(){
                $error = new WP_Error('broke', __('<span style="color:#dd3d36">There was an issue determining where GeoDirectory Plugin is installed and activated. Please install or activate GeoDirectory Plugin.</span>', 'gd-exporter'));
                echo '<div class="error">';
                echo $error->get_error_message();
                echo '</div>';
            }
        }
        add_action( 'admin_notices', 'gd_not_installed_error' );
    }
    #1079

    Jeff
    Buyer
    Post count: 188

    Noticed that my example isn’t the best either, but at least the user isn’t left dead in the water.

    #1080

    Vikas
    Full Member
    Post count: 1128

    Hi,

    Thanks for highlighting this, I will fix it.

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

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

Open Support Ticket