Forum Replies Created

  • Having the same issue. Repeater within a flex field and <?php count( get_sub_field('repeater_field') ); ?> always returns 1

    Anyone get past this?

  • ACF support gave me the following solution which worked for me.

    $rows = get_sub_field('sub_field_of_repeater');
    if( have_rows('sub_field_of_repeater') ):
    $count = count($rows);
  • Also getting a little confused on this point

  • The plugin below adds some great rating fields but is not yet working with acf pro

    However the author has said this is the plugin that will be included with acf pro soon, or that is what the author has said elliot has said.

  • I am using acf5 beta. The form is displaying on the front end fine, submits and then calls my php script with the acf save function in it.

    The php script called by the form action has the correct array within $_POST so the values are available, just not sure why acf is not saving them.

    1. The form

    <?php get_template_part('templates/wrapper-header'); ?>
    	When the form is submitted we call this file to deal with it's submission
    	Below we have a function and then a condition to call the function. The conditional is $_POST['submit'] so the function is only called if the form is submitted
    	// Get the current user 1
    	$userID = get_current_user_id();
    	<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
            <h1 class="editor editor-title"><?php the_title(); ?></h1>
            <div class="editor editor-content"><?php the_content(); ?></div><!-- end editor -->
            <form method="post" action="<?php echo get_template_directory_uri(); ?>/frontend-form-acf-siteaddresses.php">
                    'field_groups' => array('1632'), // the ID of the field group (group not field name or key, the entire field group)
    				'post_id' => 'user_'.$userID, // To populate the front end form fields with saved data
                    'form' => false // Don't load the full acf form, just load the fields into my html form
                <input type="hidden" name="function" value="ttm_frontend_form_acf_siteaddresses">
            	<input type="submit" value="Submit">
        <?php endwhile; ?>
    <?php get_template_part('templates/wrapper-footer');

    2. The php script called by the form (this is called correctly and the $_POST variable contains all of the submitted fields)

    <?php require_once($_SERVER['DOCUMENT_ROOT'].'/wp-load.php'); ?>
    $userID = get_current_user_id();
    // $post_id to save against
    $postID = 'user_' . $userID;
    //echo '<pre>';
    //echo '</pre>';
    // update the post
    do_action('acf/save_post', $postID);

    Any ideas?


  • Yes I agree. This is one of the few acf additions that wouldn’t just be adding a cool new feature but fixing a palpable usbility flaw.

  • I also could really use these options.

    It would be outstanding to, at some point in the future…

    1. Be able to make fields read only and do this based on current users role. Allowing admins to update a field and other roles just to view the field for example

    2. Hide fields based on user role. Same as above but hiding a field.

    For now would a cheap trick for hiding fields be to set conditional logic to an impossible combination on that field? So say show only if a select field which only allows selection of a single value is both option a and option b. This obviously only works if your form has a select field, though if you are hiding many fields might be worth adding a select field specifically for the job and hiding just that select field with css. Not tested this idea.

  • Yeah fix does the trick. Interesting question about 4.1.8 and in 4.2

    Thanks tomsel

  • Don’t know for sure, but possibly, thanks elliot, will give it a shot!

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