1. 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?

Discussion in 'Media Gallery Resolved Bugs' started by Xanin, Apr 22, 2015.

  1. Xanin

    Xanin Member

    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?
     
  2. Martok

    Martok Well-Known Member

    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.
     
  3. Xanin

    Xanin Member

  4. Martok

    Martok Well-Known Member

    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. Xanin

    Xanin Member

    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.
     
  6. Martok

    Martok Well-Known Member

    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?
     
  7. Chris D

    Chris D XenForo Developer Staff Member

    Can't say I've seen this before, either.

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

    Mike XenForo Developer Staff Member

    Do you have limits on what the block can contain? Notably, not including albums?
     
  9. Chris D

    Chris D XenForo Developer Staff Member

    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. Xanin

    Xanin Member

    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.
     
  11. Chris D

    Chris D XenForo Developer Staff Member

    That's correct.

    We are working on a completely different approach to solve this.
     
  12. Mike

    Mike XenForo Developer Staff Member

    You can workaround it now by adding albums to the selection "pot" for it.
     
  13. DaveM

    DaveM Well-Known Member

    I am also having this issue on mycatchat.com
     
  14. Chris D

    Chris D XenForo Developer Staff Member

    We've implemented some changes for this in XFMG 1.0.5 that will solve this particular problem.
     
    Xanin likes this.
  15. Xanin

    Xanin Member

    I could... if I wanted to display some of the random things my users have uploaded to their albums, which I don't.

    Thanks, Looking forward to it :)
     
  16. Xanin

    Xanin Member

    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 likes this.
  17. Chris D

    Chris D XenForo Developer Staff Member

    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.
     
    Xanin likes this.
  18. Xanin

    Xanin Member

    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 :)
     

Share This Page