MyBB Community Forums

Full Version: Make invisible for guests
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

I have installed the mod "registrated today" and now I want to fix something.

Now the mod is visible for everyone, but I want to make the mod visible when you are login.

So if someone not is login the mod is not available.

This is the code from the mod:

<?php
/**
* Author: DragonFever
* Copyright: © 2008 DragonFever
* Website:  http://www.dragonfever.info
**/

// Disallow direct access to this file for security reasons
if(!defined("IN_MYBB")) 
{
    die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}

$plugins->add_hook("index_start", "reggedtoday_run', 1000000);

function reggedtoday_info()
{
    return array(
        "name"            => "Show Users Who Have Been Registered Today",
        "description"    => "Allows you to show the users who have been registered your forum within past 24 hours on forum index.",
        "website"        => "http://www.dragonfever.info",
        "author"        => "DragonFever",
        "authorsite"    => "http://www.dragonfever.info",
        "version"        => "1.0",
        "guid"            => "6cf34b98912ceb938211f8873f83cef1",
        "compatibility" => "16*",
    );
}

function reggedtoday_activate()
{
    global $db
    
    $query = $db->simple_select("settinggroups", "COUNT(*) as rows");
    $rows = $db->fetch_field($query, "rows");
    
    $insertarray = array(
        'name' => 'reggedtoday', 
        'title' => 'Show Users Who Have Been Registered Today', 
        'description' => 'Options on how to configure and personalize Show Users Who Have Been Registered Today plugin', 
        'disporder' => $rows+1, 
        'isdefault' => 0
    );
    $db->insert_query("settinggroups", $insertarray);
    $group['gid'] = $db->insert_id();
    
    $insertarray = array(
        'name' => 'reggedtoday_active',
        'title' => 'Enable Show Users Who Have Been Registered Today Plugin?',
        'description' => 'Enable Show Users Who Have Been Registered Today Plugin?',
        'optionscode' => 'onoff',
        'value' => 1,
        'disporder' => 0,
        'gid' => $group['gid']
    );
    $db->insert_query("settings", $insertarray);
    
    rebuild_settings();
    
    include MYBB_ROOT."/inc/adminfunctions_templates.php";
    
    find_replace_templatesets("index_boardstats", '#{\$whosonline}(\r?)\n#', "{\$whosonline}\n{\$regged_today}\n");
    
    $insert_array = array(
        'title' => "regged_today_index",
        'template' => "<tr>
    <td class=\"tcat\"><strong>{\$lang->whos_regged_today}</strong></td>
</tr>
<tr>
    <td class=\"trow1\"><span class=\"smalltext\">{\$lang->regged_note_today}<br />{\$reggedmembers}</span></td>
</tr>",
        'sid' => "-1",
        'version' => "",
        'dateline' => TIME_NOW
    );
    
    $db->insert_query("templates", $insert_array);
    
}

function reggedtoday_deactivate()
{
    global $db, $mybb;
    
    include MYBB_ROOT."/inc/adminfunctions_templates.php";
    
    find_replace_templatesets("index_boardstats", '#{\$regged_today}(\r?)\n#', "", 0);
    
    $db->delete_query("templates", "title = 'regged_today_index'");
    
    // DELETE ALL SETTINGS TO AVOID DUPLICATES
    $db->write_query("DELETE FROM ".TABLE_PREFIX."settings WHERE name IN(
        'reggedtoday_active'
    )");
    
    $db->delete_query("settinggroups", "name = 'reggedtoday'");
    
    rebuild_settings();
}

function reggedtoday_run()
{
    global $db, $mybb, $templates, $theme, $lang, $regged_today;
    
    $lang->load("regtoday");
    
    $regged_today = '';
    if($mybb->settings['reggedtoday_active'] == "1")
    {
        $regdate = time() - 24*60*60;
        $query = $db->simple_select(
            "users", 
            "uid, username, usergroup, displaygroup",
            "regdate > $regdate ORDER BY username ASC"
        );
        $comma = '';
        $reggedcount = 0;
        while($user = $db->fetch_array($query))
        {
            ++$reggedcount;
            $user['username'] = format_name($user['username'], $user['usergroup'], $user['displaygroup']);
            $user['profilelink'] = build_profile_link($user['username'], $user['uid']);
            eval("\$reggedmembers .= \"".$templates->get("index_whosonline_memberbit", 1, 0)."\";");
            $comma = ", ";
        }
        $memberword = ($reggedcount != 1) ? $lang->regged_member_plural : $lang->regged_member_singular;
        $lang->regged_note_today = $lang->sprintf($lang->regged_note_today, my_number_format($reggedcount), $memberword, 24);
        eval("\$regged_today = \"".$templates->get("regged_today_index")."\";");
    }

}

?>


I know that make a mod invisible for guest you need to do this:

Change this:
if(THIS_SCRIPT!='portal.php') 

To:
if(THIS_SCRIPT!='portal.php' && $mybb->user['uid'] != 0) 


But I don't find the code so this don't work for this..


So wat do I need to do to fix this that the mod is visible afther loggin in??


Thanks Helping me!
Can someone help me with this, its urgent because the forum is prived for some members
What licence is the plugin under ?

If its GPL i can edit it for you and add a setting to allow/disallow usergroups.

1) Find out the licence.

2) Give me the link to the plugin
Change
if($mybb->settings['reggedtoday_active'] == "1")

to
if($mybb->settings['reggedtoday_active'] == "1" && $mybb->user['uid'] != 0)
(2010-10-19, 08:37 PM)- G33K - Wrote: [ -> ]Change
if($mybb->settings['reggedtoday_active'] == "1")

to
if($mybb->settings['reggedtoday_active'] == "1" && $mybb->user['uid'] != 0)

This works for me , manny, manny thanks for this!!!!!