Using field value for userid in Shortcode

By: Björn Mühle | Asked: 12/20/2023
ForumsCategory: General questionsUsing field value for userid in Shortcode
Björn Mühle asked 7 months ago
Hey there, i need to display form statistics in frontend filtered by user id. So i used the Shortcode: [frm-stats id=47 type=total user_id=] At first i want to select a user within a dropdown field x an click the send button. I tried to use [frm-stats id=47 type=total user_id=[x]] but it doesn´t works.
  Any ideas?   Best regards.. Björn
2 Answers
Björn Mühle answered 7 months ago
perhaps with a few more Information in picture below. On top right a created a form which gets the user id. At the bottom i want to show the total of worked hours filtered by the user_id selected at the top. [frm-field-value field_id=298] works for the Title. But how can i filter my stats for the selected User? [frm-stats id=47 type=total user_id=298] doesnt works.   Best Björn  
Daniel Tsouri answered 1 month ago
I had a similar issue. Try creating a new form that only has a userID field and on submission, stores that user ID as a URL parameter and redirects to the page in the image. Next, add that form to the page in the image and have it redirect to that page with the userID now in the URL. Finally, reference the userID directly from the URL parameter you have set. While this approach won't allow for filtering directly when the user is selected (they need to press 'submit'), it is still a solution to the issue. [frm-stats id=47 type=total user_id=['NAME_OF_URL_PARAMETER]]  Let me know if you have any questions on this method.

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community