Show threads from X node where user has unique value in Custom Field

gordy

Well-known member
Would this be better accomplished with using pages ?

How do I send the parameters via php from one page to the target page?

Workflow meta
Visitor clicks on a members name from a page of members and then is presented a page of the threads that member started from a specific forum.

Workflow detail
User clicks on page/namelist.php which generates a list usernames that have the 'blah' select from the custom field dropdown, using query:


Generate user list based on value from Custom Field blah
Code:
SELECT m.user_id, username, field_value
FROM xf_user m
LEFT JOIN xf_user_field_value p on p.user_id = m.user_id
WHERE field_value = 'blah'
ORDER BY username ASC;


Renders this: /page/member-name-list/
<a href="dom.com/members/user.1/">John</a>
<a href="dom.com/members/user.34/">Bob</a>
<a href="dom.com/members/user.55/">Sally</a>



Then visitor clicks on one name listedt above and there's a second page that uses the user_id value to generate the second query:


(Enumerate thread list based off user_id from a specific node_id)
Code:
SELECT t.thread_id, t.node_id, t.title, t.user_id, t.username from xf_thread AS t
WHERE t.user_id = 7 and node_id = 77 
GROUP BY t.thread_id
ORDER BY last_post_date DESC;


Renders this: /page/members-posts-from-specific-category/


<a href="dom.com/thread/post-number.2001/">Post1</a>
<a href="dom.com/thread/another-post.3320/">Post2</a>
<a href="dom.com/thread/and-another.5123/">Post3</a>



I'm sure there is a much simpler way of doing it but I'm blinded by code getting this far. :/
The only custom attribute in all the above is the defined unique custom field to get a means to sort some members from the regular populace.
Thank you, any help would be most welcome and appreciated.
 
Hi,

Sorry for the late reply. Have been a bit busy over the weekend.

If I was to do this, I would use the built in search and just add on the terms that I wanted.

So, for example, I would add on the ability to search by custom field to the member search, and add the ability to search by member to the thread search.

I would then add a link from the member search results to the thread search.

I have already been asked to create a custom field member search, and I think the second is already possible, and adding the link should be a template edit (although I could do it as an add-on for you if you wish).

Perhaps you could just make a small contribution (£20-£40) to the custom field member search add-on, and then I will help you to implement it if you are having trouble.

Kind regards,

Jon.
 
I now have something in place to tide me over, in the mean time.

My main goal is to have a dedicated page for listing members with X custom field set. If that aligns with your custom field member search project I will consider a new architecture. :)

Cheers
 
Hi,

It wouldn't be a dedicated page exactly, but you would be able to get to it by using the appropriate query string (e.g. "/search?customfield=foo&customvalue=bar").

It makes more sense to do it this way, otherwise a lot of time is wasted duplicating code which may then become out-dated if it is then updated in a later version of XF.

Kind regards,

Jon.
 
The dedicated page is paramount, as members would opt in to having their names listed on the dedicated page, hyper linking their name to the posts they've created in a single forum.

XF updates are always a risk, and coding with core abstraction would minimize that, in theory anyway. ;)
 
Top Bottom