Check if a user has posted in a specific board

Started by Alanar, August 22, 2015, 08:55:41 PM

Previous topic - Next topic

Alanar

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.

Pipke

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.
"If something is wrong, fix it if you can. But train yourself not to worry: Worry never fixes anything."

Click here to view my mods for SMF

Hey 👋 Did i helped... you like what i do. You can now buy me a coffee! ☕

Kindred

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.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

margarett

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 ;)
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Kindred

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
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Pipke

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?
"If something is wrong, fix it if you can. But train yourself not to worry: Worry never fixes anything."

Click here to view my mods for SMF

Hey 👋 Did i helped... you like what i do. You can now buy me a coffee! ☕

Kindred

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...
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Alanar

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!

Pipke

This is marked as solved? As i see it in the above reply it doesnt?
"If something is wrong, fix it if you can. But train yourself not to worry: Worry never fixes anything."

Click here to view my mods for SMF

Hey 👋 Did i helped... you like what i do. You can now buy me a coffee! ☕

Alanar

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.

Advertisement: