• Resolved MacBlaue

    (@macblaue)


    I am writing a plugin that has a form, receives and writes data to a custom database table and sends an email.
    In my form I use <input type="hidden" name="action" value="peoples_choice_vote"> and my function is called like this

    if ( is_this_user_logged_in() ) {
        add_action('admin_post_peoples_choice_vote', 'handle_peoples_choice_vote');
    } else {
        add_action('admin_post_nopriv_peoples_choice_vote', 'handle_peoples_choice_vote');
    }

    This code works fine in functions.php when I move it to the plugin and activate it fails, and when I submit the form I get a white screen at admin-post.php, no data is written and the email is not sent.

Viewing 2 replies - 1 through 2 (of 2 total)
  • maybe you can learning again about wordpress plugins dude. in some case, there is somethink difference beetwin theme function and plugins.

    Thread Starter MacBlaue

    (@macblaue)

    is_this_user_logged_in() is part of pluggable.php which fires after the plugin loads, hence the problem. I removed the if statement and load both actions et voilà.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Access _POST data in plugin’ is closed to new replies.