Gossamer Forum
Quote Reply
Random as default value
I have Links.sort and want to set a random value in it.
How i can do that, please?
Quote Reply
Re: [Robert] Random as default value In reply to

So when you add a new link? It would be best done as a plugin, hooking into the add_link user_add_link hooks. If you don't need it to happen immediately, then you could just do a very simple script on a 5-minute cron:


use strict;
use lib '/home/path/to/admin';
use Links qw/$IN $DB $CFG/;


$DB->table("Links")->do_query(qq|UPDATE glinks_Links SET RandSort = FLOOR(RAND()*(25-10+1))+10 WHERE RandSort IS NULL|);

Just set that on a 5 minute cron (or however often you want). This will then update links where there is no value set already.


Andy (mod)
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Random as default value In reply to
Yes, thank you. I made it with a php and
change all Links from time to time.