Support

Account

Forum Replies Created

  • Same thing here with 5.8.1. I just downgraded back to 5.8, and appears to be working again.

  • Newly released beta4 appears to fix this so far.

  • Cleaned up basic customization below. The $_REQUEST['post_id'] is the same as the $post_id provided in the arguments.

    function custom_relationship_query( $args, $field, $post_id ) {
    	$args['tax_query'] = [
    		[
    			'taxonomy' => 'custom_taxonomy_name',
    			'field'    => 'term_id',
    			'terms'    => str_replace( 'term_', '', $post_id ),
    		],
    	];
    	return $args;
    }
    add_filter('acf/fields/relationship/query', 'custom_relationship_query', 10, 3);
  • I take that back. I could not access $_GET. I can access $_REQUEST (or $_POST specifically).

    I get this from $_REQUEST:

    Array
    (
        [paged] => 1
        [taxonomy] => 
        [post_type] => 
        [s] => 
        [max] => 
        [min] => 
        [action] => acf/fields/relationship/query
        [field_key] => field_5a5deb8769362
        [post_id] => term_7
        [nonce] => 5aa22de3aa
    )

    So you can use ‘post_id’ and replace ‘term_’.

    if ( ! empty($_REQUEST['post_id']) ) {
    	$args['tax_query'] = array(
    		array(
    			'terms' => str_replace( 'term_', '', $_REQUEST['post_id'] );
    		),
    	);
    }
  • The queried object isn’t working for me in that AJAX call. Also can’t access the $_REQUEST variables. Looking for a way to dynamically dial in the posts to the current tax as well…

  • I just tested in Twentyseventeen, and it works fine. For me, this is definitely an issue with my theme.

    For me, I had deregistered jQuery since my theme does need it. That was breaking ACF.

  • I just tested in Twentyseventeen, and it works fine. For me, this is definitely an issue with my theme.

    For me, I had deregistered jQuery since my theme does need it. That was breaking ACF.

  • Even with acf_form_head(); properly placed, no ACF JavaScript is loaded on the frontend. Only the styles are loaded.

  • Just to be clear conditional logic works great on the backend. It doesn’t work at all for me when using acf_form() to add a form on the frontend. Everything else works, but the conditional logic doesn’t do anything. All of the fields are shown from the beginning, and when I change a field that should should hide some and show others, it doesn’t have any impact. This seems like an issue for a while now. Not sure what I would be missing in my setup. I have acf_form_head() above get_header().

    None of the ACF JavaScript is loaded on the front end. The styles are, but not the JavaScript.

  • This is a starting point specific to my own personal needs. I haven’t finished my form yet, but this would get you started. Would be good to branch out into validation once the fields are situated.

    You would need to update this with your own data since it has specific fields from $_POST currently. My fields were: first_name, last_name, user_email. The first and last name are already meta values so they work well for editing already, but I had to add support for editing the email address. Creating a new user, the point of this thread, was fully custom.

    Creates a form in your template based on a query variable.

    
    <?php
    if ( ! empty($_GET['user']) ) :
    	$user_id = ( is_numeric($_GET['user']) ? 'user_' . $_GET['user'] : 'new_user' );
    	acf_form([
    		'field_groups' => [ 510 ],
    		'post_id'      => $user_id,
    	]);
    endif;
    ?>
    

    In functions.php

    
    <?php
    /**
     * Add / Edit users
     */
    function trac_load_value_user_email( $value, $post_id, $field ) {
    	if ( false !== strpos($post_id, 'user_') && $user_id = str_replace('user_', '', $post_id) ) {
    		$userdata = get_userdata( $user_id );
    		if ( $userdata ) {
    			$value = $userdata->user_email;
    		}
    	}
        return $value;
    }
    add_filter( 'acf/load_value/name=user_email', 'trac_load_value_user_email', 10, 3 );
    
    function trac_update_userdata( $post_id ) {
    	if ( empty($_POST['acf']) || empty($_POST['acf']['field_599c48218c0ab']) || false === strpos($post_id, 'user') ) { return; }
    
    	$user_email = $_POST['acf']['field_599c48218c0ab'];
    
    	// Create a new user
    	if ( 'new_user' === $post_id ) {
    		// If email already exists, this should be part of validation or at least return an error...
    		if ( email_exists( $user_email ) ) { return false; }
    
    		// Create a password
    		$length = 13;
    		$include_standard_special_chars = false;
    		$random_password = wp_generate_password( $length, $include_standard_special_chars );
    		// Create the user, use email as username
    		$user_id = wp_create_user( $user_email, $random_password, $user_email );
    		// Update name and role
    		wp_update_user([
    			'ID' => $user_id,
    			'first_name' => ( ! empty($_POST['acf']['field_599c479c8c0a9']) ? $_POST['acf']['field_599c479c8c0a9'] : '' ),
    			'last_name' => ( ! empty($_POST['acf']['field_599c480e8c0aa']) ? $_POST['acf']['field_599c480e8c0aa'] : '' ),
    			'role' => 'editor',
    		]);
    	// Edit the user's email
    	} else {
    		$user_id = str_replace('user_', '', $post_id);
    		wp_update_user([
    			'ID' => $user_id,
    			'user_email' => $user_email,
    		]);
    	}
    }
    add_action( 'acf/save_post', 'trac_update_userdata', 1 );
    

    References:

    1. https://codex.wordpress.org/Function_Reference/wp_update_user
    2. https://www.advancedcustomfields.com/resources/create-a-front-end-form/
  • Did you make sure each site is upgraded? I know on some multisites that can be daunting, but, if possible, that is the best thing you can do: Manually update each site individually.

  • The issue, I realized, is that I had some sites that did not get upgraded. Basically. This tool doesn’t work. You just need to:

    1. Ignore it.
    2. Go to each site, individually
    3. Upgrade them from there
    4. It should go away.
  • Yes! I had done this, but I missed one site! I just went back through and updated the one site I found, and now the dialog is gone.

    Thanks for the idea. I do wish that if ACF is going to add this dialog, it would actually work!

  • It isn’t much of a workaround, and just meant to be patch until somebody can figure out why it isn’t working correctly. Currently, it also removes the Custom Fields menu item from child sites, so it isn’t very useable in the end.

    Would love to get this fixed.

  • I will note, that you should remain aware that you turned that off in the future and be ready to turn the plugin off in the future when you want to upgrade or this issue is fixed.

  • I will note, that you should remain aware that you turned that off in the future and be ready to turn the plugin off in the future when you want to upgrade or this issue is fixed.

  • I will be honest. I don’t think this means anything. I think it is just annoying. I already upgraded all of the sites. And I don’t see anything specifically triggering this, so it just seems like this shows up in the latest version for no good reason. I am moving on and forcing it off. Add this somewhere to remove it:

    add_filter( 'acf/settings/show_admin', '__return_false' );

    Plugin to apply to network, change info as needed. I saved it to remove-acf-network-admin-notice.php and uploaded the file to my site’s plugins:

    <?php
    
    /**
     * @wordpress-plugin
     * Plugin Name:       Remove ACF Network Admin Notice
     * Description:       Removes the non-working, seamingly senseless upgrade notice in ACF
     * Version:           1.0.0
     * Author:            Jupitercow
     * Author URI:        http://Jupitercow.com/
     * Contributor:       Jake Snyder
     * License:           GPL-2.0+
     * License URI:       http://www.gnu.org/licenses/gpl-2.0.txt
     * Network:           true
     */
    
    add_filter( 'acf/settings/show_admin', '__return_false' );
  • I will be honest. I don’t think this means anything. I think it is just annoying. I already upgraded all of the sites. And I don’t see anything specifically triggering this, so it just seems like this shows up in the latest version for no good reason. I am moving on and forcing it off. Add this somewhere to remove it:

    add_filter( 'acf/settings/show_admin', '__return_false' );

    Plugin to apply to network, change info as needed. I saved it to remove-acf-network-admin-notice.php and uploaded the file to my site’s plugins:

    <?php
    
    /**
     * @wordpress-plugin
     * Plugin Name:       Remove ACF Network Admin Notice
     * Description:       Removes the non-working, seamingly senseless upgrade notice in ACF
     * Version:           1.0.0
     * Author:            Jupitercow
     * Author URI:        http://Jupitercow.com/
     * Contributor:       Jake Snyder
     * License:           GPL-2.0+
     * License URI:       http://www.gnu.org/licenses/gpl-2.0.txt
     * Network:           true
     */
    
    add_filter( 'acf/settings/show_admin', '__return_false' );
  • I can’t get past this on multisite either. I am a super admin, so that is not he problem. I can update WP core. I can’t get this to work. I also don’t get the update button on sites, only on network admin pages.

  • I am having this same problem. Latest versions as of today. Multisite. I cannot figure out how to fix this…

  • I will say I have upgraded other sites without much trouble at all. So I am not sure what is up with this site. I haven’t done a lot of the development, just a few pieces, so there is some mystery…

    Thanks for the help. Will let you know if I ever figure it out. It might have to stay on four for the moment though. There is a lot of customization to work through, and a lot of front end forms.

  • Nothing I have tried has worked so far. Turned off all of the plugins except acf pro. Changed the theme to twentyfourteen. Deleted post revisions.

    Manually deleting duplicates now…

  • It is not a multisite. I will make another pass at getting the field group ids updated manually through out the code now that I understand why it is necessary, which makes sense.

    Hopefully I can get the duplication issue worked out. It might not be the end of the world if I just have to delete the duplicates manually since they are all new fields in new groups anyways.

    Thanks for the help.

  • This reply has been marked as private.
Viewing 25 posts - 1 through 25 (of 27 total)