Jump to content

Search the Community

Showing results for tags 'saveReady'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to ProcessWire
    • News & Announcements
    • Showcase
    • Wishlist & Roadmap
  • Community Support
    • Getting Started
    • Tutorials
    • FAQs
    • General Support
    • API & Templates
    • Modules/Plugins
    • Themes and Profiles
    • Multi-Language Support
    • Security
    • Jobs
  • Off Topic
    • Pub
    • Dev Talk

Product Groups

  • Form Builder
  • ProFields
  • ProCache
  • ProMailer
  • Login Register Pro
  • ProDrafts
  • ListerPro
  • ProDevTools
  • Likes
  • Custom Development

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

Found 1 result

  1. Hi. I am hooking into the saveReady hook in order to update data on other pages, when a page is published. In other words, when a transaction is published, the user is updated. Certain fields are reset on Publish for some reason. It's only on publish, so if I insert data into input fields again and press save, then it works. So i have added this bit of code to the admin.php file in my template. $page->addHook( 'Pages::saveReady', null, 'credit_published' ); function credit_published( $event ) { $page = $event->arguments[0]; if( $page->template == "credit-log" && $page->id && !$page->isTrash() && $page->isChanged( 'status' ) && !$page->is( Page::statusUnpublished ) && $page->credit_action->id === 3 ) { // Add credit to user. $partner = $page->partner; $partner->of( false ); $partner->credit = intval( $partner->credit + $page->credit ); $partner->save(); } }
×
×
  • Create New...