OK, lets take this from the beginning in a clean install.
Follow this steps to reproduce the issue in a clean install.
Open a terminal (instructions for mac, but feel free to use another OS, steps is almost the same.
brew install --cask docker
mkdir ~/bricksbug
cd ~/bricksbug
vim docker-compose.yaml
paste this content to docker-compose.yaml.
services:
db:
# We use a mariadb image which supports both amd64 & arm64 architecture
image: mariadb:10.6.4-focal
# If you really want to use MySQL, uncomment the following line
#image: mysql:8.0.27
command: '--default-authentication-plugin=mysql_native_password'
volumes:
- db_data:/var/lib/mysql
restart: always
environment:
- MYSQL_ROOT_PASSWORD=somewordpress
- MYSQL_DATABASE=wordpress
- MYSQL_USER=wordpress
- MYSQL_PASSWORD=wordpress
expose:
- 3306
- 33060
wordpress:
image: wordpress:latest
volumes:
- wp_data:/var/www/html
- ./uploads.ini:/usr/local/etc/php/conf.d/uploads.ini:ro
ports:
- 80:80
restart: always
environment:
- WORDPRESS_DB_HOST=db
- WORDPRESS_DB_USER=wordpress
- WORDPRESS_DB_PASSWORD=wordpress
- WORDPRESS_DB_NAME=wordpress
volumes:
db_data:
wp_data:
Create more upload so we can install bricks and plugins
vim uploads.ini
Paste the following content inside uploads.ini
memory_limit = 512M
upload_max_filesize = 10M
post_max_size = 10M
Start the docker container
docker-compose up -d
Go to plugins and erase akismet and hello dolly
Install and activate plugin
ACF PRO - paid version (6.0.3)
CPT UI - free version (1.13.1)
Go to appearance → themes and install bricks 1.5.6
Activate bricks license
Add a Custom Post Type called Quotes
CPTUI → add/edit post type
Slug: quote
Plural: Quotes
Singular: Quote
Has archive: true
Click: ADD POST TYPE
Add a bricks template for the post type
Bricks → templates → add new
Title: Quote Single
Type: Single
Click: Publish
Create 2 separate fieldgroups with ACF - one for all users and one for administrators
Custom fields → field groups
Click: add new
Field group title: my_field_group_1
In this fieldgroup add 1 field.
Type: (choice) true/false
Label: my_choice_1
Name: my_choice_1
Conditions: post_type is equal to Quote
Hit: Save
Create one more field group like this
Custom fields → field groups
Click: add new
Field group title: my_field_group_2
In this fieldgroup add 1 field.
Type: (choice) true/false
Label: my_choice_2
Name: my_choice_2
Conditions: post_type is equal to Quote AND current_user_role is equal to administrator
Hit: Save
Both of this fieldgroups will now show up when editiing a post with post_type Quote.
If you are an administrator.
Create a Quote
Quotes → Add new
Title: my first quote
Check both checkboxes (my_choice_1 and my_choice_2)
Click: Publish
Set up the template with bricks
Now go back to bricks and open the template for quotes
Bricks → templates → Quotes Single → edit with bricks
Hit the section element once and the block element twice.
Insert one header in each block just to have som content.
The structure like this
Give the blocks different background so you can see the difference.
Use conditional logic for block 1
Use conditional logic for block 2
Give the template the proper conditions
In the builder hit the gear icon (settings) → Template settings → Condtions
Hit: Save
Now visit the quote on the front end.
In my case: http://localhost/quote/my-first-quote/
Now there is only the first block showing…
Even when viewing the frontend as a logged in administrator.
(My excpectations are to view both blocks for all users since the admin role is only for showing/hiding the interface in the backoffice - the value of the field should be used for all users - well, this seems not to be the issue anyway since for logged in administrators it does not show)
What seems to be the issue here
When removing the second display condition from my_field_group_2 in the ACF interface. Then the true/false-field returns as excpected. The error is in there some where.