As the title says, I was wondering if there was a way to see if a user has posted in a specific board and use that information outside the forum such as with SSI.php or some other method.
The user you mean must that be the user who is logged in atm or a specific numbered member id. Just a note if you have a large forum the query wich must be done at the db will be huge.
even without a large forum... with more than a few users, a few board and a few posts -- we are talking about at a query on two of the largest tables with at least 2 joins...
in other words... this query would QUICKLY bog down anything other than a dedicated server... and even then it will bog down if you forum is even the least bit active.
No, you're wrong, sorry... It's just a simple "COUNT" in smf_messages...
That table contains both id_board and id_member so it's just a simple select operation, with a WHERE in 2 fields that are even a key (show_posts). It can't get much better ;)
ummm... well, I am frequently wrong when it comes to database crap. :)
hmmm.... yup... member and board arelisted for each entry I guess it is not nearly as intensive as I thought. :D
SELECT COUNT(*) FROM `smf_messages` WHERE `id_board`=1 AND `id_member`=1
works...
so. run the check and then consider it a YES if the COUNT returned is greater than 0
Quote from: margarett on August 26, 2015, 12:05:49 PM
No, you're wrong, sorry... It's just a simple "COUNT" in smf_messages...
That table contains both id_board and id_member so it's just a simple select operation, with a WHERE in 2 fields that are even a key (show_posts). It can't get much better ;)
If it must be the user wich is logged in and youre having 40 members logged in , then that query runs 40 times, yeah that will be heavy db query on that board wich has maybe 2000+ or more messages, or do i think wrong here?
Pipke,
It certain does NOT need to be the user that is logged in.
I ran that query directly in mySQL and I was not even logged in at all.
you just have to provide A NUMBER for the WHERE `id_member`=... statement.... You can get that number any way you want -- by asking for it in a form, by using an array, or by cycling through each and every user...
Haha. I've been busy so hadn't viewed the replies here. Yes, it would be the member currently logged in and viewing the page. Thanks for all the responses!
This is marked as solved? As i see it in the above reply it doesnt?
I'm just using it to show a user whether or not they have posted in a board as part of our application process. It only needs to be the one user who is viewing the page. I have a few options for verifying that they've submitted an application thread so this is just one possibility.