E107: Can't send a private message

Created on 10 Nov 2018  路  56Comments  路  Source: e107inc/e107

Stopped sending private messages on the site. Why is it that I'm the main administrator can't send a message?

default

pm awaiting feedback testing required bug

Most helpful comment

I have a feeling there's something weird going on with the userclass permissions. The forum seems to have permission issues as well. (#3525)

All 56 comments

Did this change happen suddenly?
What are your settings in the PM plugin admin area?

I noticed this on e107.sk and update is sometimes when 2.2.0 was out (but not latest github). I just haven't time to look at it. Mainadmin has problem on forum too, there is already issue about this.

The problem was on three sites, I don't think it was an accident. Version 2.1.9 on two sites and 2.2.0 on another.
Overwritten the plugin files from here and it worked.
https://github.com/e107-ru/e107-ru

@Evgura you shouldn't close this, there is problem

@Moc It happened is unclear and the cause has not been identified.
The settings are correct. I'm here in the thread read the relevant threads about private messages.

I have a feeling there's something weird going on with the userclass permissions. The forum seems to have permission issues as well. (#3525)

Bit of a mystery. The last real changes to PM happened in January 2018.

Admin works. Only Frontend:
image

This setting:
image

This debug:
image

Result:
image

So $this->pmPrefs['send_to_class'] is empty. Weird that USERCLASS is empty too. I am main admin.

PS. I checked value after
define('USERCLASS', $user->get('user_class'));
in class2.php and it's empty.

image

image
image

PHP 7.0

@Evgura What's your PHP version?

@Moc Version PHP 7.0

I suspect there's a PHP 7.x incompatibility issue. Will look into it asap.

@Jimmi08 Instead of using print_a(), try using var_dump() .

Updated today with Github and again the problem with personal messages.
PHP version-7.1.24

"System Information
You are not allowed to send PMs to: Maxim"

P.S. PHP: 7.0 Also not working

@Evgura Yes, no fix has been committed yet.

PHP: 5.6 Private Message work normally.

Trying to reproduce this on PHP 7.1, but no luck yet. Clean install of e107, and clean install of the PM plugin. What are your settings here?:

image

Yes, such settings.

Are the settings the same on your installation?

@Moc I wonder what ...
I have three sites on E107, and all three have stopped sending private messages after the update from Github.
Tried to change the PHP version and only PHP 5.6 everything worked fine.
If you put updates from the repository by the link above then everything works fine on any version of PHP.

I do agree that there is an issue, I am just trying to figure out what is causing the issue :)
Are your settings the same as I posted in the screenshot?

I tried different settings. And as in the screenshot too.

var_dump(USERCLASS);

string(0) ""

Please update from Github. You may need to reinstall the PM plugin (if you haven't used the PM system before, I recommend that), or at least delete the preferences and let the update routine do its work to restore the correct preferences.

Please let me know if this fixes things.

@Moc It's not working.

Did you reinstall the plugin? Or delete the preferences?

I just updated it through Github.
OK, now I'll try to do as you say.

Reinstalled the plugin, reset the settings. It's not working.

Is it possible to provide a website login and FTP access to your website? I cannot reproduce this at all so we'll need to debug this manually.

If yes, please contact me or Cameron on Gitter.

Posted for Tijn Kuyper on Gitter

@SimSync Can you help me with this please?

It seems this check is triggered:

if(e107::getDb()->update('private_msg_block', "pm_block_count=pm_block_count+1 WHERE pm_block_from = '" . USERID . "' AND pm_block_to = '{$to_info['user_id']}'"))
{
    return LAN_PM_18 . $to_info['user_name'];
}

On my localhost install as well as @Evgura's remote installation, the private_msg_block table is empty. Meaning there are no users blocked from sending, and the check should return false. On my localhost it does return false, ie. I do not get the LAN_PM_18 error message. On Evgura's website, the check is true, and thus the error message is displayed.

What could be the cause of this?

@Moc I have 4 site on E107 and on all 4 there is this problem with private messages.

@Evgura I understand and I'm trying to help you fix it. I don't understand what's wrong yet. I have asked you a question in Gitter. Please check :)

@Evgura Do you have PDO activated? If not, please activate PDO and try again.
Check the e107_config.php and add define('e_PDO', true); to that file.

The situation is, download the folder with the plugin (PM) from this repository and copy to replace your site. Everything works without dancing with a tambourine. Pour it into your repository and that's it.

The situation is, that the old mysql_* commands (which still work with php5.6) are deprecated and removed from php starting with php 7.0.
If PDO is disabled on you systems, this can cause strange behaviors, like not working db queries or unforseen results.
I'm not sure, if this is really the cause for your issue, because i'm not able to reproduce this issue in any way. But at least it's a possibility that your system has PDO disabled and this would explain it a bit.
And by the way, e107org/e107 is open to pull requests. If e107-ru fixed an issue, a pull request from his/her side is more than welcome. 馃槒

@Evgura the code in that repository simply comments out check that is triggered to avoid the error. That's not solving it, that's simply trying to bandaid things together. It just removes the check (actually removing functionality) rather than solving the underlying issue.

@SimSync Just enabled PDO (it was disabled) but the issue persists unfortunately...

@Evgura Are all 4 sites hosted at the same hosting provider?

@SimSync PDO is activated in PHP settings on the server.
@Moc you have access to the site, try it.

@Moc Yes, provider one but on different servers.

@Moc Gave access to the cPanel control panel on the Gitter

For me this was fixed with latest sync and reinstall PM plugin. Now it works with 7.1.25

@Evgura Are you able to implement a small change to one of the sourcefiles?

File: pm.php Line: 601 Change from:
if(e107::getDb()->update('private_msg_block', "pm_block_count=pm_block_count+1 WHERE pm_block_from = '" . USERID . "' AND pm_block_to = '{$to_info['user_id']}'"))

To:
if(false !== e107::getDb()->update('private_msg_block', "pm_block_count=pm_block_count+1 WHERE pm_block_from = '" . USERID . "' AND pm_block_to = '{$to_info['user_id']}'"))

To be clear: the false !== before the e107::getDb()->update is the change ...

@SimSync
Moc has access to the site and the files, so he can try to avoid confusion.

@Jimmi08 I tried reinstalling the PM plugin but it did not solve the problem.

@SimSync Made the change, no luck.

@Moc It's not from that website I told you the password given (cPanel). Go to gitter.

@Moc Please undo that change.

Just an update, not a complete fix yet. With the help of @SimSync we have identified the issue but are still looking into the best way to fix it. Updates will follow.

Tech info for future reference:
the db_query returns an object instead of the number of modified records. Maybe this is the issue with the php version. Because the result from the update is not true or false or an int, it's an object and therefore fails the comparison in the if clause...

Probably fixed with PR #3665

@Evgura If you update your websites with the latest files from Github, it should be resolved. You can also get the latest e107_handlers/mysql_class.php file (that's the only one changed to fix this issue).

I understand, thank you.

@Evgura Did you happen to have a chance to test this?

@Moc Updated with Github, everything works. Private messages are sent.

Great! Closing the issue then :) 馃憤

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Jimmi08 picture Jimmi08  路  3Comments

realmontazeri picture realmontazeri  路  5Comments

Norwayman picture Norwayman  路  3Comments

Jimmi08 picture Jimmi08  路  3Comments

simplythomasjay picture simplythomasjay  路  5Comments