I keep receiving a "No photo chosen" message on my random block. I've tried deleting the block-random.dat and it hasn't helped. Nothing has changed and the random block has worked fine for a number of weeks, aside from a few other "No photo chosen" instances which were fixed by deleting the block-random.dat file. Thoughts?
Posts: 2322
Here's something you could try:
Locate
And immediately after it, add
right before the section that prints the output.
This could have a slight performance impact, since you're effectively running the block twice.
Posts: 4
On occasion I have had ablums selected that could not return a photo, with the code provided above. So I followed a slightly different approach to solve the problem.
Remove the previous change before applying this patch.
Find the code:
and change it to:
The $max_iterations counter ensures we never end up in an endless loop. We shoudn't see the 'No photo chosen' message unless 5 albums were chosen that could not display a photo. In testing I have found that the $max_iterations is normally 4, and sometimes hits 3. This means that on occasion one hidden album is selected and even less frequently two hidden albums are selected in a row. My testing has never hit 3 in a row...