Skip Navigation

[Resolved] Want to add post count by users

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 6 replies, has 2 voices.

Last updated by Luo Yang 1 year, 10 months ago.

Assisted by: Luo Yang.

Author
Posts
#2530757

Hello,
I want to add the numbers of post a user made but it is not in the field form, how can I go about this?

#2530835

Hello,

Where do you want to display the post counts?
If you want to display current logged-in user's post count, you can create a post view:
- Query posts of your custom post types
- Filter by post author is same as logged-in user
https://toolset.com/course-lesson/allow-users-to-manage-their-items/#create-a-view-that-lists-the-item-of-the-currently-logged-in-user
- In the outputs section, display the found post count shortcode: [wpv-found-count]
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#vf-155378
Displays the total number of posts, users or taxonomies that have been found by the Views query.

#2530905

Hello
I want to display the numbers of entries they made while submitting form. Like if the user have submitted form for 5 times, it will be counted as 5 time.

#2530939

Yes, in the post form content, you can display the post view I mentioned above using view's shorcode: [wpv-view]

Here are detail steps, see below test site:
Login URL:
hidden link

1) Enable legacy editor:
hidden link
Dashboard-> Toolset-> Settings, enable option: Show both the legacy and Blocks interface and let me choose which to use for each item I build
https://toolset.com/course-lesson/enabling-legacy-version-of-toolset-views/

2) Dashboard-> Toolset-> Views, Create a post view:
hidden link
- Query posts of your custom post types
- Filter by:
Select posts with the author the same as the current logged in user.
- In section "Loop Editor", display found count shortcode:

	[wpv-items-found]
<strong>You have created [wpv-found-count] posts!</strong>
...
	[/wpv-items-found]
	[wpv-no-items-found]
		<strong>[wpml-string context="wpv-views"]You did not create any post yet![/wpml-string]</strong>
	[/wpv-no-items-found]

3) In the post form content:
hidden link
add a "HTML content" element, and display above post view's shortcode:

[wpv-view name="Want to add post count by users"]

Test above post form in frontend:
hidden link

You will be able to see the message: You have created 1 posts!

More helps:
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-view

#2532511
vbv.png

Hello,
I have been able to do as told but i still could not get the numbers of post filled by users when i pasted the code on my template. When i pasted the code it did not diplay any number [wpv-view name="Want to add post count by users"]
I also noticed that the loop editor area is locked so i could not paste the code instructed there

#2532647

Please share your website credentials in below private message box, also point out:
- Post form URL
- Page URL(Where I can test above post form in frontend)

I can try to setup a demo in your website

#2532683

Thanks for the details, I have done below modifications in your website:
1) Edit post view "want to add post count by users":
hidden link
in section "Loop Editor ", click link "Skip wizard", so you can setup the codes manually:

...
[wpv-items-found]
<strong>You have created [wpv-found-count] posts!</strong>
	<!-- wpv-loop-start -->
		<wpv-loop>
		</wpv-loop>
	<!-- wpv-loop-end -->
	[/wpv-items-found]
	[wpv-no-items-found]
		<strong>[wpml-string context="wpv-views"]You did not create any post yet![/wpml-string]</strong>
	[/wpv-no-items-found]
...

2) Edit the post form "Add Artist Form":
hidden link
In section "Form Editor", line 3, click button "Fields and Views", add above post view's shortcode:
[wpv-view name="want-to-add-post-count-by-users"]

3) Test it in frontend:
hidden link
click button "ADD ARTIST"

I can see it works fine:
You have created 19 posts!

For your reference.