Update programatically
-
I’m trying to update the meta field automatically when a user registers. I also have a category being created automatically on registration. It looks something like this:
function my_pmpro_after_checkout($user_id) { //create new category for this level $term = wp_insert_term( $level_name, //level name is still their username 'category', array( 'description' => 'PMPro Category', 'slug' => sanitize_title($level_name) ) ); $term_id = $term['term_id']; if(empty($term_id)) return false; //there was an error adding the category //Restrict columnist to category update_user_meta( $user_id, '_access', $level_name); } add_action('user_register','my_pmpro_after_checkout');
The meta is saving to the user, but it will not update in the dropdown menu. Any ideas?
I’ve also tried
update_user_meta( $user_id, '_access', $level_name, $_POST['allow']);
and
update_user_meta( $user_id, '_access', $_POST['allow'], get_user_meta( $user_id, $level_name, true ) );
Any help would be greatly appreciated.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Update programatically’ is closed to new replies.