User Tools

Site Tools


rand_items_widget

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
rand_items_widget [2017/01/14 16:41]
admin [Random Members]
rand_items_widget [2018/06/13 17:52] (current)
admin [Random Members]
Line 22: Line 22:
 <​code><​!--widget="​members(array('​mode'​=>'​rand','​area'​=>'​front','​total'​=>​5))"​--></​code>​ <​code><​!--widget="​members(array('​mode'​=>'​rand','​area'​=>'​front','​total'​=>​5))"​--></​code>​
  
-**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. ​+**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. ​
  
 <​code>​$query.="​ LIMIT 15"; if (!($res=@mysql_query($query))) {trigger_error(mysql_error(),​E_USER_ERROR);​} $user_ids=array();</​code>​ <​code>​$query.="​ LIMIT 15"; if (!($res=@mysql_query($query))) {trigger_error(mysql_error(),​E_USER_ERROR);​} $user_ids=array();</​code>​
  
-To make the widget display random members on other pages use this code inside ​any html file from the skins_site/​def/​ folder:+**TIP** - be careful how many items you display on your page, having too many can cause slower page performance. Your index page is the main page that Google lists and ranks in their search engine and Google typically ​ prefers pages that aren't slow loading or too bloated. It's best to try and keep your index page focused and to the point making sure visitors can quickly grasp what your site is about and what it has to offer. Widgets should be considered teasers and provide just enough to make visitors want to explore further and ultimately signup to see more. 
 + 
 +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'​))"​-->​   <​!--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 but also random members with red hair or random members seeking ​men. +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.
-The usage in this case is like this: +
-  <​!--widget="​members(array('​mode'​=>'​rand','​cmp_field'​=>'<​some_dbfield>','​cmp_to'​=>'<​some_value>'​))"​-->​ +
-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 
- 
-Some examples for the default Etano package: 
   * Random male members:   * Random male members:
 <​code><​!--widget="​members(array('​mode'​=>'​rand','​cmp_field'​=>'​f1','​cmp_to'​=>'​1'​))"​--></​code>​ <​code><​!--widget="​members(array('​mode'​=>'​rand','​cmp_field'​=>'​f1','​cmp_to'​=>'​1'​))"​--></​code>​
   * Random female members:   * Random female members:
 <​code><​!--widget="​members(array('​mode'​=>'​rand','​cmp_field'​=>'​f1','​cmp_to'​=>'​2'​))"​--></​code>​ <​code><​!--widget="​members(array('​mode'​=>'​rand','​cmp_field'​=>'​f1','​cmp_to'​=>'​2'​))"​--></​code>​
-  ​Random ​members from US:+ 
 +  ​**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: 
 <​code><​!--widget="​members(array('​mode'​=>'​rand','​cmp_field'​=>'​f4_country','​cmp_to'​=>'​218'​))"​--></​code>​ <​code><​!--widget="​members(array('​mode'​=>'​rand','​cmp_field'​=>'​f4_country','​cmp_to'​=>'​218'​))"​--></​code>​
  
Line 60: Line 51:
 ==== Random Photos ==== ==== Random Photos ====
  
-To make the widget display random photos add this code inside ​any html file from the skins_site/<some skin>/ folder:+To make widget display random photos add this code inside ​the index.html file: 
 + 
 +<​code><​!--widget="​photos(array('​mode'​=>'​new','​area'​=>'​front','​total'​=>​6))"​--></​code>​ 
 + 
 + 
 +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: 
 + 
 +<​code><​!--widget="​photos(array('​mode'​=>'​rand'​))"​--></​code>​ 
 + 
 + 
 + 
 +==== Important Info Regarding Adding The Random Widget ==== 
 + 
 +Refer to your **skins_site/​def/​index.html** file, you'll see sections like the following ... 
 +<​code><​!-- Newest Members widget -->  
 +<div class="​front-widget">​  
 +<​h3>​Newest Members</​h3>​ 
 +<​!--widget="​members(array('​mode'​=>'​new','​area'​=>'​front','​total'​=>​12))"​-->​  
 +</​div><​!-- End Newest Members widget --></​code>​ 
 + 
 +Add your random items widget as follows ... 
 +<​code><​!-- Random widget --> 
 +<div class="​front-widget">​ 
 +<​h3>​Featured Members</​h3>​ 
 +<​!--widget="​members(array('​mode'​=>'​rand','​area'​=>'​front','​total'​=>​12))"​-->​ 
 +</​div><​!-- End Random widget --></​code>​
  
-  <!--widget="photos(array('​mode'​=>'​rand'​))"-->+If you want you can you can replace the "​Newest Members ​widget" ​with a "Random widget"​. You can also add widget codes in any order you want. The order you add them in the file is the order in which they will be displayed on the page.
  
rand_items_widget.1484412082.txt.gz · Last modified: 2017/01/14 16:41 by admin