Tagged: 

Viewing 1 reply thread
  • Author
    Posts
    • #3563

      Hi all,
      I’m working on a project that requires license validation. Using a custom callback, I’ve got the validation working, and the message appears when the validation fails, but I’d like to get an “upgrade” formatted message to appear when the validation is successful.

      Any thoughts

      Michael

    • #3568
      Steve
      Keymaster

      @michaellautman– This is an interesting idea. We will think about putting it in future versions of Piklist.

      For now, you can just use some standard WordPress code and the Piklist admin-notice partial.

      Add this to your main plugin file or your theme’s functions.php. This does not go in the field file.

      function my_validation_success()
      {
       if (isset($_GET['message']))
       {
          $field_to_validate = get_post_meta(get_the_id(), 'YOUR-FIELD-NAME', true);
      
          if(!empty($field_to_validate))
          {
            piklist('shared/admin-notice', array(
              'type' => 'updated'
              ,'notices' => 'License validation successful'
            ));
          }
        }
      }
      add_action('admin_notices', 'my_validation_success');
      

      I’m using $_GET[‘message’] to determine if the post is updated, but you can probably find a better way.

      Let me know if this works for you.

Viewing 1 reply thread
  • You must be logged in to reply to this topic.