pnTresmailer Plugin for DownloadsPlus  Bottom

  • I've searched high and low and posted at the official forums but am yet to receive any help. I was wondering if anyone has written a DownloadsPlus plugin for pnTresmailer. I have attempted it but for some reason cannot get any output. I did notice that downloadsplus does not use the postnuke table prefix and was wondering if this might be the problem.

    Any pointers appreciated.

    Cheers,

    Brad
  • After days of pulling my hair out, I finally got mine working through trial, error and a bit of deduction.

    Thanks for all of the err......help.

    Brad
  • Please share with those of us who might find that helpful!
  • Code

    <?php
    // $Id: newsletter_mod_tpl.php,v 1.1.1.1 2002/09/15 22:26:15 root Exp $
    // ----------------------------------------------------------------------
    // POST-NUKE Content Management System
    // Copyright (C) 2002 by the PostNuke Development Team.
    // http://www.postnuke.com/
    // ----------------------------------------------------------------------
    // Based on:
    // PHP-NUKE Web Portal System - http://phpnuke.org/
    // Thatware - http://thatware.org/
    // ----------------------------------------------------------------------
    // LICENSE
    //
    // This program is free software; you can redistribute it and/or
    // modify it under the terms of the GNU General Public License (GPL)
    // as published by the Free Software Foundation; either version 2
    // of the License, or (at your option) any later version.
    //
    // This program is distributed in the hope that it will be useful,
    // but WIthOUT ANY WARRANTY; without even the implied warranty of
    // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    // GNU General Public License for more details.
    //
    // To read the license please visit http://www.gnu.org/copyleft/gpl.html
    // ----------------------------------------------------------------------
    // Original Author of file: foyleman
    // Purpose of file:  Downloads Module for pnTresMailer
    // ----------------------------------------------------------------------

    // variable that need to be defined for the system
        $modversion['file_name'] = 'downloadsplus'; // the name of this php file
        $modversion['mod_name'] = 'DownloadsPlus'; // the name of the module you are writing this for
        $modversion['multi_output'] = '1'; // is there a quantity spec, or simply return output 1:true, 0:false
        $modversion['mod_edit'] = '0'; // can this plugin be edited 1:true, 0:false
        $modversion['version'] = '1.0';
        $modversion['function_name'] = 'latest_downloadsplus'; // the name of the function listed below
        $modversion['description'] = 'Latest DownloadsPlus'; // brief description of this module
        $modversion['author'] = 'Brad';
        $modversion['contact'] = 'http://www.harmoniseit.com/';


    // function named as above, in this case the format is for the HTML part of the mailer

    function latest_downloadsplus_html($mod_id, $nl_url, $ModName) {
        $prefix = pnConfigGetVar('prefix');

        $language = pnConfigGetVar('language');

    // name the lang file the same as this file
        include("modules/$ModName/modules/lang/$language/downloadsplus.php");

    // get the module setting from the database
        $modsql = mysql_query("SELECT mod_qty, mod_data FROM $prefix"._nl_modules." WHERE mod_id = '$mod_id'");
        list($mod_qty, $mod_data) = mysql_fetch_row($modsql);

    // clear the output variable
    // title of the page to show up
        $output = "<b>"._LATESTDOWNLOADSPLUS.":</b><br><br>\n";

    // query the database and generate your output in the amount of mod_qty
        $sql = mysql_query("SELECT dp_lid, dp_title, dp_description, dp_filesize FROM downloadsplus_downloads ORDER BY dp_date DESC limit 0,$mod_qty");
        while(list($dp_lid, $dp_title, $dp_description, $dp_filesize) = mysql_fetch_row($sql)) {
            $output .= "<a href=\"$nl_url/modules.php?op=modload&name=DownloadsPlus&file=index&req=viewdownloaddetails&lid=$dp_lid&ttitle=$dp_title\" target=\"_blank\"><b>$dp_title</b></a><br>\n";
            $output .= "$dp_description<br>\n";
            $output .= ""._FILESIZE.": $dp_filesize "._BYTES."<br><br>\n";
            }

    // strip the slashes out all at once
        $output = stripslashes($output);

    // send the output to the system (it must be output and not another variable name)
        return $output;
    }


    // function named as above, in this case the format is for the TEXT part of the mailer

    function latest_downloadsplus_text($mod_id, $nl_url, $ModName) {
        $prefix = pnConfigGetVar('prefix');

        $language = pnConfigGetVar('language');

    // name the lang file the same as this file
        include("modules/$ModName/modules/lang/$language/downloadsplus.php");

    // get the module setting from the database
        $modsql = mysql_query("SELECT mod_qty, mod_data FROM $prefix"._nl_modules." WHERE mod_id = '$mod_id'");
        list($mod_qty, $mod_data) = mysql_fetch_row($modsql);

    // clear the output variable
    // title of the page to show up
        $output = ""._LATESTDOWNLOADSPLUS.":\n\n";

    // query the database and generate your output in the amount of mod_qty
        $sql = mysql_query("SELECT dp_lid, dp_title, dp_description, dp_filesize FROM downloadsplus_downloads ORDER BY dp_date DESC limit 0,$mod_qty");
        while(list($dp_lid, $dp_title, $dp_description, $dp_filesize) = mysql_fetch_row($sql)) {
            $output .= "$dp_title\n";
            $output .= "$dp_description\n";
            $output .= "$nl_url/modules.php?op=modload&name=DownloadsPlus&file=index&req=viewdownloaddetails&lid=$dp_lid&ttitle=$dp_title\n";
            $output .= ""._FILESIZE.": $dp_filesize "._BYTES."\n\n";
            }

    // strip the slashes out all at once
        $output = stripslashes($output);

    // send the output to the system (it must be output and not another variable name)
        return $output;
    }

    ?>


    You'll also need to add a lang file too but thats a no brainer. Cheers!

    Now if only the insert would work..

    Brad

This list is based on users active over the last 60 minutes.