Support » Plugin: WP Terms Popup » Call a PHP function from submit

  • Resolved subhamkotnala


    I have a function in functions.php

    function updateHasReadFlag($user) {
      // I added support for using this function either with user ID or user object
      if ( $user && is_int( $user ) ) {
        $user_id = $user;
      } else if ( ! empty( $user->ID ) ) {
        $user_id = $user->ID;
      } else {
      return update_user_meta( $user_id, 'GDPR_TERMS_READ', true );

    Now I want to call this function on click of the Accept button from the GDPR pop up.

    <form method="post">
                <?php if ($isshortcode == 1) : ?>
                <input type="hidden" name="wptp_popup_id" value="<?php echo $termspageid; ?>" />
                <?php endif; ?>
    			<div class="tthebutton">
    				<input class="termsagree" name="wptp_agree" type="submit" value="<?php echo $tagree; ?>" />
    			    <input class="termsdecline" type="button" onclick="window.location.replace('<?php echo $termsRedirectUrl ?>')" value="<?php echo $tdisagree; ?>" />

    How can I do that?

Viewing 1 replies (of 1 total)
  • Plugin Author Link Software LLC


    As I mentioned in a previous thread, this forum is meant for supporting bugs and issues with the plugin and not for PHP tutorials on how to extend its functionality. If WP Terms Popup doesn’t fit your needs you should consider finding another popup solution or creating your own from scratch.

Viewing 1 replies (of 1 total)
  • The topic ‘Call a PHP function from submit’ is closed to new replies.