0

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: [email protected]

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

3 Answers 3

1

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.

0

Try creating a variable for the parameter

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

And pass that through admin_url function.

2
  • 3
    can you elaborate it Commented Jun 21, 2014 at 9:42
  • I've had trouble before when mixing double quotes inside a parameter especially when using single quotes else where. Commented Jun 21, 2014 at 9:54
0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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