Jump to content

$image->description returns an empty string for guest users


hettiger
 Share

Recommended Posts

Hello there.

Since this is my first post in these forums: Thank you Ryan for ProcessWire and thanks to everyone that is supporting him or other users.

I'm having a strange problem using $image->description. When I'm logged in as the default user I registered during install everything's working as expected. $image->description returns the string provided in the backend. Anyways if not logged in, an empty string will be returned resulting in <img src="url-is-still-working" alt="">.

I don't really know whats going on. Might be a bug? Here's some code:

$slides = '';

foreach ( $page->slideshow_images as $image )
{
    $slides .= '<li><img src="' . $image->url . '" alt="' . $image->description . '"></li>';
}

I'm running ProcessWire 2.5.3.

Link to comment
Share on other sites

Hi hettiger,

Welcome to ProcessWire! :)

Do you have template cache enabled or using MarkupCache by any chance?

If it's a multilang site: Does the guest user maybe have a language where the image description isn't filled/translated?

Cheers

  • Like 2
Link to comment
Share on other sites

Hi hettiger,

Welcome to ProcessWire! :)

Do you have template cache enabled or using MarkupCache by any chance?

If it's a multilang site: Does the guest user maybe have a language where the image description isn't filled/translated?

Cheers

Thank you Wanze,

with your help I was able to fix this issue.

I disabled multilingual descriptions on this image field. (The site itself is not multilingual, but the backend is)

Link to comment
Share on other sites

  • 5 months later...

Hi,

I have a similar problem: I upgraded a website to the latest PW version (currently 2.5.3) and the image description stopped working all of a sudden. It's also a multi-language site, and same as above, only for the backend: the front-end is in german. I checked the database and noticed that the old descriptions are strings, and the new ones arrays. 

Is there a way to have them be strings again? The "Disable multi-language descriptions" function didn't quite do the trick so far, except that it hid the multi-language field in the backend, which is in my case an improvement already.

Any suggestions?

Thanks!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...