This topic is locked

adding counter to a custom button on a row?

6/15/2022 2:23:07 PM
PHPRunner General questions
W
wfcentral author

I am trying to add a counter that displays the number of child records attached to a row. I'm doing this because I'm trying to make the interface a bit more like what gamers would use and get rid of a lot of extra stuff. Using the existing child-parent linking technically works, but it doesn't look like an interface that gamers would use to chat with each other.

There are a lot of tables and processes that go on to get to the point where i need help so I won't confuse/bore you with all those details.

The end result is that a database of video gamers can make friends with each other and then have one on one messaging to setup a play schedule. My goal is NOT to be a complete email/chat solution. I just need a simple way for them to chat and exchange details so they can then use something else for chatting like Discord. I need the built in chat ability because emails are not reliable enough due to spam blocking and such.

So - user goes to their page where they can see their "friends". On each row of this list page I have inserted a chat button that opens a pop-up. In this pop-up I'm pulling an external webpage where I have a nice chat interface built using a table called "Messages". All of this is working fine. If they open this pop-up all messages are marked as "read".

The part that I'm having trouble with is this - there is no way for a person looking at their friends page to know if there are any unread messages. They would have to click on each chat button and open the pop-up to see. So, I need a way to modify the chat button per row and add either a counter that shows how many unread messages in the message table for that friend OR at least make the button a different color... the row a different color... anything.

I know you can modify the menu and add counters on that, but I'm not sure how to modify a row based on a query that each row takes.

select all from messages where read = 1 AND friend_id = {rowID}

admin 6/16/2022

It is a bit difficult to understand what exactly is the question here. "how to modify a row" is not something that makes sense to me.

I guess you need to start somewhere and setting 'View as' of one of fields to Custom can get you there. In your code you have access to all the fields of the current record so you can build and execute the query like the one you mentioned above.