WordPress.org

Ready to get started?Download WordPress

Forums

Theme My Login
Theme My Login cannot read my query? (2 posts)

  1. gdprabowo
    Member
    Posted 6 months ago #

    Halo WordPress experts!

    Before I continue, let me thank you the author of Theme My Login for creating such a wonderful plugin. :)

    Anyways, I have installed Theme-My-Login into my freshly installed WordPress 3.8.1. I have modified login, register, and profile pages accordingly, and put them in my template's root folder. I also have put theme-my-login-custom.php in my plugin's root folder. In my testing environment, (I am using xampp, latest version) everything works very well. No errors whatsoever. But now, I am going online, and suddenly it gives errors.

    I have done a quick research and this is what i found:

    • My code below generates an error: ($wpdb->get_results('SELECT value FROM wp_syslookup WHERE code = "'.get_post_meta( $_POST['id'], 'main_addr_country_code', true).'"')[0]->value)

    I have checked, all my codes (in theme-my-login-custom.php, login, profile, register pages) that contain $wpdb->getResults() seem to generate errors. When I remove them, it works! I also tried $wpdb->prepare() but no luck..

    EDIT:
    By the way, i received no error on the page, although i set WP_DEBUG to true..

    I really hope that someone can help me with this problem. Thank you very much.

    Best,
    Dono

    https://wordpress.org/plugins/theme-my-login/

  2. gdprabowo
    Member
    Posted 6 months ago #

    I have found the problem!

    Apparently my server won't allow direct access to an array like $wpdb->get_results('SELECT value FROM wp_syslookup WHERE code = "'.get_post_meta( $_POST['id'], 'main_addr_country_code', true).'"')[0]->value

    It needs proper handling. So, this works well:

    $query = 'SELECT value FROM wp_syslookup WHERE code = "'.get_post_meta( $_POST['id'], 'main_addr_country_code', true).'"';
    	$result = $wpdb->get_results( $query );
    	foreach($result as $r){
    		$org_country_str = $r->value;
    	}

    Anyways, again, just wanna say thank you to Jeff Farthing, for this awesome plugin. It made my life easier. God bless you man! :)

Reply

You must log in to post.

About this Plugin

About this Topic