Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Working on real estate project.Here i am facing a problem with new email registration when user register with site admin getting some fields blank.i am using Group but plugin and also in back end under Group Buying Plugin > Account tab getting warning to city ,state colum like:

Warning: Illegal string offset 'city' in /home/reddvise/public_html/app/wp-content/plugins/group-buying/controllers/groupBuyingAccounts.class.php on line 299. 

I am using word press version 3.4.1 with Group buying plugin Version 3.5.1

Getting Email like below example:- New user registration on your site Reddvise Real Estate:

User Id: 243 Username: sanjay

E-mail: sanjaynakate@gmail.com

Mobile No. :

Address :

City :

State :

Pin Code :

Country :

public static function column_display( $column_name, $id ) {
        global $post;
        $account = Group_Buying_Account::get_instance_by_id($id);

        if ( !$account ) 
            return; // return for that temp post

        $user = Group_Buying_Account::get_user_id_for_account($account->get_ID());
        $user_data = get_userdata($user);
        $address = $account->get_address();
        switch ( $column_name ) {
            case 'id':
                echo $id;
                break;

            case 'username':
                echo get_avatar( $user_data->user_email, '35' );
                $get_name = $account->get_name();
                $name = ( strlen($get_name) <= 1  ) ? $post->post_title : $get_name;
                echo '<strong><a href="'.get_edit_post_link().'">'.$name.'</a></strong><br/>';
                break;

            case 'user':
                echo '<a href="'.admin_url("user-edit.php?user_id=".$user).'">'.$user_data->user_login.'</a>';
                break;

            case 'state':
                echo $address['zone'];

                break;

            case 'city': //on this line getting a warning 
                echo $address['city'];
                break;

            default:
                # code...
                break;
        }
    }
share|improve this question
    
Also, try escaping the brackets. stackoverflow.com/questions/12559121/… –  Mike_Piercy Jun 21 at 9:55
2  
I would STRONGLY advise you upgrade from v3.4.1, that version is years out of date and any answer your get will be assuming the current latest version ( v3.9.1 ). You're also missing a lot of information, such as what these plugins are, and the rest of your code –  Tom J Nowell Jun 23 at 10:20
    
but the plugin is not showing any update –  Sanjay Nakate Jun 23 at 10:30
1  
@TomJNowell you are right i have updated wp with latet version every thing working fine . –  Sanjay Nakate Jul 6 at 13:59

3 Answers 3

up vote 1 down vote accepted

I have updated wordpress 3.4.1 to wordpress 3.9.1 also i have updated all plugin version now code is working without any warning and error.

share|improve this answer

Try creating a variable for the parameter

user-edit.php?user_id=".$user

And pass that through admin_url function.

share|improve this answer
3  
can you elaborate it –  Sanjay Nakate Jun 21 at 9:42
    
I've had trouble before when mixing double quotes inside a parameter especially when using single quotes else where. –  Mike_Piercy Jun 21 at 9:54

Well, you're getting that warning because $address['city'] is obviously not set. In that case, PHP does not produce an error, instead it lets you get away with it with a null value and a warning.

If you just want to get rid of the warning, do something like:

        case 'city': //on this line getting a warning 
            echo isset($address['city'])?$address['city']:"(unknown)";
            break;

But if you want to further investigate things, do a var_dump after $address is given value:

    $address = $account->get_address();
    var_dump($address);

This way, you'll get a hint as to why $account->get_address() fails to deliver whatever it is you are expecting.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.