Skip to content

Commit

Permalink
Merge pull request #37 from OnTheGoSystems/master
Browse files Browse the repository at this point in the history
Prevent duplicate notices
  • Loading branch information
boblinthorst authored Jun 27, 2017
2 parents 192a294 + e28c596 commit e209514
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/presenters/Whip_WPMessagePresenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,18 @@ class Whip_WPMessagePresenter implements Whip_MessagePresenter {
*/
public function __construct( Whip_Message $message ) {
$this->message = $message;
}
}

/**
/**
* Registers hooks to WordPress. This is a separate function so you can
* control when the hooks are registered.
*/
public function register_hooks() {
add_action( 'admin_notices', array( $this, 'renderMessage' ) );
global $whip_admin_notices_added;
if ( null === $whip_admin_notices_added || ! $whip_admin_notices_added ) {
add_action( 'admin_notices', array( $this, 'renderMessage' ) );
$whip_admin_notices_added = true;
}
}

/**
Expand Down

0 comments on commit e209514

Please sign in to comment.