Skip Navigation

[Resolved] View stopped working after cloning

This thread is resolved. Here is a description of the problem and solution.

Problem:
Pass username as URL parameter in a user view.

Solution:
You can use the Views shortcode [wpv-user], like this:
[wpv-user field="user_login"]
Relevant Documentation:
https://toolset.com/documentation/views-shortcodes/#wpv-user

This support ticket is created 8 years, 3 months ago. There's a good chance that you are reading advice that it now obsolete.

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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

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)

Tagged: 

This topic contains 9 replies, has 2 voices.

Last updated by gavinS 8 years, 2 months ago.

Assisted by: Luo Yang.

Author
Posts
#361016
Last 30 days.png
Last 30 days list.png

I have recently cloned a site to move it to the 'real' domain from the test domain. Now one of my views doesn't seem to be working any more, although it still works on the test domain. I have checked that I changed the URLs and can't find anything.

I have a nested view with counts of posts and an anchor link to display the posts on a seperate page using URL parameters.

The main view displays users of any role with no filters:


[wpv-layout-start]
	[wpv-items-found]
	<!-- wpv-loop-start -->
		<wpv-loop>
          
          [wpv-conditional if="('[types usermeta="location"][/types]' eq check_user_from_same_location())"]
          <div class = "row"> <strong>[wpv-user field="display_name"]</strong></div><br>
          <div style = "border:solid black 1px; padding : 20px;">
          <div class = "row">
            <p>Last 7 days</p>
          </div>
          <div class = "row">
             <div class = "col-xs-4 col-md-2">
            <a href = "<em><u>hidden link</u></em>">Emails:</a> [wpv-view name="bm-comms-7-days" toc = "1"]</div>
          <div class = "col-xs-4 col-md-2">
           <a href = "<em><u>hidden link</u></em>">Phone:</a> [wpv-view name="bm-comms-7-days" toc = "2"]</div>
            <div class = "col-xs-4 col-md-2">
              <a href = "<em><u>hidden link</u></em>">Meetings:</a> [wpv-view name="bm-comms-7-days" toc = "3"]</div></div><br>
          
          <div class = "row">
            <div class = "col-xs-4 col-md-2">
                 New Jobs:
               [wpv-view name="bm-new-jobs-7-days"]</div>
            <div class = "col-xs-4 col-md-2">
                 CVs Sent:
               [wpv-view name="bm-cvs-sent-7-days"]</div>
            <div class = "col-xs-4 col-md-2">
                 Lost Jobs:
               [wpv-view name="bm-lost-jobs-7-days"]</div>
            <div class = "col-xs-4 col-md-2">
                 1st Interview:
               [wpv-view name="bm-1st-interview-7-days"]</div>
            <div class = "col-xs-4 col-md-2">
                 2nd Interview:
               [wpv-view name="bm-2nd-interview-7-days"]</div>
            <div class = "col-xs-4 col-md-2">
                 Placements:
               [wpv-view name="bm-placements-7-days"]</div>
          </div><br>
          </div><br>
          <div style = "border:solid black 1px; padding : 20px;">
          <div class = "row"> 
          <p>Last 30 days</p>
            </div>
          <div class = "row">
           <div class = "col-xs-4 col-md-2">
          
          <a href = "<em><u>hidden link</u></em>">Emails:</a> [wpv-view name="bm-comms-30-days" toc = "1"]</div>
          <div class = "col-xs-4 col-md-2">
            <a href = "<em><u>hidden link</u></em>">Phone:</a> [wpv-view name="bm-comms-30-days" toc = "2"]</div>
            <div class = "col-xs-4 col-md-2">
              <a href = "<em><u>hidden link</u></em>">Meetings:</a> [wpv-view name="bm-comms-30-days" toc = "3"]</div></div><br>
          <div class = "row">
            <div class = "col-xs-4 col-md-2">
                 New Jobs:
               [wpv-view name="bm-new-jobs-30-days"]</div>
            <div class = "col-xs-4 col-md-2">
                 CVs Sent:
               [wpv-view name="bm-cvs-sent-30-days"]</div>
            <div class = "col-xs-4 col-md-2">
                 Lost Jobs:
              [wpv-view name="bm-lost-jobs-30-days"]</div>
            <div class = "col-xs-4 col-md-2">
                 1st Interview:
               [wpv-view name="bm-1st-interview-30-days"]</div>
            <div class = "col-xs-4 col-md-2">
                 2nd Interview:
               [wpv-view name="bm-2nd-interview-30-days"]</div>
            <div class = "col-xs-4 col-md-2">
                 Placements:
               [wpv-view name="bm-placements-30-days"]</div>
          </div>
            </div>
              <br>
          [/wpv-conditional]
         
		</wpv-loop>

	<!-- wpv-loop-end -->
	[/wpv-items-found]
	[wpv-no-items-found]
		<strong>[wpml-string context="wpv-views"]No items found[/wpml-string]</strong>
	[/wpv-no-items-found]
[wpv-layout-end]

You can see on this line a link to a view where I list the communications by this user in the last 30 days that have a toc=1 (type of communication = email), and then I display another view which counts the posts:

<a href = "hidden link">Emails:</a> [wpv-view name="bm-comms-30-days" toc = "1"]</div>

On the attached screenshots you can see that the one view is counting 2 emails in the last 30 days, but if I click on the link it comes up with 'No items found'.

Here is the comms-by-user-30-days view:

Selects 'Communications' with the following filters:

Post author filter
Select posts with the author's username determined by the URL parameter "author-filter"

Custom field filter
Select posts with custom field:
Type of communication is a number equal to URL_PARAM(toc)
AND
Date and Time is a number greater than or equal PAST_DAY(30)

And loop output:


<h3>Communications in last 30 days by [wpv-post-param var="author-filter"]</h3>
[wpv-layout-start]
	[wpv-items-found]
	<!-- wpv-loop-start -->
	<ul class="wpv-loop js-wpv-loop">
		<wpv-loop>
			<li>
				[wpv-post-link]
			</li>
		</wpv-loop>
	</ul>
	<!-- wpv-loop-end -->
	[/wpv-items-found]
	[wpv-no-items-found]
		<strong>[wpml-string context="wpv-views"]No items found[/wpml-string]</strong>
	[/wpv-no-items-found]
[wpv-layout-end]

And this is the bm-comms-30-days view:

Selects 'Communications' with the following filters:

Post author filter
Select posts with the author set by the parent View.

Custom field filter
Select posts with custom field:
Type of communication is a number equal to VIEW_PARAM(toc)
AND
Date and Time is a number greater than PAST_DAY(30)

and the loop output:


[wpv-layout-start]
	[wpv-items-found]
	<!-- wpv-loop-start -->
		<wpv-loop>
		</wpv-loop>
[wpv-found-count]
	<!-- wpv-loop-end -->
	[/wpv-items-found]
	[wpv-no-items-found]
		[wpml-string context="wpv-views"]0[/wpml-string]
	[/wpv-no-items-found]
[wpv-layout-end]


I don't know why this is working on the test site, but not this one now that I've cloned it.. Argh.

#361192

Dear gavin,

How do you clone your website to another?
I suggest you try with our document:
How do I migrate a WordPress site from one domain to the other?
https://toolset.com/faq/how-do-i-migrate-a-wordpress-site-from-one-domain-to-the-other/

Hope it help

#361205

Hi Luoy

I use the Duplicator plugin which changes URLs for you.

I notice it didn't change the URLs in the loop output, but I've changed those manually myself.

Thanks

Gavin

#361206

I'll try run these in Updates and see if it solves the problem.

#361613

OK, Please let me know if you need more assistance for it, thanks

#366099

Hi Luoy

I tried the SQL updates, with no luck.

What I have managed to isolate is that the problem is with the author filter. The date and time filter and type of communication filters seem to working. Not sure what is going on with the author filter. Any ideas?

Thanks

Gavin

#366435

Hi Gavin,

I suggest you check these:
1) Does the user name or user ID has changed when you migrate your website.
2) Can you manually delete and add the author filter in the problem View?

If you still need assistance for it, please duplicate same problem in a test site, and fill below private detail box with login details, also point out the problem view URL and page URL, what kind of author filter do you need. I need a live website to test and debug, thanks!

#366839

Hi Luoy

I've figured out the problem. When I am calling the view with the URL parameter ?author-filter=[wpv-user] it is sending the users nickname, not username. But on the other side it is filtering by username, not nickname. So how do I get it to send the username as the URL parameter?

#367079

You can modify the shortcode [wpv-user] to:
[wpv-user field="user_login"]

See our document:
https://toolset.com/documentation/views-shortcodes/#wpv-user

#367101

Sorted. Thanks so much Luoy.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.