Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8845825
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T11:49:34+00:00 2026-06-14T11:49:34+00:00

Is anyone able to tell me how to write a function that can intercept

  • 0

Is anyone able to tell me how to write a function that can intercept the publish command on silverstripe? I want to implement a system where whenever a page change is about to occur, a HTTP call to another system is sent, that will inform the administrator that a page has been changed. I want the system to wait a few minutes then, giving the administrator time to remove the change if it wasn’t authorised.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T11:49:36+00:00Added an answer on June 14, 2026 at 11:49 am

    There’s various event hooks in the SiteTree class which you can use for this purpose.

    class MySiteTreeExtension extends DataExtension {
        function onAfterPublish() {
            $this->notifyMyAdmin(sprintf('Page "%s" has been published', $this->owner->Title));
        }
    }
    

    Apply the extension with the following addition to your mysite/_config.php:

    Object::add_extension('SiteTree', 'MySiteTreeExtension');
    

    You’ll obviously need to implement the notifyMyAdmin() method to make that HTTP call.
    In general, I would advise against doing synchronous HTTP calls on user actions though,
    since they make your system dependent on the availability of another one. Consider using something like the messagequeue module instead. In terms of “wait a few minutes with publication”: Its not possible to “veto” publications through the extension system.
    You could overwrite SiteTree->doPublish() in your subclass for this purpose, but it would still be a bit of a weird UI pattern for the user. Workflow module plus “Request Publication” plus some cron job to auto-approve them would be more straightforward.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is anyone able to point me to a resource that can tell me how
Can anyone please tell me how to write NSMutableArray of custom class objects to
I want to write an android application that can parse files. I have figured
Would anyone be able to tell me how to pull the server name out
Would anyone be able to tell me what I'm doing wrong in the following
Would anyone please be able to tell me the most efficient way to compare
Has anyone been able to implement a scrollable table in HTML where the TOP
I want to write some programs using Java comm api. I am not able
I want to write a background program that will monitor the _changes feed of
I want to be able to write directly to a character device. Here's what

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.