Simple Portal

Customization => Blocks and Modifications => Topic started by: Blue on May 04, 2009, 03:25:33 PM

Title: Admin Dashboard - everything you need ;)
Post by: Blue on May 04, 2009, 03:25:33 PM
[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:
(http://img74.imageshack.us/img74/6756/screenshotz.th.png) (http://img74.imageshack.us/img74/6756/screenshotz.png)

SMG Gallery & AEVA Gallery:
(http://img21.imageshack.us/img21/4646/smggallery.png)

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: [Select]
// 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>';
}



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)

(http://img413.imageshack.us/img413/9839/confign.png)

Code: [Select]
//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

Members Waiting Activation Addon (Version 2)

(http://img11.imageshack.us/img11/1209/waitting.png)

Code: [Select]
//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>';
Title: Re: [BLOCK] Admin Dashboard - everything you need ;)
Post by: aceflybye on May 04, 2009, 04:38:55 PM
whats the zip file for? and how do I use it?
Title: Re: [BLOCK] Admin Dashboard - everything you need ;)
Post by: Blue on May 04, 2009, 04:47:23 PM
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 ;)
Title: Re: [BLOCK] Admin Dashboard - everything you need ;)
Post by: aceflybye on May 04, 2009, 04:51:32 PM
when i add the block my home page turns white. any ideas?
Title: Re: [BLOCK] Admin Dashboard - everything you need ;)
Post by: Blue on May 04, 2009, 04:57:10 PM
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?
Title: Re: [BLOCK] Admin Dashboard - everything you need ;)
Post by: aceflybye on May 04, 2009, 04:58:24 PM
Could you actually give me links to the mods so i can get them I think they maybe more useful to have then to not

Could it also maybe have arcade controls, like install game so I don't have to go in to the admin every time.

if not thats ok great work
Title: Re: [BLOCK] Admin Dashboard - everything you need ;)
Post by: Blue on May 04, 2009, 05:01:22 PM
Hum... Yes, I can.

Here they are:
Download System (http://custom.simplemachines.org/mods/index.php?mod=992)
SMF Gallery (http://custom.simplemachines.org/mods/index.php?mod=473)
SMF Articles (http://custom.simplemachines.org/mods/index.php?mod=1354)
SMF Links (http://custom.simplemachines.org/mods/index.php?mod=381)

Yes, I can add "Install game" but you need to give me the link for it since I don't have SMF Arcade installed.

So, go to the install game admin page and give me the link after index.php. It begins with "?action=" ok? :)
Title: Re: [BLOCK] Admin Dashboard - everything you need ;)
Post by: aceflybye on May 04, 2009, 05:05:58 PM
link to install arcade

/index.php?action=admin;area=managegames;sa=install;d2019da6d=8656836ef1bf75a86cd4d96883c31b57

link to upload game

/index.php?action=admin;area=managegames;sa=upload;d2019da6d=8656836ef1bf75a86cd4d96883c31b57

if you can add them that would be so great
Title: Re: [BLOCK] Admin Dashboard - everything you need ;)
Post by: Blue on May 04, 2009, 05:12:12 PM
Done! See if it works in a new php block ;)

Code: [Select]
//ARCADE BLOCK | FOR ADMIN DASHBOARD <> by [Blue] @ Chrome!

// Title
echo'
<center><font color="#FF9900"><b>Arcade</b></font></center>
<hr>';

// Code Install
echo'
<img src="http://img218.imageshack.us/img218/2686/install.png" align="abscenter" > <a href="' . $scripturl . '?action=admin;area=managegames;sa=install">Install Game</a>
<br/ >';

// Code Upload
echo'
<img src="http://img362.imageshack.us/img362/2597/upload.png" align="abscenter" > <a href="' . $scripturl . '?action=admin;area=managegames;sa=upload">Upload Game</a>
<br/ >';

//[END] ARCADE BLOCK | FOR ADMIN DASHBOARD

If it does I'll add it to the Admin Dashboard ;D
Title: Re: [BLOCK] Admin Dashboard - everything you need ;)
Post by: aceflybye on May 04, 2009, 05:17:25 PM
Perfect

here is the other things other may find useful having

link to edit games

index.php?action=admin;area=managegames;sa=main;d2019da6d=8656836ef1bf75a86cd4d96883c31b57
Title: Re: [BLOCK] Admin Dashboard - everything you need ;)
Post by: Blue on May 04, 2009, 05:26:02 PM
Try this :P

Code: [Select]
//ARCADE BLOCK | FOR ADMIN DASHBOARD <> by [Blue] @ Chrome!

// Title
echo'
<center><font color="#FF9900"><b>Arcade</b></font></center>
<hr>';

// Code Install
echo'
<img src="http://img218.imageshack.us/img218/2686/install.png" align="abscenter" > <a href="' . $scripturl . '?action=admin;area=managegames;sa=install">Install Game</a>
<br/ >';

// Code Upload
echo'
<img src="http://img362.imageshack.us/img362/2597/upload.png" align="abscenter" > <a href="' . $scripturl . '?action=admin;area=managegames;sa=upload">Upload Game</a>
<br/ >';

// Code Edit
echo'
<img src="http://img218.imageshack.us/img218/775/edite.png" align="abscenter" > <a href="' . $scripturl . '?action=admin;area=managegames;sa=main">Edit Game</a>
<br/ >';

//[END] ARCADE BLOCK | FOR ADMIN DASHBOARD
Title: Re: [BLOCK] Admin Dashboard - everything you need ;)
Post by: aceflybye on May 04, 2009, 05:28:57 PM
Perfect lol now  for them all to be together. so awesome by the way ty for doing this  :applause:

Wish there was like karma or something to thank. sadly smf 2.0 don't have a mod for it. 
Title: Re: Admin Dashboard - everything you need ;)
Post by: Blue on May 04, 2009, 05:30:44 PM
No problem ;) I'm glad I helped you ;D

Wish there was like karma or something to thank. sadly smf 2.0 don't have a mod for it. 

Are you refering to SMF or Simple Portal Website? I'm asking because SMF has a karma system built in :P
Title: Re: Admin Dashboard - everything you need ;)
Post by: Nathaniel on May 04, 2009, 05:34:21 PM
Moved to the "Blocks and Modifications" board.

Looks very nice. My only comment is that you could add checking to see if the specific mods are installed, so that they don't cause errors if you don't have them installed. Something like the code below will work for the arcade mod.

Code: [Select]
global $sourcedir;
if (file_exists($sourcedir . '/Arcade.php'))
{
// normal code
}

You can change it for each mod. :)
Title: Re: Admin Dashboard - everything you need ;)
Post by: Blue on May 04, 2009, 05:37:12 PM
Cool, thanks LHVWB.

I was thinking of adding "intelligent blocks" like your Shop Block. Thanks for providing me the code ;)
Title: Re: Admin Dashboard - everything you need ;)
Post by: aceflybye on May 04, 2009, 05:37:35 PM
Works like a dream thank you. and awesome and i mean awesome work

No problem ;) I'm glad I helped you ;D

Wish there was like karma or something to thank. sadly smf 2.0 don't have a mod for it. 

Are you refering to SMF or Simple Portal Website? I'm asking because SMF has a karma system built in :P

I have not found how to turn it on or found it in any of the settings. and i wish that simple portal had it enabled if it has it.
Title: Re: Admin Dashboard - everything you need ;)
Post by: Blue on May 04, 2009, 05:49:44 PM
Updated: Added "Smart Blocks".
Now, if you don't have the mods installed, the admin info about it will not appear. Therefore, you don't need to remove anything from the code ;)

[aceflybye, you should ask how you turn on/off karmas in SMF Oficial website but... go to admin>features and options and turn karma on eheh :P (or add this next to your index.php: ?action=admin;area=featuresettings)]
Title: Re: Admin Dashboard - everything you need ;)
Post by: willerby on May 04, 2009, 07:00:10 PM
Good work Blue... very impressed

Thanks
Title: Re: Admin Dashboard - everything you need ;)
Post by: Blue on May 04, 2009, 07:05:25 PM
Thank you willerby :) If you need to add something to the Admin Dashboard just say so and I'll help you ;D
Title: Re: Admin Dashboard - everything you need ;)
Post by: aceflybye on May 04, 2009, 10:50:36 PM
Hate to drop a list on you.. but Some settings that would be nice to quickly get to would be the following.  you can just ignore this all if you rather lol

Package Config

link to BROWSE PACKAGES
index.php?action=admin;area=packages

Link to DOWNLOAD PACKAGES
index.php?action=admin;area=packages;sa=packageget


Memeber Groups

Link to EDIT MEMBERGROUPS
index.php?action=admin;area=membergroups;sa=index


Forum Settings

Link to MODIFY BOARDS
index.php?action=admin;area=manageboards;sa=main

Link to CENSORED WORDS
index.php?action=admin;area=postsettings;sa=censor
Title: Re: Admin Dashboard - everything you need ;)
Post by: Blue on May 04, 2009, 11:13:36 PM
Feel free to ask new additions to the Dashboard. As I said before: "I'm here to make your dreams true" eheh :P :P

Here it is:

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

// Title
echo'
<center><font color="#FF9900"><b>Configuration</b></font></center>
<hr>';

// Code Browse
echo'
<img src="http://img74.imageshack.us/img74/9481/brickgo.png" align="abscenter" > <a href="' . $scripturl . '?action=admin;area=packages">Browse Packages</a>
<br/ >';

// Code Upload
echo'
<img src="http://img127.imageshack.us/img127/2494/brickadd.png" align="abscenter" > <a href="' . $scripturl . '?action=admin;area=packages;sa=packageget;get">Upload Package</a>
<br/ >';

// Code Edit MemberGroups
echo'
<img src="http://img127.imageshack.us/img127/5152/groupgear.png" align="abscenter" > <a href="' . $scripturl . '?action=admin;area=membergroups;sa=index">Edit MemberGroups</a>
<br/ >';

// Code Modify Boards
echo'
<img src="http://img74.imageshack.us/img74/9518/layoutedit.png" align="abscenter" > <a href="' . $scripturl . '?action=admin;area=manageboards;sa=main">Modify Boards</a>
<br/ >';

// Code Censored Words
echo'
<img src="http://img9.imageshack.us/img9/8610/pilcrow.png" align="abscenter" > <a href="' . $scripturl . '?action=admin;area=postsettings;sa=censor">Censored Words</a>
<br/ >';

//[END] CONFIGURATION BLOCK | FOR ADMIN DASHBOARD

Do you like it? :D

Btw, I've noticed that your website uses dark colors. If you want to change the colors of the text, say so ;)
Title: Re: Admin Dashboard - everything you need ;)
Post by: amlucent on May 04, 2009, 11:53:56 PM
Does it show group requests waiting to be approved?
Title: Re: Admin Dashboard - everything you need ;)
Post by: Blue on May 04, 2009, 11:56:23 PM
No, but I can make one if you want to :thumbsup:
Title: Re: Admin Dashboard - everything you need ;)
Post by: aceflybye on May 05, 2009, 12:57:13 AM
Thank you so much lol and I love it.
Title: Re: Admin Dashboard - everything you need ;)
Post by: amlucent on May 05, 2009, 01:08:15 AM
2 things... I tried to put this on my site and I get the following error

Code: [Select]
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /home/gwplaye/public_html/Sources/SPortal1-1.php(3232) : eval()'d code on line 5

Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /home/gwplaye/public_html/Sources/SPortal1-1.php(3232) : eval()'d code on line 5

Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /home/gwplaye/public_html/Sources/SPortal1-1.php(3232) : eval()'d code on line 5

Warning: Unexpected character in input: ''' (ASCII=39) state=1 in /home/gwplaye/public_html/Sources/SPortal1-1.php(3232) : eval()'d code on line 5

Parse error: syntax error, unexpected '<' in /home/gwplaye/public_html/Sources/SPortal1-1.php(3232) : eval()'d code on line 6

I am using SP 2.2 on SMF 1.8.. also since I hav not gotten the code up and running yet I am not sure if it does this but I noticed that you can administrate SMF gallery from it.  I run SMG gallery on my site, I was wondering if possible for it to look for this mod as well?

Here is the link to SMG if you need it

http://custom.simplemachines.org/mods/index.php?mod=1365 (http://custom.simplemachines.org/mods/index.php?mod=1365)
Title: Re: Admin Dashboard - everything you need ;)
Post by: Nathaniel on May 05, 2009, 01:51:23 AM
The code posted by Blue only works for SMF 2. So it won't work with SMF 11.x.

Also, those sorts are errors are caused by an issue with the preview function, the PHP block works fine as long as you don't use the Preview after you have copied the code into it.
Title: Re: Admin Dashboard - everything you need ;)
Post by: [SiNaN] on May 05, 2009, 05:43:33 AM
For the Configuration - Dashboard codes;

You seem to forgot adding $scripturl variable to globals. It looks great otherwise. However, you could have used a list instead, for instance:

Code: [Select]
global $scripturl;

echo '
<div class="sp_center" stlye="color: #FF9900;">
<strong>Configuration</strong>
</div>
<hr />
<ul class="sp_list">
<li>', sp_embed_image('brick_go'), ' <a href="', $scripturl, '?action=admin;area=packages">Browse Packages</a></li>
<li>', sp_embed_image('brick_add'), ' <a href="', $scripturl, '?action=admin;area=packages;sa=packageget;get">Upload Package</a></li>
<li>', sp_embed_image('group_gear'), ' <a href="', $scripturl, '?action=admin;area=membergroups">Edit Membergroups</a></li>
<li>', sp_embed_image('layout_edit'), ' <a href="', $scripturl, '?action=admin;area=manageboards">Modify Boards</a></li>
<li>', sp_embed_image('pilcrow'), ' <a href="', $scripturl, '?action=admin;area=postsettings;sa=censor">Censored Words</a></li>
</ul>';

And with some PHP, you can make life easier for yourself, like this:

Code: [Select]
global $scripturl;

$areas = array(
array(
'icon' => 'brick_go',
'url' => 'area=packages',
'label' => 'Browse Packages',
),
array(
'icon' => 'brick_add',
'url' => 'area=packages;sa=packageget;get',
'label' => 'Upload Package',
),
array(
'icon' => 'group_gear',
'url' => 'area=membergroups',
'label' => 'Edit Membergroups',
),
array(
'icon' => 'layout_edit',
'url' => 'area=manageboards',
'label' => 'Modify Boards',
),
array(
'icon' => 'pilcrow',
'url' => '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, '?action=admin;', $area['url'], '">', $area['label'], '</a></li>';

echo '
</ul>';

Note that I use sp_embed_image() function to display images. So you'll have to upload the images inside the package attached to the Themes/default/images/sp directory.
Title: Re: Admin Dashboard - everything you need ;)
Post by: [SiNaN] on May 05, 2009, 06:38:04 AM
For the overall dashboard, besides the issues I pointed out earlier, just a reminder of database queries:

Instead of this:

Code: [Select]
      $dbresult10 = $smcFunc['db_query']('', "
      SELECT
         COUNT(*) as reportsopen
      FROM {db_prefix}log_reported
      WHERE closed = 0");
      $row2 = $smcFunc['db_fetch_assoc']($dbresult10);
      $reportsopen = $row2['reportsopen'];
      $smcFunc['db_free_result']($dbresult10);
      $context['reports_open'] = $reportsopen;

You can do this:

Code: [Select]
$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);

You can use a single variable for database resource, as long as you don't forget to free it after you are done with it. Also, with list() and $smcFunc['db_fetch_row'], it is a lot easier to fetch a single field.

Other than those, wonderful, as usual.

And here is my code, a bit tidied up like the method I've shown above:

Code: [Select]
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 . '/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' => 'link_add',
'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>';
}

Again you need to upload the images attached to SP images directory.

If you have any question, feel free to ask. Keep up with good work! ;)
Title: Re: Admin Dashboard - everything you need ;)
Post by: Blue on May 05, 2009, 06:44:41 AM
Thanks guys ;D I'm learning php and there are so many things I don't know yet :)) but I'm a quick learner :P

LHVWB, yes I did forget the global $scripturl. It was 5am here in Portugal so... You got it :P eheh!

[SiNaN], thank you for your advices. I didn't use sp_embed_image because some people are using 2.1.1 and I didn't want to exclude them. That was my reason. But I will update my code of Admin Dashboard and Zip the images :)

I'll update the code in an hours and I'm going to use everything I learn. I loved the php way, seems really easy.

But if I need to put some codes, not urls. It's possivle to do that in the array like the links? :0


You have posted first and thanks for the update :P Now I know how to do it better for the future blocks I'm going to make ;)

If you don't mind, I'll update the first post. ;D
Title: Re: Admin Dashboard - everything you need ;)
Post by: [SiNaN] on May 05, 2009, 06:50:59 AM
Quote
[SiNaN], thank you for your advices. I didn't use sp_embed_image because some people are using 2.1.1 and I didn't want to exclude them. That was my reason. But I will update my code of Admin Dashboard and Zip the images :)

Sounds reasonable, but this will also encourage them to update. :P

Quote
But if I need to put some codes, not urls. It's possivle to do that in the array like the links? :0

If you can elaborate what you mean by some codes, I may help you with that too.

Quote
You have posted first and thanks for the update :P Now I know how to do it better for the future blocks I'm going to make ;)

If you don't mind, I'll update the first post. ;D

You're welcome. As I said, if you have any questions, feel free to ask.

And of course, you can copy those codes to first post. However, I suggest testing them before.
Title: Re: Admin Dashboard - everything you need ;)
Post by: Blue on May 05, 2009, 07:05:46 AM
Quote
Sounds reasonable, but this will also encourage them to update. :P

eheh! :P

Quote
If you can elaborate what you mean by some codes, I may help you with that too.

I meant code that had to fetch data in de DB. But I saw your "tidied" Admin Dashboard and I got it.

I can use DBresult and insert a parameter normally  ;)

But, can you explain me this part?
Code: [Select]
(isset($item['value']) ? ': [' . $item['value'] . ']' : '')
I'm asking because some "items" don't use $value and I can't understand well how this code works

Quote
However, I suggest testing them before.

I'm too lazy to install SP 2.2 on my website :P Going to do that after lunch ;) And then I test it eheh!
Title: Re: Admin Dashboard - everything you need ;)
Post by: [SiNaN] on May 05, 2009, 07:22:30 AM
Quote
But, can you explain me this part?
Code: [Select]
(isset($item['value']) ? ': [' . $item['value'] . ']' : '')
I'm asking because some "items" don't use $value and I can't understand well how this code works

That's the magical "ternary operator".

Just to make sure, isset() function checks if the variable is set or not. You can get the details here:

http://php.net/isset

Now the ternary operator is the "quick if". It is used like this:

Code: [Select]
{condition} ? {if_true} : {if_false}
This is same as this:

Code: [Select]
if ({condition})
{if_true}
else
{if_false}

Example:

Code: [Select]
$my_var = 1;
$variable = $my_var != 1 ? 'I am not 1!' : 'I am 1!;
echo $variable;

Or you can directly use it with echo:

Code: [Select]
$my_var = 10;
echo 'I am ', ($my_var > 9 ? 'greater' : 'less'), ' than 9';

This one with if would be like this:

Code: [Select]
$my_var = 10;

echo 'I am ';

if ($my_var > 9)
echo 'greater';
else
echo 'less';

echo ' than 9';

So the code I used in the dashboard means, if $item['value'] is set, show $item['value']; if it is not set, don't show anything. With if, it would be like this:

Code: [Select]
if (isset($item['value']))
echo ': [' . $item['value'] . ']';
else
echo '';

For details about ternary operator:

http://php.net/ternary

As a lazy DEV, I find it very useful. :P

Quote
I'm too lazy to install SP 2.2 on my website :P Going to do that after lunch ;) And then I test it eheh!

You really need to update; 2.2 has a lot of new features within. ;)
Title: Re: Admin Dashboard - everything you need ;)
Post by: Blue on May 05, 2009, 07:29:30 AM
WOW! I'm really going to join isset() ;D

Now I got it and being lazy too this is going to be the best thing :) I'll use all these teachings for my next block eheh!

Quote from: [SiNaN
You really need to update; 2.2 has a lot of new features within. ;)

I didn't need to because I have a very simple website.

But since I started creating blocks for SP, the update is needed ;)

I run SMG gallery on my site, I was wondering if possible for it to look for this mod as well?

Yes, I'll add SMG Gallery mod to the block on the next release ;) (if nothing happens to me, the release is going to be today eheh!)

Hum... SMG seams a bit harder to code. I'll give it a better look tomorrow since I'm having some problems putting the code to work at 5am :P
Title: Re: Admin Dashboard - everything you need ;)
Post by: willerby on May 06, 2009, 05:21:47 PM
Thank you willerby :) If you need to add something to the Admin Dashboard just say so and I'll help you ;D

One thing... although I may have more!

I don't have Gallery set for approvals - I let members post new images and just check occasionally. Is there an easy way of providing a link to unviewed images (but showing how many are unviewed in brackets as you do for approvals)?

Thanks

W
Title: Re: Admin Dashboard - everything you need ;)
Post by: Blue on May 06, 2009, 05:27:01 PM
Hum... Maybe.. When you go to the gallery does it points the pictures unviewed by you?
If yes, then.. It's possible and I can make it for you ;)

Configuration Addon [Version 2]
+ Added Group Requests
Title: Re: Admin Dashboard - everything you need ;)
Post by: willerby on May 07, 2009, 10:43:43 AM
There's a link for each user that has the subaction:

/index.php?action=gallery;sa=unviewed

Easy to do the link within the admin block but wanted to try and pull whether their were any unviewed items (how many or if >0) to use as a highlight to click on link as per other items in the block

Not urgent or even important as the link is pretty good but would just make similar to others

Any help appreciated, blue

W

Title: Re: Admin Dashboard - everything you need ;)
Post by: Blue on May 07, 2009, 09:52:55 PM
That seams easy to do but I have a problem: I don't own a Gallery Pro because It needs to be purchased.

I only have Gallery Lite and that feature doesn't exist in Lite version. So, the best that I can do is to put a link to redirect to ?action=gallery;sa=unviewed.

I'm sorry not to satisfy your request 100% :-[ :|

It's possible to make a block with the last things added but it is as far as I can go with Gallery Lite :( but if you want that I can make it to you.

Here is the code:
Code: [Select]
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,
         ),
         'unviewed' => array(
            'icon' => 'imagepros',
            'label' => 'Unviewed Pictures',
            'url' => '?action=gallery;sa=unviewed',
  ),
      ),
   );
}

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>';
}

Don't forget to add the image attached in SP images Folder :nervous-happy:
Title: Re: Admin Dashboard - everything you need ;)
Post by: willerby on May 08, 2009, 04:50:23 AM
I could send you the relevant php files from Gallery Pro - they'll be based on the Lite version. Which ones would you need?
Title: Re: Admin Dashboard - everything you need ;)
Post by: Blue on May 08, 2009, 06:09:52 AM
See if you have some code in Gallery.php and Gallery.template.php like "unviewed"

I would need that ;)
Title: Re: Admin Dashboard - everything you need ;)
Post by: willerby on May 08, 2009, 08:46:27 AM
Think its a call to this function in Gallery.php

Code: [Select]
function UnviewedItems()
{
global $txt, $context, $smcFunc, $mbname, $modSettings, $scripturl, $user_info;

// No guests allowed
is_not_guest();

// Check Permission
isAllowedTo('smfgallery_view');

TopButtonTabs();

if (!$context['user']['is_guest'])
$groupsdata = implode($user_info['groups'],',');
else
$groupsdata = -1;

$context['page_title'] = $mbname . ' - ' . $txt['gallery_text_title'] . ' - ' . $txt['gallery_txt_unviewed_images'];


$context['sub_template']  = 'unviewed';


$context['start'] = (int) $_REQUEST['start'];
$dbresult = $smcFunc['db_query']('', "
SELECT
COUNT(*) as total
FROM {db_prefix}gallery_pic as p
LEFT JOIN {db_prefix}gallery_catperm AS c ON (c.ID_GROUP IN ($groupsdata) AND c.ID_CAT = p.ID_CAT)
LEFT JOIN {db_prefix}gallery_log_mark_view AS v ON (p.ID_PICTURE = v.ID_PICTURE AND v.ID_MEMBER = " . $user_info['id']  . " AND v.user_id_cat = p.user_id_cat)
LEFT JOIN {db_prefix}members AS m ON (p.ID_MEMBER = m.ID_MEMBER)
LEFT JOIN {db_prefix}gallery_usersettings AS s ON (s.ID_MEMBER = m.ID_MEMBER)

WHERE v.ID_PICTURE IS NULL AND (s.private =0 || s.private IS NULL ) AND (c.view IS NULL || c.view = 1 ) AND  p.approved = 1 GROUP by p.ID_PICTURE ");
$row = $smcFunc['db_fetch_assoc']($dbresult);
$total = $row['total'];
$smcFunc['db_free_result']($dbresult);

$dbresult = $smcFunc['db_query']('', "
SELECT
p.ID_PICTURE, p.totalratings, p.rating, p.commenttotal, p.filesize, p.views, p.thumbfilename,
p.title, p.ID_MEMBER, m.real_name, p.date, p.description, c.view, p.mature 
FROM {db_prefix}gallery_pic as p
LEFT JOIN {db_prefix}members AS m ON (p.ID_MEMBER = m.ID_MEMBER)
LEFT JOIN {db_prefix}gallery_catperm AS c ON (c.ID_GROUP IN ($groupsdata) AND c.ID_CAT = p.ID_CAT)
LEFT JOIN {db_prefix}gallery_log_mark_view AS v ON (p.ID_PICTURE = v.ID_PICTURE AND v.ID_MEMBER = " . $user_info['id'] . " AND v.user_id_cat = p.user_id_cat)
LEFT JOIN {db_prefix}gallery_usersettings AS s ON (s.ID_MEMBER = m.ID_MEMBER)
WHERE v.ID_PICTURE IS NULL AND (s.private =0 || s.private IS NULL ) AND (c.view IS NULL || c.view =1) AND  p.approved = 1 GROUP by p.ID_PICTURE  ORDER BY ID_PICTURE DESC
LIMIT $context[start]," . $modSettings['gallery_set_images_per_page']);
$context['gallery_pics'] = array();
while ($row = $smcFunc['db_fetch_assoc']($dbresult))
$context['gallery_pics'][] = $row;
$smcFunc['db_free_result']($dbresult);

$context['page_index'] = constructPageIndex($scripturl . '?action=gallery;sa=unviewed', $_REQUEST['start'], $total, $modSettings['gallery_set_images_per_page']);


}

Let me know if you need the complete file
Title: Re: Admin Dashboard - everything you need ;)
Post by: Blue on May 08, 2009, 11:02:50 AM
I think this is all I need ;)

Today, I won't be able to work on it because I've college exams but tomorrow I will try :D
Title: Re: Admin Dashboard - everything you need ;)
Post by: Blue on May 08, 2009, 10:16:31 PM
Don't know if this works but try this:
Code: [Select]
<?php
global $smcFunc$user_info$scripturl;

$dbresult $smcFunc['db_query'](''"
      SELECT
         COUNT(*) as total
      FROM {db_prefix}gallery_pic as p
      LEFT JOIN {db_prefix}gallery_catperm AS c ON (c.ID_GROUP IN (
$groupsdata) AND c.ID_CAT = p.ID_CAT)
      LEFT JOIN {db_prefix}gallery_log_mark_view AS v ON (p.ID_PICTURE = v.ID_PICTURE AND v.ID_MEMBER = " 
$user_info['id']  . " AND v.user_id_cat = p.user_id_cat)
      LEFT JOIN {db_prefix}members AS m ON (p.ID_MEMBER = m.ID_MEMBER)
      LEFT JOIN {db_prefix}gallery_usersettings AS s ON (s.ID_MEMBER = m.ID_MEMBER)
      
      WHERE v.ID_PICTURE IS NULL AND (s.private =0 || s.private IS NULL ) AND (c.view IS NULL || c.view = 1 ) AND  p.approved = 1 GROUP by p.ID_PICTURE "
);
   
$row $smcFunc['db_fetch_assoc']($dbresult);
   
$total $row['total'];
   
$smcFunc['db_free_result']($dbresult);

echo

<div class="smalltext"><a href="' 
$scripturl '?action=gallery;sa=unviewed">Unviewed Pics: [' $total .']</a></div>'
?>
Title: Re: Admin Dashboard - everything you need ;)
Post by: Blue on May 08, 2009, 11:31:59 PM
SMG Gallery Added to the block :P
Members Waiting Activation Added to Addons
Title: Re: Admin Dashboard - everything you need ;)
Post by: Shortie on May 09, 2009, 06:05:08 AM
Hey Blue

This is AWESOME ! ! !

I hope you don't mind but I have moved the HR to above the titles

Also attached is a Sshot of how it looks on a new theme I am doing at the moment and I have to say to the World that this is as functional as can possibly be and looks AWESOME too so the best of both worlds

Great Stuff and,

Many thanks

Shortie

P.S. - If you want me to remove the SShot just let me know - But thought the world should see what a great job you guys have done
Title: Re: Admin Dashboard - everything you need ;)
Post by: Blue on May 09, 2009, 07:38:49 AM
Thank You very much for your big comment :D

It's good to know that people like the blocks I make :P

I hope you don't mind but I have moved the HR to above the titles

I don't mind at all ;) Do whatever you want to eheh :P

Great themes by the way, looks cool ;)
Title: Re: Admin Dashboard - everything you need ;)
Post by: willerby on May 09, 2009, 05:46:31 PM
Thaks for trying Blue...After removing the <?php I get this

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') AND c.ID_CAT = p.ID_CAT)
LEFT JOIN xxx_gallery_log_mark_view AS v ON ' at line 4
File: /home2/xxx/public_html/forum/Sources/SPortal2.php(3145) : eval()'d code
Line: 12

W

Title: Re: Admin Dashboard - everything you need ;)
Post by: Daydreamer on May 09, 2009, 06:25:54 PM
Actually block is very long. Can give code to center block ?
Title: Re: Admin Dashboard - everything you need ;)
Post by: Blue on May 09, 2009, 08:06:27 PM
Actually block is very long. Can give code to center block ?

Yes, i can, but what do you mean by center block?

Will,

Try this one:
Code: [Select]
<?php
global $smcFunc$user_info$scripturl;

$dbresult $smcFunc['db_query'](''"
      SELECT
         COUNT(*) as total
      FROM {db_prefix}gallery_pic as p
      LEFT JOIN {db_prefix}gallery_log_mark_view AS v ON (p.ID_PICTURE = v.ID_PICTURE AND v.ID_MEMBER = " 
$user_info['id']  . " AND v.user_id_cat = p.user_id_cat)
      LEFT JOIN {db_prefix}members AS m ON (p.ID_MEMBER = m.ID_MEMBER)
      LEFT JOIN {db_prefix}gallery_usersettings AS s ON (s.ID_MEMBER = m.ID_MEMBER)
      
      WHERE v.ID_PICTURE IS NULL AND (s.private =0 || s.private IS NULL ) AND (c.view IS NULL || c.view = 1 ) AND  p.approved = 1 GROUP by p.ID_PICTURE "
);
   
$row $smcFunc['db_fetch_assoc']($dbresult);
   
$total $row['total'];
   
$smcFunc['db_free_result']($dbresult);

echo

<div class="smalltext"><a href="' 
$scripturl '?action=gallery;sa=unviewed">Unviewed Pics: [' $total .']</a></div>'
?>
Title: Re: Admin Dashboard - everything you need ;)
Post by: Daydreamer on May 10, 2009, 12:52:04 AM
Center block (like articles or board news block top or bottom).
If you don't undestand look attachment
Title: Re: Admin Dashboard - everything you need ;)
Post by: Blue on May 10, 2009, 09:04:41 AM
Ah! Now i understand :)

I'll do that tonight. When its done it'll be posted ;)
Title: Re: Admin Dashboard - everything you need ;)
Post by: MUSTAFAINE on May 18, 2009, 09:57:05 AM
how we can do for only admins, because you know everyone can see know
Title: Re: Admin Dashboard - everything you need ;)
Post by: ccbtimewiz on May 18, 2009, 10:25:55 AM
Adjust the block's permissions?
Title: Re: Admin Dashboard - everything you need ;)
Post by: ディン1031 on May 18, 2009, 10:32:51 AM
Yes give to no groups permissions, than only the admin can see it *g*.
Title: Re: Admin Dashboard - everything you need ;)
Post by: MultiformeIngegno on November 12, 2009, 10:49:13 AM
Does this work with SP 2.3.1? Has someone tried it? :)
Title: Re: Admin Dashboard - everything you need ;)
Post by: Dermot on November 30, 2009, 04:15:07 PM

I have it working fine in Simple portal 2.3.1 with smf 2.0 RC2
Title: Re: Admin Dashboard - everything you need ;)
Post by: esem on March 26, 2010, 06:08:34 AM
Is there an opportunity to add to the box set Aeva Media ?
Title: Re: Admin Dashboard - everything you need ;)
Post by: kcmartz on April 16, 2010, 07:41:41 PM
Good work! But I like admin panel, a little more secure!
Title: Re: Admin Dashboard - everything you need ;)
Post by: Dermot on April 18, 2010, 11:04:00 AM

Maybe simpledesk options also would be useful

http://www.simpledesk.net

 :)
Title: Re: Admin Dashboard - everything you need ;)
Post by: bahgheera on June 14, 2010, 11:48:46 AM
Is there a way to make this work with the Simpleportal article system, instead of the Articles plugin? It would be perfect for me if this were the case.
Title: Re: Admin Dashboard - everything you need ;)
Post by: MissyNL on January 19, 2011, 03:40:21 PM
wow! this block is very nice!

What if i only want is the mod reports area , the SP add article section, AEVA Gallery and what i have not seen yet..  the members who are waiting for approval...

How do i this?
Title: Re: Admin Dashboard - everything you need ;)
Post by: S@ffz on June 22, 2011, 07:07:25 PM
Thanks this mod has been god send cheers  :D
Title: Re: Admin Dashboard - everything you need ;)
Post by: S@ffz on June 28, 2011, 10:22:08 PM
Would if be possible to create a block for the Aeva Media Gallery (http://custom.simplemachines.org/mods/index.php?mod=977).  With the same admin features as the smg gallery block you created?
(http://img21.imageshack.us/img21/4646/smggallery.png)

I am using latest version of simple portal and 2.0 SMF
Title: Re: Admin Dashboard - everything you need ;)
Post by: Blue on June 29, 2011, 08:51:52 AM
Now I'm a Joomla user but let me install SMF and see what I can do ;)
Title: Re: Admin Dashboard - everything you need ;)
Post by: S@ffz on June 29, 2011, 10:48:40 AM
Thank you i really appreciate this  :D
Title: Re: Admin Dashboard - everything you need ;)
Post by: Blue on June 29, 2011, 01:07:37 PM
It's done. Tell me if it works and if you like it :)

Code: [Select]
// 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>';
}
Title: Re: Admin Dashboard - everything you need ;)
Post by: S@ffz on June 29, 2011, 05:35:54 PM
It works perfect Thank you so much  :D and i love it many thanks
(http://i48.photobucket.com/albums/f239/saffronuk/Gifs%20and%20pictures/ththThankYouKissTex.gif)
Title: Re: Admin Dashboard - everything you need ;)
Post by: Blue on June 29, 2011, 08:46:01 PM
I'm glad you like it :D
Title: Re: Admin Dashboard - everything you need ;)
Post by: S@ffz on July 19, 2011, 02:38:29 PM
Blue my activation block isn't working its not displaying the accounts waiting to be activated :(
i had 5 people waiting for activation only for me checking through smf acp i wouldn't have noticed
can you help please.  attched are mods i have installed along with sp 2.3.3 and SMF 2.0


Title: Re: Admin Dashboard - everything you need ;)
Post by: Blue on July 19, 2011, 03:56:01 PM
Here, add this to the end of the Admin Dashboard block:

Code: [Select]
//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>';
Title: Re: Admin Dashboard - everything you need ;)
Post by: S@ffz on July 19, 2011, 05:54:53 PM
thanks blue works like a charm
Title: Re: Admin Dashboard - everything you need ;)
Post by: Blue on July 19, 2011, 06:53:21 PM
Glad I could help :)
Title: Re: Admin Dashboard - everything you need ;)
Post by: doughboy99 on July 20, 2011, 04:23:35 AM
Is it possible to show Members requiring approval as well as those requiring activation?
Title: Re: Admin Dashboard - everything you need ;)
Post by: agent47 on October 26, 2011, 07:48:21 PM
This is just plain sexy! Blue you rule mate.... You simply rule!
Title: Re: Admin Dashboard - everything you need ;)
Post by: Blue on October 26, 2011, 09:11:58 PM
This is just plain sexy! Blue you rule mate.... You simply rule!

Thanks :D
Title: Re: Admin Dashboard - everything you need ;)
Post by: TLone on March 04, 2012, 01:06:28 PM
Blue,  not sure if you're still following this.

Would it be possible to have a block with only: "Members Waiting Approval" for SMF 2.0.2 SimplePortal 2.3.4

thank yous
Title: Re: Admin Dashboard - everything you need ;)
Post by: [SiNaN] on March 07, 2012, 10:05:32 AM
Here I gave the instructions for adding that information to the user info block:

http://simpleportal.net/index.php?topic=10677.msg55269#msg55269

$context['unapproved_members'] index will have the number of members awaiting approval. So you could have this in a Custom PHP block:

Code: [Select]
global $context;

echo 'Unapproved Members:', $context['unapproved_members'];
Title: Re: Admin Dashboard - everything you need ;)
Post by: TLone on March 07, 2012, 11:31:33 AM
Nothing short of a small miracle! Thank you sooooo much SiNaN!
Title: Re: Admin Dashboard - everything you need ;)
Post by: player.samp on June 21, 2014, 07:58:16 PM
Both the members to approve block and configuration block which can be found in the first post, give me this message when I try to add the block:

"Database error in block code. Please check the code."

And when I click on preview it seems to be working. The forum is SMF 2.0.6 and if I am not wrong, the simpleportal is 2.3.5.