• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Fixed Random Media Block only appears.. randomly?

#1
I don't consistently see the random media block. I'm on XFMG 1.04, but also had the same problem on 1.02 prior to upgrading. The block is set to pull from a pair of categories, both of which have a decent number of images in them. I know that before moving to 1.02 I did consistently see the block, but I don't know if I stopped seeing it at the time of the upgrade to 1.02 or not, as I only noticed this past week that I wasn't seeing it (I don't generally actually look at my forum list apparently).

Is this something I've misconfigured somehow?
 

Martok

Well-known member
#2
Is it the website linked in your profile? If so, I can't see a media block at all, though I can see the Media tab and some albums and category images.

It might be useful for you to post the site URL here and details of the media block settings in the ACP.
 

Martok

Well-known member
#4
Interesting, I've just got the media block above the forums to appear.

Are their any errors showing in the browser console (I'm on a tablet at the moment so can't check?

Try disabling all add-ons to see if that solves the issue. If so, re-enable them one-by-one until you find the add-on that's causing the issue.
 
#5
Are their any errors showing in the browser console
None that I've seen. Also not seeing anything in the server error logs.

I don't have all that many add-ons, disabled everything except XFMG and still have the randomly appearing random media block.
 

Martok

Well-known member
#6
Odd. I've tried it on my desktop and there's no errors showing. Most of the time the media block doesn't show at all and when inspecting the page the code is missing.

Do you have any outdated templates? Are you using some sort of caching on your site that could be affecting this?
 

Chris D

XenForo developer
Staff member
#7
Can't say I've seen this before, either.

Does the issue go away if you select "New Media" instead of "Random Media"?
 

Chris D

XenForo developer
Staff member
#9
After looking at this in more detail, this is probably worth treating as a bug.

The best solution for now, will be to change to "New Media" and then switch back to "Random Media" after the next update which will change the behaviour of this.

It's potentially a rare thing to come up, but we have a solution in mind that should solve this particular issue and actually improve the "randomness" of the Random Media.
 
#10
Ah, I see the problem looking at how the media is picked. Since my users have been piling stuff into personal albums and not the categories as of late, it is increasingly likely as time passes that the selection query will find nothing and thus display no block.
 
#15
You can workaround it now by adding albums to the selection "pot" for it.
I could... if I wanted to display some of the random things my users have uploaded to their albums, which I don't.

we have a solution in mind that should solve this particular issue and actually improve the "randomness" of the Random Media.
We've implemented some changes for this in XFMG 1.0.5 that will solve this particular problem.
Thanks, Looking forward to it :)
 
#16
Until the official solution is released I have simply modified getMediaForBlock to set the fetchOption for order to rand and removed the condition for the media_id to be greater than some random #.

Works well :)
 

Chris D

XenForo developer
Staff member
#17
Bear in mind performance for RAND() in MySQL is incredibly poor; hopefully with it being restricted to just a few categories with a small number of images you'll be fine; but do keep an eye on performance just in case it begins to suffer. It's definitely not the solution we have implemented for those reasons, but I would expect in the short term it would be fine.
 
#18
Yup. I could do better than rand() but i have a small enough set that i'm fairly certain i can accept the performance hit until the official fix is released and it was the quickest way for an acceptable bandaid. Hope the wait for 1.05 is short :)