Advertisement:

Author Topic: @mention members  (Read 188864 times)

Offline jsx

  • Jr. Member
  • **
  • Posts: 358
  • Gender: Male
Re: @mention members
« Reply #600 on: April 05, 2019, 04:04:24 AM »
@Dragooon

The selection does not appear in this checkbox:

Enable mentions e-mail for current members

Whereas, the selection appears correctly in this checkbox:

Enable mentions e-mail by default
The Great Winged Hussars

https://www.youtube.com/watch?v=eWkrQQly6xU

We remember
In september
When The Winged Hussars arrived!

Offline landyvlad

  • Sr. Member
  • ****
  • Posts: 869
  • Gender: Male
    • Michael Reed on Facebook
    • GSX1400 Owners ORG
Re: @mention members
« Reply #601 on: April 09, 2019, 02:00:16 AM »
For anyone wanting to explain to their forum members how this mod is used feel free to copy
http://gsx1400owners.org/forum/index.php?topic=477.0
to your hearts content.  Cheers
Please do not PM, IM or Email me with questions on astrophysics or theology.  You will get better and faster responses by asking homeless people in the street. Thank you.

To paraphrase Kindred: "There are no technical solutions to social problems."

No hack nor blackhats, just persistent asshats.

Offline grzeg8102

  • Newbie
  • *
  • Posts: 4
Re: @mention members
« Reply #602 on: September 24, 2019, 05:11:43 AM »
Great mod! Very useful. Since I started being a user of a Discourse forum I dreamt of something similar in my my own SMF forum I'm running.

@Dragoon - I'm only missing the mod to run also on the recents page ("/index.php?action=recent"). Can you please add it? Hopefully it's nothing complex and only requires the function mentions_post_scripts(); to be called in one more place.

BTW. I'd like to share my CSS for it - it tries to mimic Discourse mention style. Attached

Offline Shambles

  • SMF Hero
  • ******
  • Posts: 5,209
  • Gender: Male
    • i30 Owners Club
Re: @mention members
« Reply #603 on: December 04, 2019, 02:34:33 PM »
Under PHP 7.1, when unchecking Profile > Profile Info > Mentions > E-mail mention notifications:





The (bool) cast within Mentions.php is no longer returning 0 when false; it's returning null, causing the above error.

Solution:

Sources/Mentions.php

Code: (Find) [Select]
if (!empty($_POST['save']) && $user_info['id'] == $memID)
updateMemberData($memID, array('email_mentions' => (bool) !empty($_POST['email_mentions'])));

Code: (Replace) [Select]
if (!empty($_POST['save']) && $user_info['id'] == $memID)
updateMemberData($memID, array('email_mentions' => empty($_POST['email_mentions']) ? 0 : 1));

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,982
    • StoryBB/StoryBB on GitHub
Re: @mention members
« Reply #604 on: December 04, 2019, 02:42:39 PM »
(bool) returns true or false, which would need to be explicitly cast to numbers to make that work - false, by default, implicit casts to empty string, not 0, unless explicit-casting to int.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline Shambles

  • SMF Hero
  • ******
  • Posts: 5,209
  • Gender: Male
    • i30 Owners Club
Re: @mention members
« Reply #605 on: December 04, 2019, 02:48:18 PM »
Yep - that's what was happening. Must have been different under 5.6 as that seemed to return 0?

With the change above it I now get 0 or 1 (obviously) instead of null or 1.

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,982
    • StoryBB/StoryBB on GitHub
Re: @mention members
« Reply #606 on: December 04, 2019, 02:52:48 PM »
Nope, those semantics have never changed. I’m assuming it’s just always been left ticked - unlike false, true will convert to 1 as far as the DB library cares.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline Shambles

  • SMF Hero
  • ******
  • Posts: 5,209
  • Gender: Male
    • i30 Owners Club
Re: @mention members
« Reply #607 on: December 04, 2019, 03:22:54 PM »
I wonder how many people have tried to untick it? Not me, that's for sure.

I only spotted it when doing my routine checks on the error logs.


Quote
... unlike false, true will convert to 1 ...

That implies the original code has always been imperfect, as far as setting a 0 or 1 into the int-only DB space.

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,982
    • StoryBB/StoryBB on GitHub
Re: @mention members
« Reply #608 on: December 04, 2019, 03:32:18 PM »
Yup, it very likely has.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.