WordPress.org

Ready to get started?Download WordPress

Forums

Pods - Custom Content Types and Fields
[resolved] Issue with displaying images/grabbing image url from pods and 'guid' (5 posts)

  1. Morklympious
    Member
    Posted 11 months ago #

    So, I've been running WordPress on a local test server, and I use it to make sure that plugin upgrades don't break my site, However, I'm having an issue with the newest version of pods.

    Basically my Author page uses $curauth to query the current author and display information accordingly, what worked with the last version of PODS however, isn't working with the most recent version, which is effectively preventing me from upgrading on the live site.

    So now whenever that code is called on the author page, I get this Warning:

    Illegal string offset 'guid'

    Since it's a warning, should it not be impeding the display of images? isn't guid used for displaying the url of an image?

    Here's the code snippet:

    http://pastebin.com/fyK8K3ZG

    I've tried looking up different (but probably deprecated) PODS calls like get_pods_image_url or whatnot.

    If there's anything else I should supply to help in troubleshooting, let me know.

    http://wordpress.org/extend/plugins/pods/

  2. Scott Kingsley Clark
    Member
    Plugin Author

    Posted 11 months ago #

    You may have already figured this out on our chat channel or our forums, but here's a few answers just in-case.

    If your field is a multiple select field, you will get an array of items back, If it's a single select field, you'll get a single item's array back.

    If you want to just get the guid out, you could try:

    $guid = get_user_meta( $userID, 'pretty_photo.guid', true );

    If you want to use Pods handy media functions, you could try this:

    $image = pods_image( get_user_meta( $userID, 'pretty_photo', true ), 'thumbnail' );
    $image_url = pods_image_url( get_user_meta( $userID, 'pretty_photo', true ), 'thumbnail' );
  3. Morklympious
    Member
    Posted 11 months ago #

    I appreciate the help. I did finally manage to get it figured out, though.

    Apparently <? $ph = get_user_meta( $curauth->ID, pretty_photo, 1 ); ?>

    Worked in displaying the image with a prior version of pods, but I felt like an idiot when I changed '1' to true, because that solved the problem when I was trying to fix the image display after pods updated.

    It's still curious behavior, though. I'm wondering why that WP function worked earlier, when it's actually specified that the parameter input is 'true'.

    Anyways, I do appreciate your help when I came onto IRC. You can flag this as resolved, because everything is DOIN' ALRIGHT!

  4. Scott Kingsley Clark
    Member
    Plugin Author

    Posted 11 months ago #

    I went ahead and fixed our handling of 1/0 to work like true/false, thanks for the heads up about that.

  5. Morklympious
    Member
    Posted 11 months ago #

    Much obliged!

Reply

You must log in to post.

About this Plugin

About this Topic