Author Topic: SDMON Feature request & issue  (Read 5254 times)

kakenbok

  • Guest
SDMON Feature request & issue
« on: June 21, 2011, 09:35:10 AM »
Hello pepak,

please provide an action hook to enable custom download error messages/screens.
For version 0.21 I have added a single line of code here:

Code: [Select]
protected function ErrorMessage($code, $message, $shortmessage)
{
    // added
    do_action('sdmon_download_error');  
   
    $code = intval($code);
    ...

pepak

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 956
    • View Profile
    • Pepak.net
SDMON Feature request & issue
« Reply #1 on: June 21, 2011, 09:48:51 AM »
OK, will do.

Is there a way to pass the arguments ($code, $message, $shortmessage) to the action hook?

kakenbok

  • Guest
SDMON Feature request & issue
« Reply #2 on: June 21, 2011, 09:59:39 AM »

kakenbok

  • Guest
SDMON Feature request & issue
« Reply #3 on: June 21, 2011, 10:03:28 AM »
I forgot the issue:

It is currently not possible to deselect an item that is hidden from the widget.
The reason is that your condition expects both the hide ids and the show ids.
In the case of a complete deselection the hide ids won't be available.

fix1 (exclusive condition):

Code: [Select]
public function ToolsPanel()
{
    ...
    if ($this->IsAdmin())
    {
        if (isset($_POST['SimpleDownloadMonitor_Update']) && (isset($_POST['SimpleDownloadMonitor_HideIds']) && is_array($_POST['SimpleDownloadMonitor_HideIds']) || isset($_POST['SimpleDownloadMonitor_ShowIds']) && is_array($_POST['SimpleDownloadMonitor_ShowIds'])))
        {
            $this->HideDownloads($_POST['SimpleDownloadMonitor_ShowIds'], $_POST['SimpleDownloadMonitor_HideIds']);
        }
        if (isset($_POST['SimpleDownloadMonitor_Delete']) && isset($_POST['SimpleDownloadMonitor_DeleteIds']) && is_array($_POST['SimpleDownloadMonitor_DeleteIds']))
        ...

and fix2 (test the lists separately):

Code: [Select]
protected function HideDownloads($show_ids, $hide_ids = array())
{
    global $wpdb;
    $downloads = $this->table_downloads();
    if ($show_ids)
    {
        $show_ids = implode(',', array_map('intval', $show_ids));
        $sql = "UPDATE ${downloads} SET hide_from_sidebar=0, last_date=last_date WHERE id IN (${show_ids})";
        // The last_date is used to prevent automatic update to current_timestamp
        $wpdb->query($sql);
                    }
    if ($hide_ids)
    {
        $hide_ids = implode(',', array_map('intval', $hide_ids));
        $sql = "UPDATE ${downloads} SET hide_from_sidebar=1, last_date=last_date WHERE id IN (${hide_ids})";
        // The last_date is used to prevent automatic update to current_timestamp
        $wpdb->query($sql);
    }
    //wp_redirect($_SERVER['REQUEST_URI']);
    //die();
}

pepak

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 956
    • View Profile
    • Pepak.net
SDMON Feature request & issue
« Reply #4 on: June 21, 2011, 10:37:01 AM »
OK, will check this out as well.

 

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Note: this post will not display until it's been approved by a moderator.
Name: Email:
Verification:
This box must be left blank:

Type the letters shown in the picture
Listen to the letters / Request another image
Type the letters shown in the picture: