Skip Navigation

[Resolved] Can't create the kind of pagination what I want

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

Problem:
How to display a list of users with links to profile pages for each user.

Solution:
Create a View which returns a list of users. Design the loop output section so that it includes the required summary fields as well as a button with a link to the profile page of the selected user. That link is generated like so:

<button>
  <a href="../user-profile/?uid=[wpv-user field='ID']">[wpv-user field='display_name']</a>
</button>

Add that view to a page where the user list should be displayed.

Then create another View added to the user profile page. To show results for the selected user add a Query filter that selects the user with the ID set by the URL paramter 'uid'. Design the output of the page as required directly in the loop output section or by linking to a content template.

Relevant Documentation:
https://toolset.com/documentation/user-guides/views/

This support ticket is created 7 years, 11 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.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+01:00)

This topic contains 4 replies, has 2 voices.

Last updated by gaborG 7 years, 11 months ago.

Assisted by: Nigel.

Author
Posts
#401407
Pagination items.jpg

I'm working on a front-end admin page.
The purpose of it is to be able to click on a Subscriber level user from a list and be able to see all the information related to that user.
First I wanted to create the list of users separately, which I did. I created a list to display certain relevant information about users in each list item, to make it look like the one in the image. But then I couldn't use the rows of the list to manipulate data on the rest of the page.

So now I'm trying to create the same list as a pagination control for the rest of the page, which would display the information of the selected user.

Now the main window displays the details of the first user correctly, but the pagination list only display the word "Contact: " which I added manually, and that only once, even though there are 2 Subscriber level users added.

The code I used in an attempt to create the pagination list is this:

[wpv-filter-start hide="false"]
[wpv-filter-controls]
<div class="col col-md-4 filter-column">
  <h2>Clients</h2>
  <div class="col col-md-4 filter-column">
    <div class="row rowdesign">
      <div class="col col-md-6">
        <div class="inline companyLogo">
          [types usermeta="company-logo"][/types]
        </div>
        <div class="inline companyName">
          [types usermeta="companyname"][/types]
        </div>
      </div>
      <div class="col col-md-6 inline contactName">
        <strong>Contact:</strong> [wpv-user field="user_firstname"] [wpv-user field="user_lastname"]
      </div>
    </div>
  </div>
</div>
[/wpv-filter-controls]
[wpv-filter-end]

And it doesn't work. It displays the users normally if I use the code regularly, but it doesn't work in the pagination controls.
I want to list out all Subscribers. Preferably in a way that the column of the list can be scrolled separately from the rest of the page, but I've never encountered that in Toolset, so if that's not possible, that's okay.
How can I make this list? Thanks.

#401555

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

It's not possible to do this with Toolset alone without writing custom code to make it work.

Firstly, I think you are barking up the wrong tree with your pagination controls. Those are for nothing more than handling a long list of results and rather than display all of them at once display them, for example, ten at a time.

What you are describing sounds more like a parametric search view, where you select a user from a list and then display the results for that user below. But thinking it through, it is not possible to get it working in the way you describe. The filter controls for a parametric search are limited to things like select boxes, checkboxes etc. The HTML for the controls is generated by Views, you can't design them in the way you describe as a custom list.

You can make a View to generate your list (all the data is stored as user meta, right? It would need some thought if you made a CPT for companies, for example). Where you add the user name you need to wrap this in a link to a page that displays the user profile, passing the user id as a parameter.

The problem with this technique is that it will take you to a new page to view the profile.

If you want the profile to be shown on the same page that will require custom code to make an ajax call to retrieve the content you want to update your page with.

#401656

I noticed that only Views which list posts can have parametric search, those which list Users cannot. This, in my opinion, is a shortcoming of Types, and I recommend that you add this feature.
Anyhow, I'm going to do it the way you suggested. However... what parameters and how can I pass on to the button clicks to display the user related to that button's content on the next page?

#401802

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

You are correct, of course, that you cannot have parametric searches for users, though it wouldn't help in setting up what you've described in any case.

I made a quick mockup of what you need which I'll describe here and which you can adapt as you need.

I made two pages, one—user list—which lists my users with a button to take them to their profile, and two—user profile—a page to show the profile details of the specified user.

I created a View of users for my user list page which includes a button which links to the user profile page and adds a parameter 'uid' to pass the user id.

Here is the important part of that View, the button which adds the parameter to the link to the profile page:

<button>
  <a href="../user-profile/?uid=[wpv-user field='ID']">[wpv-user field='display_name']</a>
</button>

I add this View to my user list page.

Now I create a View to show the profile of the specified user which I will add to my user profile page.

This View will display users subject to a Query filter which I add, where I want a specific user, the user with the ID set by the URL paramter 'uid'.

Now in the Loop section I can add a content template for the output I want to show on my profile.

Let me know how you get on.

#402053

This is genius. Works like a charm.
Thank you so much for the detailed description, it helped immeasurably.

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