User Tools

Site Tools


rand_items_widget

Random Items Widget Mod

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

Installation

Installation is pretty straight-forward:

  1. Download the rand_items_widget-1.04.zip 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

Usage

Random Members

To a make widget display random members on the main index page, use this code inside skins_site/def/index.html file:

<!--widget="members(array('mode'=>'rand','area'=>'front'))"-->

You can also set the number of items to display buy including the 'total' code at the end like this:

<!--widget="members(array('mode'=>'rand','area'=>'front','total'=>5))"-->

Note - the default maximum number of items allowed is 15. If you want to display more than 15 you will need to open the plugins/widget/members/members.class.php file and locate the following code and change the LIMIT number.

$query.=" LIMIT 15"; if (!($res=@mysql_query($query))) {trigger_error(mysql_error(),E_USER_ERROR);} $user_ids=array();

To make the widget display random members on the member's home page or other pages use this code inside the appropriate html file from the skins_site/def/ folder:

<!--widget="members(array('mode'=>'rand'))"-->

This mod 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.

  • Random male members:
<!--widget="members(array('mode'=>'rand','cmp_field'=>'f1','cmp_to'=>'1'))"-->
  • Random female members:
<!--widget="members(array('mode'=>'rand','cmp_field'=>'f1','cmp_to'=>'2'))"-->
  • 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', and to show female members your cmp_to value must be '2'. If you've added more (f1) values such as "Couples" or "Transgenders", their cmp_to value numbers will be in the order you have them listed in the admin (f1) profile fields.

You could also display random members from a certain country like this:

<!--widget="members(array('mode'=>'rand','cmp_field'=>'f4_country','cmp_to'=>'218'))"-->

218 in the above example 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, then 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 a widget display random photos add this code inside the index.html file:

<!--widget="photos(array('mode'=>'new','area'=>'front','total'=>6))"-->

To make a widget display random photos on the member's home page or other pages use this code inside the appropriate html file from the skins_site/def/ folder:

<!--widget="photos(array('mode'=>'rand'))"-->
rand_items_widget.txt · Last modified: 2017/01/14 17:24 by admin