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;

            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/>';

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

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


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

                # code...
  • Also, try escaping the brackets. stackoverflow.com/questions/12559121/… – Mike_Piercy Jun 21 '14 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 '14 at 10:20
  • but the plugin is not showing any update – Sanjay Nakate Jun 23 '14 at 10:30
  • 1
    @TomJNowell you are right i have updated wp with latet version every thing working fine . – Sanjay Nakate Jul 6 '14 at 13:59

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.

| improve this answer | |

Try creating a variable for the parameter


And pass that through admin_url function.

| improve this answer | |
  • 3
    can you elaborate it – Sanjay Nakate Jun 21 '14 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 '14 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)";

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

    $address = $account->get_address();

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

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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