Comments (16)
I suggest changing the 'read' column to 'date_read' and make it a datetime type.
This would do the following:
- Show when the PM was read.
- If it's null, then the PM hasn't been read.
- Cleaner implementation, in my opinion.
If you like this idea, I can draft a PR for it.
from codeigniter-aauth.
👍 good idea
from codeigniter-aauth.
i can write this in my PR too, should i?
from codeigniter-aauth.
I concur that this is a good idea. I would take it a step further and change the "date" column to "sent" or "date_sent" for consistency.
from codeigniter-aauth.
Sounds good. Eventually, we can add on to the pm feature to allow support for group messaging
from codeigniter-aauth.
@tswagger, @REJack did as you said. https://github.com/REJack/CodeIgniter-Aauth/commit/a11bdbe5800b9d85d4bb01df08acc675e540cb26
from codeigniter-aauth.
it was a briliant idea 😃
from codeigniter-aauth.
👍 Is there a way to modify the pm system to allow for multiple recipients?
Say an admin wants to message all the users on their website...
from codeigniter-aauth.
It would be a tricky implementation, perhaps it's best to make a site-wide announcement feature
(something separate from pm's)
from codeigniter-aauth.
idk i could write really easy :P but i would remove the error if the user is banned
from codeigniter-aauth.
i would write it like this 😄
$receiver_id can be int or array
public function send_pm( $sender_id, $receiver_id, $title, $message ){
if(!is_array($receiver_id)){
$receiver_id = array($receiver_id);
}
$query = $this->aauth_db->where('id', $sender_id);
$query = $this->aauth_db->get( $this->config_vars['users'] );
if ( $query->num_rows() < 1 ){
$this->error($this->CI->lang->line('aauth_error_no_user'));
return FALSE;
}
foreach ($receiver_id as $receiver) {
if ( $sender_id == $receiver ){
$this->error($this->CI->lang->line('aauth_error_self_pm'));
continue;
}
$query = $this->aauth_db->where('id', $receiver);
$query = $this->aauth_db->get( $this->config_vars['users'] );
if ( $query->num_rows() < 1 ){
$this->error('UserID: '.$receiver.' '.$this->CI->lang->line('aauth_error_no_user'));
continue;
}
$data = array(
'sender_id' => $sender_id,
'receiver_id' => $receiver,
'title' => $title,
'message' => $message,
'date_sent' => date('Y-m-d H:i:s')
);
$query = $this->aauth_db->insert( $this->config_vars['pms'], $data );
}
return TRUE;
}
from codeigniter-aauth.
From your implementation, I see you are creating multiple messages in the pms table. I feel this is unsatisfactory from a big data standpoint. It's bloat / extra fat in the DB...
from codeigniter-aauth.
than its to tricky with the readed status for any receiver
from codeigniter-aauth.
Better Implementation?
What about creating two tables? One that stores aauth_pms
and another that holds the recipients with their respective date_read
.
Call these two tables:
aauth_pms
aauth_pm_receivers
The table storing the pm would contain:
- id
- sender_id
- title
- message
- date_sent
The table holding recipients would contain:
- pm_id
- receiver_id (user's id)
- date_read
With this implementation then list_pms()
could run the SQL query GET * FROM 'aauth_pm_receivers' WHERE 'receiver_id' = $user_id
from codeigniter-aauth.
that sounds good
from codeigniter-aauth.
i think it is solved 👍
Thank you @REJack and @Manebit @tswagger
from codeigniter-aauth.
Related Issues (20)
- Portuguese Translation HOT 2
- Add checked permissions to group
- Create Another Function Like is_admin HOT 11
- Password creation rules HOT 2
- Configure email verification template HOT 1
- Permissions not working when I assign a role
- Conflicts while using CI migrations HOT 1
- How attemp remove when successfully login or manual call function HOT 2
- Can i create some more columns in Aauth users table ? HOT 3
- Why ban_user when reloggin make error HOT 2
- Where we have a function to be checking is_blocked ip address ?
- Upgrade it to Codeigniter 4 HOT 2
- Create group return 0 when success HOT 5
- valid_email() deprecated
- Are you still maintaining HOT 5
- User Email and Password
- CodeIgniter-Aauth v3 Getting Login Error HOT 3
- Sql file for CodeIgniter 4-Aauth v3 HOT 4
- Support
- Create account with set_user_var not saving
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from codeigniter-aauth.