Fork me on GitHub

Newest EZcomments?  Bottom

Go to page [-1] 1 - 2:

  • Petzi, you missed two replacements in that cvs file. Do a "search and replace" (case sensitive) and replace Downloads with UpDownload. Line 589 is an example.
  • Also, since im trying to replace the poor comment system of the updownload module with ezcoments (which is going very well). Im also needing to find a way to get a comment count for that particular download. I tried using the code below, but instead I just got a total of all ezcomments:

    Code

    // EZComments counter
            if (pnModAvailable('EZComments')) {
                pnModAPILoad('EZComments', 'user');
                $EZComments = pnModAPIFunc('EZComments',
                                   'user',
                                   'getall',
                                   array('modname'=>'UpDownload',
                                         'objectid'=>$row['lid']));
              $row['comments'] = count($EZComments);
            }

            $totalcomments = $row['comments'];

            if (pnModGetVar('UpDownload', 'allowcomments')==1) {
                if ($totalcomments != 0) {
                    echo " | <a href=\"".$GLOBALS['modurl']."&amp;req=viewdownloaddetails&amp;lid=$lid\">"._COMMENTS." (".(int)$totalcomments.")</a>";
                }
            }


    Any ideas?
  • If you are using the latest ( 0.8 CVS) version of EZComments you can simplify your code a lot calling

    Code

    $totalcomments = pnModAPIFunc('EZComments',
                                   'user',
                                   'count',
                                   array('module'=>'UpDownload',
                                         'objectid'=>$row['lid']));

    For your code I don't see clearly why you are putting the result in $row[comments] then in $totalcomments why not directly in $totalcomments ?
    Also your test if (pnModGetVar('UpDownload', 'allowcomments')==1) { will not work because you must disable the UpDownload comments to use EZComments.
    Update As Chesnut pointed out the above code had a bug (modname and it should have been module) so just for other browsing this thread I corrected my code wich is now correct

    --
    Visit my live reef aquarium.

    My Amazon wish list.
  • why would i HAVE TO disable them? they should work independintly. Anyway, i am only using the allowcomments part as a settting for turning them on or off. I have already removed most of the commenting system from the module already. Its already been hacked up to show only what i want, etc. Just need the comment count for EZComments and i should be set.
  • Here is my new code. But unfortunately i now get zero comments for the results, even though they might have 4 or so.

    Code

    //Links
            // EZComments counter
            $totalcomments = pnModAPIFunc('EZComments',
                                   'user',
                                   'count',
                                   array('modname'=>'UpDownload',
                                         'objectid'=>$row['lid']));

                    echo "<a href=\"".$GLOBALS['modurl']."&amp;req=viewdownloaddetails&amp;lid=$lid\">"._COMMENTS." (".(int)$totalcomments.")</a>";
  • Nono, wrong direction, your first way was right.
    Try out this

    Code

    //Links
         
          // EZComments counter
          $row['lid'] = $lid
          $totalcomments = pnModAPIFunc('EZComments',
                                   'user',
                                   'getall',
                                   array('modname'=>'UpDownload',
                                         'objectid'=>$row['lid']));

                    echo "<a href=\"".$GLOBALS['modurl']."&amp;req=viewdownloaddetails&amp;lid=$lid\">"._COMMENTS." (".(int)$totalcomments.")</a>";


    Regards Petzi

    PS: I know this is an old module but I hope I have turned it as far as possible to pnrender for easier working.

    --
    Petzi-Juist :: ... welcome to my digital world ...
  • Why would you use getall now that there is a count function in EZComments userapi ???? I don't see your point here Petzi-Juist, your code is good for the old EZComments .2 or .3 but mine is better for .8. Always use API function when you can !!!

    --
    Visit my live reef aquarium.

    My Amazon wish list.
  • Sorry, was the only way I find in a few minutes, then UpDownload is converted to pnRender this function can be a good plugin.

    Regards

    --
    Petzi-Juist :: ... welcome to my digital world ...
  • Petzi's code worked a little better. Now it shows that there is one comment for downloads that have comments and zero for ones that dont. Just doesnt show the correct amount of posts. The one that is said had one actually had 3 comments. Any ideas? API or not, i just want it working. Thanks for all your help.
  • Jmv method is better but Mac, your total shows 1 or 0 because the getall returns an array...

    Do a

    Code

    $total = count($totalcomments);


    To have a real valid number......

    Your error in your count call is that the argument is not modname, it's module

    Code

    * @param     $args['module']    Name of the module to get comments for
     * @param     $args['objectid']  ID of the item to get comments for
  • Chestnut



    Code

    $total = count($totalcomments);




    Thanks, thats exactly what i needed. Woo hoo!
  • I still suggest you use the count function though

    Code

    $totalcomments = pnModAPIFunc('EZComments',
                                        'user',
                                        'count',
                                        array('module'   => 'UpDownload',
                                              'objectid' => $row['lid']));


    Your error was there :

    Code

    array('module'   =>'UpDownload', // not modname
  • Franky,
    as always you are right, I guess a lot of PostNuke devs did that mistake (and if I remember well I already did it several times !!)

    --
    Visit my live reef aquarium.

    My Amazon wish list.
  • Bah......... sometimes I do things right... icon_lol

Go to page [-1] 1 - 2:

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