Add Gold Member block on the homepage - Dol.7.0.x

okweb posted 27th of August 2011 in Community Voice. 1 comment.

Add Gold Member block on the homepage - Dol.7.0.x

 

Gold members block:
- only single male/female
- only active members
- only members with picture uploaded
- random selected from DB

Will display nickname, age, country and country flag bellow user pic.
----
 

1) Admin/Builders/Pages Builder => Homepage, Add a new HTML page as bellow:

Caption Lang Key: _gold members
Visible for: Guest Member

SAVE

 

2) Open phpMyAdmin, click on table sys_page_compose and browse
look at row Caption and find _gold members (shall be the last insert id)
Edit ID where Caption = _gold members as bellow:

Page: index
Desc: List of GOLD members profile selected from database.
Func: Gold
Content:

SAVE

(Content shall be blank)

 

3) Admin/Settings/Languages Settings, add a new language string

New language key name: _gold members
Category: Page titles
String texts for available languages: Gold Members

SAVE

 

4) Open file templates/base/scripts/BxBaseIndexPageView.php

Find Featured members block and add this code above

 

/**
* GOLD members block
*/
 function getBlockCode_Gold() {
  global $site;
  global $aPreValues;
  global $getBlockCode_Gold_db_num;
  global $max_thumb_width;
  global $max_thumb_height;
  global $oTemplConfig;
 
  $gold_num = '8';

  if ( $gold_num )
  {
  $gold_res = db_res( "SELECT `ID`, `NickName`, `DateOfBirth`, `Country`
                       FROM `Profiles`
                       LEFT JOIN `sys_acl_levels_members` ON ( `sys_acl_levels_members`.`IDLevel` = '3' )
                       WHERE (
                       `sys_acl_levels_members`.`IDMember` = `Profiles`.`ID`
                       )
                       AND `Couple` = '0'
                       AND `Avatar` > '0'
                       AND `Status` = 'Active'
                       ORDER BY RAND()
                       LIMIT $gold_num" );

         $ret .= '<div class="clear_both"></div>';
 
   if( mysql_num_rows( $gold_res ) > 0 )
   {
    $j=1;
    while( $gold_arr = mysql_fetch_assoc( $gold_res ) )
    {

$gold_country = _t($aPreValues['Country'][$gold_arr['Country']] ['LKey']);
$gold_flag = '&nbsp;<img src="'. ($site['flags'].strtolower($gold_arr['Country'])) .'.gif" alt="flag" />';

     $ret .= '<div class="featured_block_1">';
     $ret .= get_member_thumbnail( $gold_arr['ID'], 'none' );
     $ret .= '<center>';
     $ret .= '<a href="' . getProfileLink( $gold_arr['ID'] ) . '">';
     $ret .= process_line_output( $gold_arr['NickName'] );
     $ret .= '</a>';
     $ret .= ", ";
     $ret .= age( $gold_arr['DateOfBirth'] );
     $ret .= '<br />';
     $ret .= $gold_country;
     $ret .= $gold_flag;
     $ret .= '</center>';

     $ret .= '<br />';
     $ret .= '</div>';
    
     $j++;
    }
   }
   else
   {
    $ret .= '<div class="no_result">';
     $ret .= '<div>';
      $ret .= _t("_No results found");
     $ret .= '</div>';
    $ret .= '</div>';
   }
   $ret .= '<div class="clear_both"></div>';
  }
 
  return $ret;
 }

 

SAVE FILE

 

5) Remember to edit IDLevel to a number that suit your membership level (`sys_acl_levels_members`.`IDLevel` = '4')
If you look at table `sys_acl_levels, you will find your ID number there.

 

Now you can take a look at your web page

 

 
Recommended by
 
 
Comments
·Oldest
·Top
Please login to post a comment.
iceboxrj
Does this work in the 7.0.9 homepage (index) ?
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.
PET:0.044080972671509