Fork me on GitHub
Current releases are 2.1.4 (30 Oct 2014) and 2.0.18.13 (5 Aug 2014)

Ready for 2.1? Find out if your plugins are compatible. 2.0 will no longer be updated after Dec 2014.

show the comment box only on last page of discussion

fh111fh111 Vanilla Padawan ✭✭
edited May 2012 in Vanilla 2.0 Help

how would it work?

i am in /views/discussion/index.php and i guess i could put a && condition in there checking if on last page. i just don't get it enough yet to know what to put

} else if ($Session->IsValid() && $Session->CheckPermission('Vanilla.Comments.Add', TRUE, 'Category', $this->Discussion->PermissionCategoryID)) {
   echo $this->FetchView('comment', 'post');

any help appreciated, thanks

Answers

  • peregrineperegrine ☯ hasta luego :) In-Flight MVP
    edited May 2012

    look in vanilla/applications/dashboard/modules/classpagermodule.php for guidance if you

    if ($PagerOptions["RecordCount"] >  $PagerOptions["CurrentRecords"])
      // probably means you are on the lastpage.
    

    there is also a function if you can figure out how to access it.

      /**
        * Whether or not this is the last page of the pager.
        *
        * @return bool True if this is the last page.
        */
       public function LastPage() {
          return $this->Offset + $this->Limit >= $this->TotalRecords;
       }
    

    someone with more knowledge could probably tell you more ..

    Monetary Donations will be appreciated if you use my plugins. Thanks in Advance.
    As a waiter gets a tip for a good meal, tips for successful solutions appreciated as well. Peregrine

    fh111
  • fh111fh111 Vanilla Padawan ✭✭

    interesting, thanks! i'll take a look at this when i have a minute

Sign In or Register to comment.