Ive done a bit of research, and I’m currently able to do this with formidable forms using views, however ACF has a lot more customization options and I’m wondering if it is possible and where to start.
Creating a project management system for my customers, was wondering if there is an easy way so that when customers go to domain.com/projects all Project data created using acf for that specific logged in user is displayed on that page. (Rather than having to create custom pages for each user or displaying all registered users information on that page.)
No expecting any one to explain this step by step, just point me in the right direction of how I could create such a thing.
Just one possible solutions is to create a custom post type for projects that has an archive. On the project post you have a user field relating the project to a user, or users. A user field stores an array of user IDs in the DB. I would then use something like this to put the values of the user field into a standard WP meta field in the DB https://acfextras.com/dont-query-repeaters/. Then I would add a pre_get_posts filter that runs when the archive page is loading to filter project posts by the currently logged in user.
Yeah, i’m actually really glad I asked you as due to my lack of experience in working with ACF I would have never thought of that, at least it would have been a few days at before I figured that out. I’m sure you are all pretty busy, but I could see a feature like this being built in being useful, (that is displaying entries for specific logged in users). Just because there are so many limitation on WordPress in regards to creating more dynamic user based content. Thanks again for the help, I really appreciate that 🙂
Sorry one last question, is there an easy way to do this with individual field information? So once again, if I want to show information from within the project on the dashboard. Is there a similar option to use something like acf/prepare_field to only (always) render information for a specific user id only? Does the data need to be prepared in a special way like in the previous example? Once again this has been my problem with WordPress from the start, there really isn’t an out of the box solution for this (that I’m aware of any way). Again thanks for your help, that would be the last question I will bother you with, and I understand if its too complicated to give a simple answer too (that pro upgrade was certainly worth the money already) 🙂
Replying to the first comment. I’m just another user. ACF is a very powerful tool, but one of the things that make it powerful is that the scope of the plugin is kept very specific. An admin that allows easy management of custom data. It also contains a large number of filters and actions that can be used to customize it to almost anything we can think of. There is nothing in it that will help us use that data to manage how content is displayed on the front end. Most of my suggestions in my first reply are using the tool, filters and actions built in to both ACF and WP.
On you follow up question, I’m not exactly sure what you mean by dashboard. If you are referring to the list of posts admin page, this can also be done.
The reason that I suggested the preparing of data in the database only has to do with making queries for WP_Query() or filtering of posts both easier to construct and faster to perform and is is based what type of field that is being used. In the example, a user field can be queried directly, and yes, you can do what I suggested without it, but it requires doing a “LIKE” query on the user field. The different ways to construct a query is covered here https://www.advancedcustomfields.com/resources/query-posts-custom-fields/. The main difference is that a filter on a field using the
= comparison is much faster than a
LIKE query and one I always keep one eye on performance when I’m deciding on a solution. In your case, you could likely get away with the “LIKE” query because you’ll only be filtering by a single user. These like queries can get out of hand more quickly if you attempt to filter by multiple values at the same time.
Anyway the same type of filtering can be done in the admin to show a logged in user only a list of their own posts for a post type. However, I would be careful here as this would also limit your ability to see them. You would want to check the user type rather than a specific user or not filter posts for a specific user ID, like your own.
I rarely find an out of the box solution for most of the things that I need to do, and when I do those solutions are usually overkill, including features that will never be used and only server to complicate the admin 😛
Hey, well I appreciate it even more that your volunteering your time to help me with this. Sorry I was supper tired when I wrote the reply and should have explained it more clearly. The problem is, there is also a dashboard component in WordPress (wp-admin) and I should have been more specific that I meant a front end project dashboard which I am building. This is just a generic example, and the reason why i didn’t do something custom, its more for my customer and needs to be more user friendly: https://dougmohns.com/wp-content/uploads/2018/12/projectanagement-dashboard-process-certification-tasks-free-system.png (again this is just for clarification, I’m not making something that complicated). Sorry I should have made that more clear.
I guess another way of explaining my question, is i’m just trying to find the best practice for all of this additional content that is specific to a single user (customer). How is the best way to not only enter that data, but to also display it. Happy if it is as simple as this content for this customer. However is it possible to ensure that the content is only visible to the specified customer (while if another user goes on to that same page, they only see content specific to them). Obviously as an admin, I will probably make it so that the content is visible also, specifying both the user ID and the admin user type.
Currently I’m using formidable forms for a lot of the data management, its great for plain text content. This is not the best example, but say when creating invoices using formidable, I create a view that displays the user ID that is accessing this page’s billing address (once again if its a different user it displays a different set of data), this also renders the invoice data such as the total amount of hours billed (in this case I have to manually specify the user ID, but in the case of their billing address, as the user has written it I don’t).
If that makes it easier to understand, I’m trying to do the same with ACF as it has more options for more complicated content. I think the post approach is great for projects. My question was more, say if I wanted to display only a portion of that content, on the front page, how would I go about doing it. Obviously the challenge which Im sure can be done, I’m just struggling to find the correct terminology so I can google and learn more. I had a feeling it might be as simple as creating a user based rule (though I was unable to confirm this). But once again, I’m struggling to find where to start, just some terms and help pages would be more than enough to Its no different than say a social media site, where all the content is dynamic and linked to the each user as another way to explain it.
Really appreciate your help on this, and I agree that given the amount of information will be contained on this portal, it would be smart to plan how to use server resources effectively, so thank you for explaining the best approach there. And I entirely agree, all of the plugin I originally tried had way to many features I didn’t need, and not enough of the ones I did. First time ever going to this much effort to do things the right way, it been a great experience, and Formidable does do most of what I want it to do out of the box. Though I can tell acf will be the missing link to some of these more complex features.
Thanks again for your time 🙂
After doing a little more research thanks to the information already provided, I came across $current_user->ID as a possible method to limit content to the specific user ID. Again any advice for best practices on how to use this. I found a few other approaches that might work, but again, you don’t want to invest a lot of time in to a method that will be really limited in the future. Thanks again for all the help 🙂
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
🗺 We’re improving the Google Map field by adding lots more saved data!— Advanced Custom Fields (@wp_acf) October 17, 2019
old: [address, lat, lng]
new: [address, lat, lng, place_id, street_name, street_number, city, state, post_code, country]
© 2019 Advanced Custom Fields. Subscribe