By Leo Nobles III on Friday, 23 February 2018
Posted in General
Replies 3
Likes 0
Views 235
Votes 0
Hello

Would I be able to apply a code to make Albums Page & Recent Albums module display set to random?
HI there,

Currently we do not sort the album by randomness. However, for some reason if you really need to sort by random, you can edit the file at 'JOOMLA/administrator/components/com_easysocial/models/albums.php' and edit below code at line 366:


$orderby .= ' order by ' . $ordering . ' ' . $direction;


and replace the above with:


$orderby .= ' order by rand()';


The 'rand()' is a special function in MySQL to randomly return your database records. However, please take note this rand() is extremely heavy on the performance impact if your site has alot of albums records or the query is very complicated.

It's your call to use this rand() or not

Hope this help and have a nice day.
Sam
·
Friday, 23 February 2018 15:59
·
0 Likes
·
0 Votes
·
0 Comments
·
Website has almost 4000 albums, I average 50 to 100 new albums per month.

Could I apply a setup which would give extra performance power for the impact?

Also with the rate of how many albums are being created would moving forward be a bad idea?
·
Friday, 23 February 2018 17:37
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi there,

Based on my experience, any table that has more than a thousand records will have big impact when you order by RAND(). As for technical setup to boost to server performance, this is the area I am not familiar with. You might want to consult with the server administration expertise who know better server tuning than me.

Alternatively to rand(), you will have to rewrite the query so that you can implement your own random algorithm.

Hope this help and have a nice day
Sam
·
Friday, 23 February 2018 18:40
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post