WordPress.org

Support

Support » Themes and Templates » [Theme: P2] Crash with only one user

[Theme: P2] Crash with only one user

  • alan.cleaver

    @alancleaver

    Getting:

    <b>Fatal error</b>: Cannot use object of type stdClass as array in <b>/usr/share/wordpress/wp-content/themes/p2/inc/mentions.php</b> on line <b>62</b>

    Line 60 in /inc/mentions.php

    foreach ( $wpdb->get_results( “SELECT ID, user_nicename from $wpdb->users WHERE ID IN($user_ids)” ) as $user ) {

    Doesn’t make sense when there’s only one user.

    Although this is a trivial issue to overcome when the cause is known, it’s also trivial to fix in the code. Being a Debian user (on slightly older WordPress version), on a clean install this nearly caused me to drop the use of this theme.

    http://wordpress.org/extend/themes/p2/

Viewing 9 replies - 1 through 9 (of 9 total)
  • Lance Willett

    @lancewillett

    Themer

    Thanks for the report, Alan. I wasn’t able to reproduce, though.

    Could you give us details on your WP version? And you said you only have one user, right ? ((I’m assuming it’s an admin user.)

    alan.cleaver

    @alancleaver

    I’m using 3.0.5

    It was just one admin user. The default theme was working fine, but when switching to p2, I just got a crash. I’m no expert, but I think the statement:

    $wpdb->get_results( "SELECT ID, user_nicename from $wpdb->users WHERE ID IN($user_ids)")

    returns a single object (not an array of objects) when there is only one hit record returned by the SQL statement. Hence the ‘foreach as’ construct won’t work.

    Let me know if you need more information, as at the moment, because I haven’t started using the blog for real, this issue is easy to replicate.

    Lance Willett

    @lancewillett

    Themer

    Alan,
    This is due to the old version of WP, not a code issue. Could you update to at least 3.1—3.2 would be better.

    alan.cleaver

    @alancleaver

    This is a code issue, as it’s crashing with a PHP error. A simple fix to the current version of the p2 theme would fix this and properly support older versions of WP.

    WordPress Version 3.0.5 is what you get on the latest Debian release (i.e. Squeeze). So upgrading is not an option for some of us, who want to stay with the Debian update process.

    It’s a shame because if you using this WP version, are doing a fresh install of a site and use this theme straight away the site is unusable. Many people may just go on and use a different blogging software and/or theme. This is a shame as the p2 theme seems actually very good and would do a great job in many organisations and groups.

    Lance Willett

    @lancewillett

    Themer

    Could you post the contact info for Debian Squeeze devs? I’ll be happy to contact them ASAP. We should ask them nicely to use the latest, stable version of WP. It’s been a long time since 3.0.5 and there are many, many fixes and security updates.

    Lance Willett

    @lancewillett

    Themer

    Also note that testing with WP version 3.1 and 3.2 with one user did not produce the reported issue.

    We’ll take a look at fixing it for older versions, also.

    Lance Willett

    @lancewillett

    Themer

    Found it: http://packages.qa.debian.org/w/wordpress.html

    Looks like 3.2.1 is in the testing stages.

    alan.cleaver

    @alancleaver

    Lance Willett

    @lancewillett

    Themer

    Hi Alan,
    Could you try again with your WP install and the latest P2 version? 1.3.3 is ready, and should fix the PHP errors.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘[Theme: P2] Crash with only one user’ is closed to new replies.