Support

Account

Forum Replies Created

  • What do you think about it?

    $args = array(
    'post_id' => 'user_'.$current_user->ID,
    'field_groups' => array( 1152 ),
    //'fields' => array('test_semplice_'. $author_id2 ,'gruppo_test_'. $author_id2, 'field_5e93382ad5331', 'field_5e933c0c66134'),
    'updated_message' => 'Stato attività aggiornato',
    );
    acf_form( $args );
  • Some more information

    I want to set a flag, so a user will know which post he has read and which he has not read.

    Perhaps the best solution for me is to associate this flag for each user id and store everything in the post object. Is it possibile?

  • Fixed. For past posts, the value is passed by this bulk action.

    add_filter( 'bulk_actions-edit-post', 'register_my_bulk_actions2' );
     function register_my_bulk_actions2($post_ids) {
        global $wpdb;
          $users = $wpdb->get_results( "SELECT user_id FROM $wpdb->usermeta WHERE meta_key = 'genere'AND meta_value = 'Maschio' " );
        foreach ( $users as $a ) {
            $author_ids[] = $a->user_id;
        }
    
       $args = array( 'posts_per_page' => -1 ,  'author__in' =>  $author_ids, );
       $myposts = get_posts( $args );
       foreach( $myposts as $post ) :
         $numero = $post->ID;
         update_post_meta( $numero, 'genere', 'Maschio' );
       endforeach; 
      }
Viewing 3 posts - 1 through 3 (of 3 total)