Only show for premium

armaclans

Member
Is there a way to show certain things on the details page if the member is premium.


So for example:
for Premium members the "stats" table will show up, but for non premium members the "stats" table is hidden
 

Basti

Administrator
Staff member
In reference to this http://visiolist.com/community/threads/category-assignment.1540/
But its mostly in german, so here again in english

You need a simple plugin to hide the stats, or a slightly more advanced to switch out html based on member type, i prefer the 2nd but will list both

1) PluginName
2) PluginName/languages/english.php ( can be empty )
3) PluginName/languages/index.htm ( empty )
4) PluginName/index.htm ( empty )
5) PluginName/info.php ( Look at a different plugin to see the contents, mostly plugin name, version and such )
6) PluginName/details_build_page.php

6.1) Now a simple hide if the member is not premium
Code:
if($TMPL['premium_flag'] == 0) {
    $TMPL['p_hide_stats'] = ' style="display: none;"';
}
Then you would look this up in stats.html
Code:
<div id="stats-tabs2">
Note: this is html from parabola, you stats container might look different, i dont know.

And you add the new template tag we created above so non premium gets a display none css style
Code:
<div id="stats-tabs2" {$p_hide_stats}>
6.2) This method is slightly different. ( we are still in the file of #6 )
Code:
if($TMPL['premium_flag'] == 1) {
    $TMPL['p_show_stats'] = $this->do_plugin_skin('./plugins/PluginName','stats.html');
}
Now you would create a new html file in the plugin, PluginName/stats.html
In this file you would paste the block of html from the skin stats.html
So you skin now misses the stats. Now just place the following instead
Code:
{$p_show_stats}

Final Note:
Dont forget to rename all instances of "PluginName" by you actual desired plugin name
 

armaclans

Member
So I have tried this..

I created the following files

languages/english.php ( empty )
languages/index.htm ( empty )
/index.htm ( empty )

/info.php
PHP:
<?php
//===========================================================================\\
// VISIOLIST is a proud derivative work of Aardvark Topsites                \\
// Copyright (c) 2000-2009 Jeremy Scheff.  All rights reserved.              \\
//---------------------------------------------------------------------------\\
// http://www.aardvarktopsitesphp.com/                http://www.avatic.com/ \\
//---------------------------------------------------------------------------\\
// This program is free software; you can redistribute it and/or modify it  \\
// under the terms of the GNU General Public License as published by the    \\
// Free Software Foundation; either version 2 of the License, or (at your    \\
// option) any later version.                                                \\
//                                                                          \\
// This program is distributed in the hope that it will be useful, but      \\
// WITHOUT ANY WARRANTY; without even the implied warranty of                \\
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General \\
// Public License for more details.                                          \\
//===========================================================================\\

// You must give a name for your Plugin.  The other fields are optional.
$pluginname = "Premium";
$author = 'ArmaClans';
$email = 'armaclans@gmail.com';
$url = '#';
$install = 1;
$depend = 'Apache mod_rewrite';

$version = '1.0';

?>

/details_build_page.php

PHP:
<?php

if($TMPL['premium_flag'] == 1) {
    $TMPL['p_show_stats'] = $this->do_plugin_skin('./plugins/Premium','stats.html');
}

?>

stats.html
Code:
<h1>Test</h1>
Then I placed {$p_show_stats} inside the stats of the admin panel


I get nothing.
 

Mark

Administrator
Staff member
perfect thanks, i got it working:

{$p_show_stats} - make sure you are adding this to skins/yourskin/child/stats.hml

your plugin had a small mistake, you dont need .html on the template name

corrected code:
Code:
if($TMPL['premium_flag'] == 1) {
  $TMPL['p_show_stats'] = $this->do_plugin_skin('./plugins/OnlyPremium','stats');
}
that should get you goin :)
 
Top