User Tools

Site Tools


This is an old revision of the document!

Random Items Widget Update

This update allows the member and photo widgets to display random items (members/photos). If you think that the Latest Members widget is too static for your site, you can use this update to make your site appear more dynamic.


Installation is pretty straight-forward:

  1. Download the file and upload it to tmp/packages on your server, DO NOT UNZIP, the Package Manager will handle this
  2. Go to your admin panel and select the Package Manager from the menu and click on the install link


Random Members

To make the widget display random members add this code inside any html file from the skins_site/def/ folder:


This update can also display random members with a certain profile property, which is a very powerful feature. For example you can display random women or random men but also random members with red hair or random members seeking men. The usage in this case is like this:


or, the most complex:

<!--widget="members(array('mode'=>'rand','cmp_field'=>'<some_dbfield>','cmp_to'=>'<some_value>','cmp'=>'<sql comparison operator>'))"-->

The meanings of the 3 new fields are:

  • cmp_field: the field from the user_profiles database table to use for comparison. You can find the name of the fields either by directly looking at the table in the database with a db management tool like phpmyadmin or in your admin panel - Profile Fields - the code in paranthesis (e.g (f1) I am a - in this case the field name is f1).
  • cmp_to: the value to compare cmp_field with. In case cmp_field is a select box (combo box) the value you want to compare to is a number. All values a field can take are stored as numbers. For example, if the field "(f1) I am a" has the values "Male" and "Female" in this order, then "Male" is stored as '1' in the database and "Female" as '2'. So if you want to show random male members your cmp_to value must be '1'.

The same applies to multiple checkboxes fields but instead of comparing to '1', you need to compare to '|1|'. Same for females: your cmp_to field must be '|2|'.

  • cmp: this field specifies the actual comparison to be performed. Default is '=' meaning that it will show only members whose cmp_field is equal to cmp_to value. You can use any of the following comparison operators:
    • '=' - equals
    • '>' - greater than
    • '>=' - greater or equal than
    • '<' - smaller than
    • '⇐' - smaller or equal than
    • 'like' - the LIKE operator from SQL syntax. In this case you can use SQL wildcards in the cmp_to value. Note: the use of the 'like' operator is not recommended because it could slow down your site.

Some examples for the default Etano package:

  • Random male members:
  • Random female members:
  • Random members from US:

218 is the ID number for the country, which in this case is for the US.


If you want the ID for a different country you will need to look in the database. Click the dsb_loc_countries table, the from the country the list find the country you want and make note of the number next to it under the country_id column.

Random Photos

To make the widget display random photos add this code inside any html file from the skins_site/<some skin>/ folder:

rand_items_widget.1399745633.txt.gz · Last modified: 2014/05/10 18:13 by admin