- This topic has 1 reply, 2 voices, and was last updated 6 years, 10 months ago by .
Viewing 1 reply thread
Viewing 1 reply thread
- You must be logged in to reply to this topic.
Support Home » Topics » Piklist » Successful Validation Messages
Tagged: validation
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
@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.