Forum Replies Created

Viewing 11 replies - 1 through 11 (of 11 total)
  • Thread Starter brad3260

    (@brad3260)

    I figured out that if I did my processing in the init action, I had access to the POST variables

    • This reply was modified 6 years, 4 months ago by brad3260.
    Thread Starter brad3260

    (@brad3260)

    Well, turns out my code was working, I had an SQL issue. Sorry about that but thank you everybody for the assistance!

    Thread Starter brad3260

    (@brad3260)

    Thank you everyone for the suggestions, I’m still unable to get it to work so I’m thinking I am going to try javascript. I know I would need a js function that looks something like the following

    function setcookie(accid) {
    //code
    }

    However, how would I get the values from my PHP into the function call?

    Thread Starter brad3260

    (@brad3260)

    No echo or print statements or any lines that send anything to the browser

    Thread Starter brad3260

    (@brad3260)

    What do you mean by external domain? I’m setting the cookie for the same domain that the code is running. I’ve even tried omitting the domain and path.

    Thread Starter brad3260

    (@brad3260)

    You guys rock! That works, thank you so much for the help!

    Thread Starter brad3260

    (@brad3260)

    Problem with that is, the category would be added every time a page is loaded. I was to give the user a couple of default categories that they can keep, edit or delete if they want. I’m starting to think the easiest way to do this is to have a “first time activated” flag that once the plugin is activated, the flag gets set to false. Then in have the plugin check that flag, if true, insert categories, and if false, don’t. I was just trying not to have that if statement run every time, seems like a waste.

    Thread Starter brad3260

    (@brad3260)

    I was mistaken, I am getting both e-mails but the category is not being added.

    Thread Starter brad3260

    (@brad3260)

    Ah that makes sense. I have the following code.

    function bbradley_rfp_activation() {
    	$my_cat = array('cat_ID' => 0, 'cat_name' => 'My Category', 'category_description' => 'A Cool Category', 'category_nicename' => 'category-slug', 'taxonomy' => 'Services');
    $bbt = wp_insert_category($my_cat);
    mail($myemail, 'sub', 'post fired');
    }
    
    register_activation_hook( __FILE__, 'bbradley_rfp_activation_pre');
    function bbradley_rfp_activation_pre() {
    	add_action('activated_plugin', 'bbradley_rfp_activation');
    	mail($myemail, 'sub', 'pre fired');
    }

    I get the “pre fired” e-mail but I don’t get the “post fired” e-mail so it seems the “activated_plugin”action is not getting triggered?

    Thread Starter brad3260

    (@brad3260)

    Hello, thank you for the suggestion. Unfortunately there is very little documentation to this action so I’m hoping you can help me a little more. I replaced the register_activation_hook line with
    do_action('activated_plugin', array(__FILE__, 'bbradley_rfp_activation'));
    but the function doesn’t get triggered?

    Thread Starter brad3260

    (@brad3260)

    It is but it’s not working, any ideas why?

Viewing 11 replies - 1 through 11 (of 11 total)