Customization > Blocks and Modifications

Admin Dashboard - everything you need ;)

(1/16) > >>

Blue:
[FOR SMF 2.0 ONLY]

I think that an Admin Dashboard is needed so I did one with:

* Moderator Reports
* Arcade (SMF Arcade Mod)
* Downloads (Download System Mod)
* Gallery (SMF Gallery Mod)
* Media Gallery (SMG Gallery Mod - old version)
* Media Gallery (AEVA Media Gallery - new version) «----- ADDED!
* Articles (SMF Articles Mod)
* Links (SMF Links Mod)
* Error Log
* Last Members
* Quick Stats

I hope you like it and if you want to add something to the admin dashboard just say something (I'll try to make you dream come true eheh ;D)

I've attached the images if you want to put it hosted in your website in /Themes/default/images/sp/


Note: It's a smart block. If you don't have one of the mods installed the admin info of it does not appear

Screenshot:


SMG Gallery & AEVA Gallery:


Don't forget to upload the images (from the zip files) to your SP image folder.

Here is the code (a lot smaller thanks to [SiNaN]):

--- Code: ---// FOR SIMPLE PORTAL -- Admin Dashboard -- Made by Blue
global $smcFunc, $sourcedir, $scripturl, $context;

$areas = array();

$result = $smcFunc['db_query']('','
   SELECT COUNT(*) AS reports
   FROM {db_prefix}log_reported
   WHERE closed = {int:not_closed}',
   array(
      'not_closed' => 0,
   )
);
list ($closed_reports) = $smcFunc['db_fetch_row']($result);
$smcFunc['db_free_result']($result);

$result = $smcFunc['db_query']('','
   SELECT COUNT(*) AS reports
   FROM {db_prefix}log_reported
   WHERE closed = {int:closed}',
   array(
      'closed' => 1,
   )
);
list ($open_reports) = $smcFunc['db_fetch_row']($result);
$smcFunc['db_free_result']($result);

$areas['mod_reports'] = array(
   'title' => 'Moderation Reports',
   'items' => array(
      'open' => array(
         'icon' => 'report_open',
         'label' => 'Open',
         'url' => '?action=moderate;area=reports;sa=open',
         'value' => $open_reports,
      ),
      'closed' => array(
         'icon' => 'report_closed',
         'label' => 'Closed',
         'url' => '?action=moderate;area=reports;sa=closed',
         'value' => $closed_reports,
      ),
   ),
);

if (file_exists($sourcedir . '/Arcade.php'))
{
   $areas['arcade'] = array(
      'title' => 'Arcade',
      'items' => array(
         'install' => array(
            'icon' => 'game_install',
            'label' => 'Install Game',
            'url' => '?action=admin;area=managegames;sa=install',
         ),
         'upload' => array(
            'icon' => 'game_upload',
            'label' => 'Upload Game',
            'url' => '?action=admin;area=managegames;sa=upload',
         ),
         'edit' => array(
            'icon' => 'game_edit',
            'label' => 'Edit Game',
            'url' => '?action=admin;area=managegames;sa=main',
         ),
      ),
   );
}

if (file_exists($sourcedir . '/Downloads2.php'))
{
   $result = $smcFunc['db_query']('','
      SELECT COUNT(*) AS files
      FROM {db_prefix}down_file
      WHERE approved = {int:not_approved}',
      array(
         'not_approved' => 0,
      )
   );
   list ($waiting_files) = $smcFunc['db_fetch_row']($result);
   $smcFunc['db_free_result']($result);

   $result = $smcFunc['db_query']('','
      SELECT COUNT(*) AS reports
      FROM {db_prefix}down_report',
      array(
      )
   );
   list ($reported_files) = $smcFunc['db_fetch_row']($result);
   $smcFunc['db_free_result']($result);

   $result = $smcFunc['db_query']('','
      SELECT COUNT(*) AS comments
      FROM {db_prefix}down_comment
      WHERE approved = {int:not_approved}',
      array(
         'not_approved' => 0,
      )
   );
   list ($waiting_comments) = $smcFunc['db_fetch_row']($result);
   $smcFunc['db_free_result']($result);

   $result = $smcFunc['db_query']('','
      SELECT COUNT(*) AS reports
      FROM {db_prefix}down_creport',
      array(
      )
   );
   list ($reported_comments) = $smcFunc['db_fetch_row']($result);
   $smcFunc['db_free_result']($result);

   $areas['downloads'] = array(
      'title' => 'Downloads',
      'items' => array(
         'waiting_files' => array(
            'icon' => 'file_approve',
            'label' => 'File Approval',
            'url' => '?action=admin;area=downloads;sa=approvelist',
            'value' => $waiting_files,
         ),
         'reported_files' => array(
            'icon' => 'file_report',
            'label' => 'Reported Files',
            'url' => '?action=admin;area=downloads;sa=reportlist',
            'value' => $reported_files,
         ),
         'waiting_comments' => array(
            'icon' => 'comments_add',
            'label' => 'Comment Approval',
            'url' => '?action=admin;area=downloads;sa=commentlist',
            'value' => $waiting_comments,
         ),
         'reported_comments' => array(
            'icon' => 'comments_delete',
            'label' => 'Reported Comments',
            'url' => '?action=admin;area=downloads;sa=commentlist',
            'value' => $reported_comments,
         ),
      ),
   );
}

if (file_exists($sourcedir . '/Gallery2.php'))
{
   $result = $smcFunc['db_query']('','
      SELECT COUNT(*) AS pictures
      FROM {db_prefix}gallery_pic
      WHERE approved = {int:not_approved}',
      array(
         'not_approved' => 0,
      )
   );
   list ($waiting_pictures) = $smcFunc['db_fetch_row']($result);
   $smcFunc['db_free_result']($result);

   $result = $smcFunc['db_query']('','
      SELECT COUNT(*) AS reports
      FROM {db_prefix}gallery_report',
      array(
      )
   );
   list ($reported_pictures) = $smcFunc['db_fetch_row']($result);
   $smcFunc['db_free_result']($result);

   $areas['gallery'] = array(
      'title' => 'Gallery',
      'items' => array(
         'waiting_files' => array(
            'icon' => 'picture_add',
            'label' => 'Picture Approval',
            'url' => '?action=admin;area=gallery;sa=approvelist',
            'value' => $waiting_pictures,
         ),
         'reported_files' => array(
            'icon' => 'picture_delete',
            'label' => 'Reported Pictures',
            'url' => '?action=admin;area=gallery;sa=reportlist',
            'value' => $reported_pictures,
         ),
      ),
   );
}

if (file_exists($sourcedir. '/Subs-MGallery.php'))
{   
$dbresult1 = $smcFunc['db_query']('', "
SELECT
COUNT(*) as notapproveditems
FROM {db_prefix}mgallery_media
WHERE approved = 0");
$row2 = $smcFunc['db_fetch_assoc']($dbresult1);
$notapproveditems = $row2['notapproveditems'];
$smcFunc['db_free_result']($dbresult1);

$dbresult2 = $smcFunc['db_query']('', "
SELECT
COUNT(*) as reportitems
FROM {db_prefix}mgallery_variables
WHERE type = 'item_report'");
$row2 = $smcFunc['db_fetch_assoc']($dbresult2);
$reportitems = $row2['reportitems'];
$smcFunc['db_free_result']($dbresult2);

$dbresult3 = $smcFunc['db_query']('', "
SELECT
COUNT(*) as notapprovedalbums
FROM {db_prefix}mgallery_albums
WHERE approved = 0");
$row2 = $smcFunc['db_fetch_assoc']($dbresult3);
$notapprovedalbums = $row2['notapprovedalbums'];
$smcFunc['db_free_result']($dbresult3);
   
$dbresult4 = $smcFunc['db_query']('', "
SELECT
COUNT(*) as notapprovedcomments
FROM {db_prefix}mgallery_comments
WHERE approved = 0");
$row2 = $smcFunc['db_fetch_assoc']($dbresult4);
$notapprovedcomments = $row2['notapprovedcomments'];
$smcFunc['db_free_result']($dbresult4);
   
$dbresult5 = $smcFunc['db_query']('', "
SELECT
COUNT(*) as reportcomments
FROM {db_prefix}mgallery_variables
WHERE type = 'comment_report'");
$row2 = $smcFunc['db_fetch_assoc']($dbresult5);
$reportcomments = $row2['reportcomments'];
$smcFunc['db_free_result']($dbresult5);

   $areas['smgallery'] = array(
      'title' => 'Gallery',
      'items' => array(
         'smg_items' => array(
            'icon' => 'picture_add',
            'label' => 'Picture Approval',
            'url' => '?action=mgallery',
            'value' => $notapproveditems,
         ),
         'smg_reportitems' => array(
            'icon' => 'picture_delete',
            'label' => 'Reported Pictures',
            'url' => '?action=mgallery',
            'value' => $reportitems,
         ),
         'smg_albums' => array(
            'icon' => 'gall_album',
            'label' => 'Albums Approval',
            'url' => '?action=mgallery',
            'value' => $notapprovedalbums,
         ),
         'smg_comments' => array(
            'icon' => 'comments_add',
            'label' => 'Comm. Approval',
            'url' => '?action=mgallery',
            'value' => $notapprovedcomments,
         ),
         'smg_reportcomments' => array(
            'icon' => 'comments_delete',
            'label' => 'Comm. Reported',
            'url' => '?action=mgallery',
            'value' => $reportcomments,
         ),
      ),
   );
}

if (file_exists($sourcedir. '/Aeva-Gallery2.php'))
{   
$dbresult1 = $smcFunc['db_query']('', "
SELECT
COUNT(*) as notapproveditems
FROM {db_prefix}aeva_media
WHERE approved = 0");
$row2 = $smcFunc['db_fetch_assoc']($dbresult1);
$notapproveditems = $row2['notapproveditems'];
$smcFunc['db_free_result']($dbresult1);

$dbresult2 = $smcFunc['db_query']('', "
SELECT
COUNT(*) as reportitems
FROM {db_prefix}aeva_variables
WHERE type = 'item_report'");
$row2 = $smcFunc['db_fetch_assoc']($dbresult2);
$reportitems = $row2['reportitems'];
$smcFunc['db_free_result']($dbresult2);

$dbresult3 = $smcFunc['db_query']('', "
SELECT
COUNT(*) as notapprovedalbums
FROM {db_prefix}aeva_albums
WHERE approved = 0");
$row2 = $smcFunc['db_fetch_assoc']($dbresult3);
$notapprovedalbums = $row2['notapprovedalbums'];
$smcFunc['db_free_result']($dbresult3);
   
$dbresult4 = $smcFunc['db_query']('', "
SELECT
COUNT(*) as notapprovedcomments
FROM {db_prefix}aeva_comments
WHERE approved = 0");
$row2 = $smcFunc['db_fetch_assoc']($dbresult4);
$notapprovedcomments = $row2['notapprovedcomments'];
$smcFunc['db_free_result']($dbresult4);
   
$dbresult5 = $smcFunc['db_query']('', "
SELECT
COUNT(*) as reportcomments
FROM {db_prefix}aeva_variables
WHERE type = 'comment_report'");
$row2 = $smcFunc['db_fetch_assoc']($dbresult5);
$reportcomments = $row2['reportcomments'];
$smcFunc['db_free_result']($dbresult5);

   $areas['smgallery'] = array(
      'title' => 'Gallery',
      'items' => array(
         'smg_items' => array(
            'icon' => 'picture_add',
            'label' => 'Picture Approval',
            'url' => '?action=media;area=moderate;sa=submissions',
            'value' => $notapproveditems,
         ),
         'smg_reportitems' => array(
            'icon' => 'picture_delete',
            'label' => 'Reported Pictures',
            'url' => '?action=media;area=moderate;sa=reports',
            'value' => $reportitems,
         ),
         'smg_albums' => array(
            'icon' => 'gall_album',
            'label' => 'Albums Approval',
            'url' => '?action=media;area=moderate;sa=submissions',
            'value' => $notapprovedalbums,
         ),
         'smg_comments' => array(
            'icon' => 'comments_add',
            'label' => 'Comm. Approval',
            'url' => '?action=media;area=moderate;sa=submissions',
            'value' => $notapprovedcomments,
         ),
         'smg_reportcomments' => array(
            'icon' => 'comments_delete',
            'label' => 'Comm. Reported',
            'url' => '?action=media;area=moderate;sa=reports',
            'value' => $reportcomments,
         ),
      ),
   );
}

if (file_exists($sourcedir . '/Articles2.php'))
{
   $result = $smcFunc['db_query']('','
      SELECT COUNT(*) AS articles
      FROM {db_prefix}articles
      WHERE approved = {int:not_approved}',
      array(
         'not_approved' => 0,
      )
   );
   list ($waiting_articles) = $smcFunc['db_fetch_row']($result);
   $smcFunc['db_free_result']($result);

   $result = $smcFunc['db_query']('','
      SELECT COUNT(*) AS comments
      FROM {db_prefix}articles_comment
      WHERE approved = {int:not_approved}',
      array(
         'not_approved' => 0,
      )
   );
   list ($waiting_comments) = $smcFunc['db_fetch_row']($result);
   $smcFunc['db_free_result']($result);

   $areas['downloads'] = array(
      'title' => 'Articles',
      'items' => array(
         'waiting_articles' => array(
            'icon' => 'article_add',
            'label' => 'Article Approval',
            'url' => '?action=admin;area=articles;sa=alist',
            'value' => $waiting_articles,
         ),
         'waiting_comments' => array(
            'icon' => 'comments_add',
            'label' => 'Comment Approval',
            'url' => '?action=admin;area=articles;sa=comlist',
            'value' => $waiting_comments,
         ),
      ),
   );
}

if (file_exists($sourcedir . '/Links2.php'))
{
   $result = $smcFunc['db_query']('','
      SELECT COUNT(*) AS links
      FROM {db_prefix}links
      WHERE approved = {int:not_approved}',
      array(
         'not_approved' => 0,
      )
   );
   list ($waiting_links) = $smcFunc['db_fetch_row']($result);
   $smcFunc['db_free_result']($result);

   $areas['links'] = array(
      'title' => 'Links',
      'items' => array(
         'waiting_links' => array(
            'icon' => 'links_approval',
            'label' => 'Link Approval',
            'url' => '?action=links;sa=alist',
            'value' => $waiting_links,
         ),
      ),
   );
}

$result = $smcFunc['db_query']('','
   SELECT COUNT(*) AS errors
   FROM {db_prefix}log_errors',
   array(
   )
);
list ($total_errors) = $smcFunc['db_fetch_row']($result);
$smcFunc['db_free_result']($result);

$areas['error_log'] = array(
   'title' => 'Error Log',
   'items' => array(
      'errors' => array(
         'icon' => 'error_new',
         'label' => 'Errors',
         'url' => '?action=admin;area=logs;sa=errorlog',
         'value' => $total_errors,
      ),
   ),
);

foreach ($areas as $area)
{
   echo '
<div class="sp_center" style="color: #FF9900">
   <strong>', $area['title'], '</strong>
</div>
<hr />
<ul class="sp_list">';

   foreach ($area['items'] as $item)
      echo '
   <li>', sp_embed_image($item['icon']), ' <a href="', $scripturl, $item['url'], '">', $item['label'], (isset($item['value']) ? ': [' . $item['value'] . ']' : ''), '</a></li>';

   echo '
</ul>';
}
--- End code ---


ADDONS

Addons are little extras for your Admin Dashboard. Some people want it, some don't. So, if you are one that want it, just add the addons' code after the Admin Dashboard code in the SP php block.

Don't forget to upload the images (from the zip files) to your SP image folder.

Configuration Addon (Version 2) (request made by aceflybye & by amlucent)




--- Code: ---//CONFIGURATION BLOCK | FOR ADMIN DASHBOARD <> by [Blue] @ Chrome!
global $scripturl, $smcFunc;

$dbresult = $smcFunc['db_query']('', '
SELECT COUNT(*) as requests
FROM {db_prefix}log_group_requests');
$row2 = $smcFunc['db_fetch_assoc']($dbresult);
$requests = $row2['requests'];
$smcFunc['db_free_result']($dbresult);

$areas = array(
   array(
      'icon' => 'brick_go',
      'url' => '?action=admin;area=packages',
      'label' => 'Browse Packages',
   ),
   array(
      'icon' => 'brick_add',
      'url' => '?action=admin;area=packages;sa=packageget;get',
      'label' => 'Upload Package',
   ),
   array(
      'icon' => 'group_gear',
      'url' => '?action=admin;area=membergroups',
      'label' => 'Edit Membergroups',
   ),
    array(
      'icon' => 'group_add',
      'url' => '?action=moderate;area=groups;sa=requests',
      'label' => 'Group Requests',
  'value' => $requests
   ), 
   array(
      'icon' => 'layout_edit',
      'url' => '?action=admin;area=manageboards',
      'label' => 'Modify Boards',
   ),
   array(
      'icon' => 'pilcrow',
      'url' => '?action=admin;area=postsettings;sa=censor',
      'label' => 'Censored Words',
   ),
);

echo '
<div class="sp_center" style="color: #FF9900;">
   <strong>Configuration</strong>
</div>
<hr />
<ul class="sp_list">';

   foreach ($areas as $area)
      echo '
   <li>', sp_embed_image($area['icon']), ' <a href="', $scripturl, $area['url'], '">', $area['label'], (isset($area['value']) ? ': [' . $area['value'] . ']' : ''), '</a></li>';

   echo '
</ul>';
//[END] CONFIGURATION BLOCK | FOR ADMIN DASHBOARD
--- End code ---

Members Waiting Activation Addon (Version 2)




--- Code: ---//MEMBERS WAITING ACTIVATION BLOCK v2.0 | FOR ADMIN DASHBOARD

// Title
echo'
<div style="text-align:center; color:#FF9900; font-weight:bold;">Members Waiting Act.</div>
<hr />';

// Code ;)
global $smcFunc, $scripturl, $txt;

$request = $smcFunc['db_query']('','
SELECT id_member, real_name, date_registered
FROM {db_prefix}members
WHERE is_activated = {int:is_activated}
ORDER BY id_member DESC',
array(
'is_activated' => 0,
)
);
$activations = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
{
$activations[] = array(
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['real_name'] . '</a>',
'date' => timeformat($row['date_registered'], '%d %b %y'),
);
}
$smcFunc['db_free_result']($request);

if (empty($activations))
{
echo '
', $txt['error_sp_no_members_found'];
return;
}

echo '
<ul class="sp_list">';

foreach ($activations as $activation)
echo '
<li>', sp_embed_image('dot'), ' ', $activation['link'], ' - ', $activation['date'], '</li>';

echo '
</ul>';
--- End code ---

aceflybye:
whats the zip file for? and how do I use it?

Blue:
The zip file only has the codes and images apart.

I'm giving the images if you want to change the links and host them in your website since the imgs are hosted in ImageShack.

So, basically, you don't need to use the zip file. Just copy the code above to a php block ;)

aceflybye:
when i add the block my home page turns white. any ideas?

Blue:
Yes.

You don't have one of these mods installed:
* Downloads (Download System Mod)
* Gallery (SMF Gallery Mod)
* Articles (SMF Articles Mod)
* Links (SMF Links Mod)

Which is the mod that you don't have?

Navigation

[0] Message Index

[#] Next page

Go to full version