Adding page viewable for upgraded members

If I want to add a page that can only be viewed by members who have upgraded to a different membership level, what code do I need to add to this page (and where) to ensure that a message would show giving them this information.

Thanks again for the help

Quote · 26 Oct 2008

You can do it like this,

 

Admin/Builders/Navigation Menu Builder

 

Add a NEW_ITEM and drop it bellow My Account and write as bellow

 

System Name: Gold Member
Language Key: _Gold Member
Default Name: Gold Member
URL: goldmember.php
Target Window: Same
Visible for: Member

 

Save Changes
-----------------


Add new languages Key,
_Gold_Member_H = Gold Member
_Gold_Member_H1 = Gold Member
-----------------

 

Made a new file and name it goldmember.php copy code bellow, and past it to goldmember,php and then save file.

 

<?

require_once( 'inc/header.inc.php' );
require_once( BX_DIRECTORY_PATH_INC . 'design.inc.php' );
require_once( BX_DIRECTORY_PATH_INC . 'profiles.inc.php' );
require_once( BX_DIRECTORY_PATH_INC . 'utils.inc.php' );

// --------------- page variables and login

$_page['name_index'] = 85;
$_page['css_name'] = 'profiles.css';

$logged['member'] = member_auth(0);

$_page['header'] = _t( "_Gold_Member_H" );
$_page['header_text'] = _t( "_Gold_Member_H1" );


// --------------- page components

$_ni = $_page['name_index'];
$_page_cont[$_ni]['page_main_code'] = PageCompPageMainCode();

// --------------- [END] page components

PageCode();

// --------------- page components functions

/**
 * page code function
 */
function PageCompPageMainCode()
{
 global $site;

        $memberID = (int)$_COOKIE['memberID'];
        $memship_sql = "SELECT `IDLevel` FROM `ProfileMemLevels` WHERE `IDMember` = '$memberID'";
 $memship_arr = db_arr( $memship_sql );


        // Gold member
        if( $memship_arr['IDLevel'] == '4' )
 {
  $ret .= '<div class="profile_ditails_block">';
  $ret .= '<table width="100%" cellpadding=1 cellspacing=1 border=0>';
                $ret .= '<tr><td>';
                $ret .= '<b>GOLD MEMBER INFO/CODE HERE!!!</b>';
                $ret .= '</td></tr>';
                $ret .= '</table>';
  $ret .= '</div>';
  $ret .= '<div class="clear_both"></div>';
 }
        else
 {
                // Standard and Promotion-member - Non-member have no access to this url

                 $ret .= '<div class="profile_ditails_block"></div>';
                 $ret .= '<center><b><a href="membership.php">Click here</a> to upgrade and be a Gold Member now.</b></center><br />';
                 $ret .= '<div class="clear_both"></div>';
 }


 return $ret;
}
?>
==================
DONE!

 


check also inside table MemLevels wich ID your membership Name have,
edit number 4 in code bellow if you have another number on your membership.
if( $memship_arr['IDLevel'] == '4' )
----------

 

Add your own goldmember.css file, I have used profiles.css here now.
----------

 

If a member click on the link on account page
Gold Member will see your content, everyone else wil have a page with a upgrade link.

 

Cheers

Quote · 26 Oct 2008

Thanks Okweb - I will work on this tomorrow

Quote · 27 Oct 2008

Ottar, another great innovation.  Unfortunately, I must be doing something wrong.  I have named mine "business account" and checked the membership number for this - in my case "5" - and changed that as instructed.  Still, when I clicked the link, I got the "upgrade to business account" message, even though I tested it with a business account.   I'll take another look in the morning, but have pasted the code below in case you see anything obvious.

-

Also, would there be any way for there to be an RSS feed in this page?  Could this same approach be done in a block?  Just thinking out loud.  Keep up the good work.

-

Rob

-

<?

require_once( 'inc/header.inc.php' );
require_once( BX_DIRECTORY_PATH_INC . 'design.inc.php' );
require_once( BX_DIRECTORY_PATH_INC . 'profiles.inc.php' );
require_once( BX_DIRECTORY_PATH_INC . 'utils.inc.php' );

// --------------- page variables and login

$_page['name_index'] = 85;
$_page['css_name'] = 'profiles.css';

$logged['member'] = member_auth(0);

$_page['header'] = _t( "_Business_Account_H" );
$_page['header_text'] = _t( "_Busienss_Account_H1" );


// --------------- page components

$_ni = $_page['name_index'];
$_page_cont[$_ni]['page_main_code'] = PageCompPageMainCode();

// --------------- [END] page components

PageCode();

// --------------- page components functions

/**
* page code function
*/
function PageCompPageMainCode()
{
global $site;

$memberID = (int)$_COOKIE['memberID'];
$memship_sql = "SELECT `IDLevel` FROM `ProfileMemLevels` WHERE `IDMember` = '$memberID'";
$memship_arr = db_arr( $memship_sql );


// Gold member
if( $memship_arr['IDLevel'] == '5' )
{
$ret .= '<div class="profile_ditails_block">';
$ret .= '<table width="100%" cellpadding=1 cellspacing=1 border=0>';
$ret .= '<tr><td>';
$ret .= '<b>GOLD MEMBER INFO/CODE HERE!!!</b>';
$ret .= '</td></tr>';
$ret .= '</table>';
$ret .= '</div>';
$ret .= '<div class="clear_both"></div>';
}
else
{
// Standard and Promotion-member - Non-member have no access to this url

$ret .= '<div class="profile_ditails_block"></div>';
$ret .= '<center><b><a href="membership.php">Click here</a> to upgrade to a Business Account.</b></center><br />';
$ret .= '<div class="clear_both"></div>';
}


return $ret;
}
?>

Quote · 10 Nov 2008

Hi Rob

have member upgraded to another membership?

if he had you will se his membership in table ProfileMemLevels

If you do it from admin, I'm not sure about it update ProfileMemLevels table!!

Ottar.

Quote · 10 Nov 2008
 
 
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.