Problems, need help? Have a tip or advice? Post it here.
6 posts Page 1 of 1
Okay I want to create a private messaging system. I just don't really know where to start. Each user has an account, and to message must be logged In.

The pages I'd need are,
New message, and a place to hold all the privet messages. So would I need a list of messages and then the message like a normal clone page? Using relationship tags? Not that I'm up to date with relationship tags.
Then I'd need a message notification on each page when logged in?

Very much like this forms.

All support and advice will be appreciated.
Hi, @SimonRLM
Perhaps something similar was requested eariler viewtopic.php?f=4&t=10403

Yes, you need to rerfresh some Core concepts, like relationships, sessions (probably), databound forms. Once you know what to do, it would take about 3-4 hours to get together a couple of templates and a snippet to pull fresh messages as a kind of prototype. Of course, this will be very simple at first. It would take some time to get something like this done :D
http://demo.interface.club/limitless/la ... youts.html

We also have this new Thread for those who can offer some bounty to get a helping hand.
viewtopic.php?f=2&t=10411
Join COUCH:TALK channel here https://t.me/couchcms_chat
Ryazania — a framework to boost productivity with Add-ons viewtopic.php?f=2&t=13475
Support my efforts to help the community https://boosty.to/trendo/donate
Thanks for the response.

Ive had a look at the link regarding limitless, really like that structure. i'm good with data bounds just relationships is not something i've really done.

It'll be a case of each clone page will have a message seller, then it'll create a new message. then the user can reply within that message, and a conversation can be started. then a page where all the users messages are kept.
SimonRLM wrote: a page where all the users messages are kept

This page could be made up dynamically, fetching all messages, which were sent to the user.

Here is a little kick-starting tutorial :)

Suppose, you have a template messages.php and an editable type='relation' in it so that each user has some related messages (both incoming and outgoing). Now it is wise to structure the whole thing starting from messages.php:
Code: Select all

<cms:editable type='relation' name='owner' masterpage='users.php' has='one' label='' desc='' order=''/>



So now we have each cloned 'message' page belonging to some user. We can assume, that there are going to be many messages and therefore it is good to have this relation editable placed in messages.php template, since it will be just a dropdown with one option (user), not a huge checkbox list (imagine a list of all messages) :D

Here is a trick to still be able to display all messages for some user in admin panel: we are going to define an editable which will just display a link and a numeric counter and place it in users.php template, so each cloned page 'user' can have a link to display all messages that belong to this user.
Code: Select all

<cms:editable  type='reverse_relation' field='owner' masterpage='messages.php' name='user_messages' anchor_text='View all messages' label='' desc='referenced to current user'  />



Once you have it in backend, you'll see how beautiful it looks, not overloading browser with huge lists :)
Cut-2016-08-19-0014-001.png
Cut-2016-08-19-0014-001.png (9.78 KiB) Viewed 2660 times


Then we can talk about filtering incoming-outgoing messages for the front-end. If each message has some editable dropdown status='incoming=100|outgoing=200', then query will be the following:
Code: Select all
<cms:pages masterpage='messages.php' custom_field="owner=id(user-id-here) | status=100 " ><cms:show k_page_title /><hr/><cms:show message_body /></cms:pages>

Above code will list all incoming messages, ordered by publish_date. Of course we can use some different code for the same filter, with related_pages or reverse_related_pages. I suggest to keep looking at this documentation on Enhanced cms:pages tag here: viewtopic.php?f=5&t=8581&p=16352&hilit=Enhanced

But essentially you must prepare a detailed idea of how it should work. Code comes after the plan :D
Join COUCH:TALK channel here https://t.me/couchcms_chat
Ryazania — a framework to boost productivity with Add-ons viewtopic.php?f=2&t=13475
Support my efforts to help the community https://boosty.to/trendo/donate
Right i'll start with that first.

On the members/index.php page which is the clone page for the registered members i use a tag called following. This is to show what that user has posted in a social news feed. So lets say you follow X member but not Y only X member will show in the news feed. Is this the same idea?

tag used
Code: Select all
<cms:editable masterpage='members/index.php' name='following' type='relation' />


That is like above, a check list of names.
So i've now constructed three pages. Example can be shown here, nows time to code this and hopefully i'll get somewhere.

http://www.torza.co.uk/messages/tutorial.html
6 posts Page 1 of 1