I have a user form. when a new user registers, the user status default value is pending.
And there is a page for admins with a view to display all users. the admin should be able to update the user status from pending to approve or reject. as on the attached image 3 (which is working fine).
After submitting the form ;
Currently: it displays rejected or approved like on the attached image 2 (which is fine). But, after I refresh the page, the form shows again like on image 1.
I want: to keep displaying the message all the time even if I refresh the page.
I used the below code to display the message based on the status.
This seems to be a case where you need to use some conditionals on this listing page for the user. I'm assuming that under specific conditions such as "pending"you want the form to display for the admins so they can change it to Rejected or Approve.
In this case you will need to write a 3rd conditional for "pending" so the admin can only see the form for the pending users. So it would look like this below.
[wpv-conditional if = "( '[types usermeta='request-status' output='raw'][/types]' eq '1' )" ]
Approved
[/wpv-conditional]
[wpv-conditional if = "( '[types usermeta='request-status' output='raw'][/types]' eq '2' )" ]
Rejected
[/wpv-conditional]
[wpv-conditional if = "( '[types usermeta='request-status' output='raw'][/types]' eq '3' )" ]
Form shortcode goes here
[/wpv-conditional]
Essentially the form will only load when the status is set as Pending. Please let me know if this is exactly what you are referring to. If not then further clarity will be needed on this.
I have tried to add this code in the form settings as on the attached image, but still, when I refresh the page the form displayed again. I have tried to add it also on the view but still the same.
I took a look at the site further and the problem was that you were using the current_user ='true' attribute for the meta fields.
What this actually does is get the custom field information of the currently logged in user and not the user that is being displayed by the view loop.
To resolve this all I did was to remove the current_user=true from the shortcode and it started showing the form only for users who have a pending status.