Jump to content

majkiris

Members
  • Posts

    6
  • Joined

  • Last visited

About majkiris

  • Birthday December 28

Profile Information

  • Gender
    Male
  • Location
    Slovakia

Recent Profile Visitors

1,553 profile views

majkiris's Achievements

Newbie

Newbie (2/6)

3

Reputation

  1. Thank you teppo. I know it is a page. I was making one mistake, instead of $page->view_groups or $page->edit_groups i used $page->user_groups and that's the reason why it didn't work. Thak you again. Next time a will look at the template fields better
  2. Hi all, I have a form on the site's front end. When the user sends the form, new page is created and i need to add user group and set permisssions for that group (view/edit) for the page, but i don't now how and can't find any API documentation for UserGroups module. Thanks for help.
  3. Thank you adrian! Of course it works. I swear to my life that i did tried that..but it didn't work (maybe i used $page->save($total)). Thank you for the link Ivan. I will dive into it later.
  4. Hi everyone! I need some help with a module that saves sum of integer fields as a hidden field value. There are 3 integer fields in template: rating1, rating2, rating3 and one hidden field: total. Can't figure out, how to save the field value to DB... I tried use $field->set and $fields->save, but all what i get is Call to a member function save() on a non-object error. <?php class TotalRating extends WireData implements Module { /** * @return array */ public static function getModuleInfo() { return array( 'title' => 'Total rating', 'version' => 100, 'summary' => '', 'singular' => true, 'autoload' => true, ); } public function init() { $this->pages->addHookAfter('save', $this, 'total'); } public function total($event) { $page = $event->arguments[0]; if ($page->template == "cat") { $rat1 = $page->rating1; $rat2 = $page->rating2; $rat3 = $page->rating3; $ratTotal = $rat1 + $rat2 + $rat3; //save $ratTotal as "total" field value } } }
×
×
  • Create New...