mybbstuff / myalerts Goto Github PK
View Code? Open in Web Editor NEWA simple notification/alert system for MyBB similar to IPB and XenForo's core implementations of user notifications.
Home Page: http://www.euantor.com/myalerts/
A simple notification/alert system for MyBB similar to IPB and XenForo's core implementations of user notifications.
Home Page: http://www.euantor.com/myalerts/
Here I am with some enhancement suggestions for future updates of MyAlerts.
When I open the notifications dropdown, than click any other part of the page the dropdown should close; it currently remains open.
Users should be able to enable/disable certain types of Alert via the user CP.
Hello,
Forgive me, I'm not very technically minded, but hopefully I can explain the problem which I am experiencing. I have MyAlerts installed and everything is working awesomely apart from when anyone clicks on "Alerts Settings" within the User CP. The following error message appears:
"/home2/chrisjef/public_html/yrea.org.uk/community/inc/languages/english/.lang.php does not exist"
Any ideas how I can fix this problem? Its not impacting on the running of the plugin as such, but it does mean people are unable to change their settings.
Thank you in advance :)
Also while I'm here, how could I make it so the alerts notifier in the welcomeblock is red and bold when there are new alerts? Would be a good feature to make it more noticeable.
This error occurs on activate due to the task being added. More details here: http://community.mybb.com/thread-127444-post-926710.html#pid926710
I installed Myalerts plugin on my forum.
http://postimage.org/image/lgqji4fkr/
How i change style, colors?
As the title says. A couple of friends on our gaming forums mentioned that they were not getting quoting alerts. All the other alerts fine for them but for the quotes, not so well. They literally are not getting any mentions for when they are quoted.
I think I might have an idea why this could of happened but I could be wrong. When our forum was going up, one of our mods was changing some people's names since they wanted a space or something in their name. For example, there was guy named EternalBlaze. He wanted a space in his name so my friend changed his name to Eternal Blaze. Could this possibly have affected the alerts scripting or something? I'm saying this because he now doesn't get quote alerts anymore.
I also have a friend with the username BusterCannon and he says that he doesn't get quote alerts either.
Is there a way I can fix this problem? I was even thinking that it would be fine if I could get a true fresh install of MyAlerts as well if it could solve the problem. I have tried reinstalling/deactivating and even deleting files off the FTP and uploading again but that still did not garner them the quotes. Maybe there's a real correct way to put a fresh copy on the forum? Like I said, I don't mind doing a real clean install again and deleting my old MyAlerts if it'll cause this problem to stop and them to get alerts.
I do not know if this is a bug or not, but when you click on the alerts, it reads all of them automatically. Could you somehow make it to where only when you click on the specific alert, that it reads it? And then also include a "read all" along the side taskbar (above delete all alerts), or checkboxes and then an option to "read all checked." Thanks! :D
Btw, I LOVE this plugin!
Doing so results in an odd state where the plugin is installed but not activated-- I think just moving the conditional redirect will solve it.
Hi.
I used My Alerts old versions on my forum. (forum.gameofthronestr.com) But plugin is broked. Now, i see My Alerts new version and i tried install this plugin again. When installation is complete plugin not work. Alert place is seems but if i click on alerts is not work. And i install another mybb on another subdomain and i try to install plugin again, and plugin is work.
How i use that plugin on my forum? What do you suggest?
I've taken a look around and I don't see any in-forum docs that instruct users on how to use MyAlerts. These should be included either in the UserCP MyAlerts area (upcoming feature, as I understand it) as a tab, similar to tabs in th ACP, and/or the help page. I'd be happy to help write them.
Is there any way to check if the user can view a thread anymore before sending an alert of a reply? I have a past moderator on my site that is still getting reply alerts for threads that he no longer has access to.
If it helps any, I recently altered the code for the old Sidebox plugin that I had installed so that it was more similar to the normal Portal page code. Specifically, I ported in this portion:
$forumpermissions[$thread['fid']] = forum_permissions($thread['fid']);
// Make sure we can view this thread
if($forumpermissions[$thread['fid']]['canview'] == 0 || $forumpermissions[$thread['fid']]['canviewthreads'] == 0 || $forumpermissions[$thread['fid']]['canonlyviewownthreads'] == 1 && $thread['uid'] != $mybb->user['uid'])
{
continue;
}
Under the while statement:
while($thread = $db->fetch_array($query))
{
Could something like this be useful or used just to check those permissions to avoid people getting alerts for threads they can no longer view?
Thank you, and awesome work on this plugin!
It seems you've spelt receive as recieve.
(Or you have in the screeny here http://community.mybb.com/thread-127444.html anyways ^_^)
If you remember, i before e except after c :P
Hi euantor,
I tried to send a "mass mail" (with PM option active) from ACP to my users and they didn't receive any notification of the received PM. A small bug which I'm sure you'll fix in the near future :)
Not sure if this is MyAlerts, but when I disabled it the problem went away. Too tired ATM to be sure :P
When you make a new reply, save it as a draft, edit it, and then post it, you get the following error:
SQL Error:
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LIMIT 1' at line 1
Query:
SELECT uid,subject FROM mybb_threads WHERE tid = LIMIT 1
Something odd - I cannot style the header icon template. It keeps reverting, I hit save - it saves - boom - back to default. I can save other templates, but not the MyAlerts set.
When I uninstall the plugin and then reinstall it I get two myalerts_headericon in header_welcomeblock_member and now I have three . . .
I don't know how to post a screenshot as I made this account just to report this issue. 😊
In the process of writing my previous issue, I thought of adding a filter feature to the alerts page. The thead on the top of the alerts list could have a drop down, a small inline list of links that trigger filters of their alerts, a search input box, etc. Some could have an even more specific selection method which would allow granular control of the results. A few possible filters are:
-Filter by forum
-Filter by user
-Filter by type (e.g. quotes, PMs, subscribed forums, etc.)
-Filter by time
As for implementation, I believe there is a way to filter with CSS, but a more reliable approach would be to use a jQuery plugin, such as Tiny Sort ( http://tinysort.sjeiti.com/ ) Quicksand ( http://razorjack.net/quicksand/ )
Another small feature that doesn't deserve it's own issue is the possibility of color-coding the notifications' backgrounds by type, e.g. PMs = light yellow, quoted = light gray, subscribed = light blue.
When browsing as a guest, var unreadAlerts is undefined, and this causes a javascript error "Unespected token: ;".
It should be:
var unreadAlerts = "";
Whereas actually is:
var unreadAlerts = ;
A feature that could be neat to have is notifications on a per-forum basis. This means that a forum ID could be passed to the getNumAlerts() (and, similarly, getNumUnreadAlerts()) function and it would return the number of alerts contained within that forum.
One possible use of this feature is to insert a div in the thead of a category or next to a listed forum's name that shows the amount of notifications in that forum.
Can you add the Feature, if someone has installed ProfileComments, that an Alert is shown if you get an Comment?
Where the user-cp is in the navigation; the drop down menu for dropping down isn't working. Rather than showing the alerts, it drop down til the bottom of the navigation bar, only showing a small thin white strip.
So I disabled, uninstalled and reinstalled the plugin and activated it. It works like usual, but when you click on Alerts (x) on the index to check what alerts you have, it opens and then it closes right back. So basically it opens and closes repeatedly.
I then thought I would try to reinstall everything and even reuploaded it to it's proper folders in FTP and then installed it again. It still persisted with the opening and closing which is causing a lot of ruckus with the forum members. How can I get rid or install it correctly so it doesn't occur?
I think this is happening since it thinks there's still an alert script or something located on the server and maybe they're colliding with one another but I'm sure I removed all of the remains of script. When you do get an alert in the tab usually you see the site name and a (number) for when you have a alert such as if BigForum was your forum, in your tab it would say BigForum (1). As of now, it says BigForum (1) (1) as an example.
This is probably another reason why it's opening and closing since there's two alerts or something but I'm not sure. I did a clean swipe of the files and everything but no dice. Any clue as what I can do for this or even do a actual clean install again? It's completely not working and annoying our members. Thanks in advance.
On my VPS (Ubuntu 12.04 LTS - nginx 1.1.19 - Percona MySQL 5.5.28 + PHP-FPM 5.3.10), I am running Google SEO and encountered a 500 Internal Server error only when browsing threads. Not forums, just when thread urls were being rewritten.
2012/12/03 22:09:02 [error] 15674#0: *6 FastCGI sent in stderr: "PHP message: PHP Fatal error: Call to a member function load() on a non-object in /home/[REDACTED]/public/www/inc/plugins/myalerts.php on line 683" while reading response header from upstream, client: 199.27.128.86, server: gamervoid.net, request: "GET /thread-what-are-you-listening-to HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "gamervoid.com" .
Line 683 is the plugin calling the $lang->load() method. It's bizarre to me because $lang should be an object.
The my alerts pushes user cp below. Here is a pic of what I mean http://gyazo.com/f86081080adb727b096b761010267da2
Something that could be potentially useful is an interface for admins to somehow add a alerts to users' feeds. There are a few choices to consider if this is chosen to be implimented.
We'd have to decide whether the admin can add notifications on an individual basis, to entire groups only, or to all users. We'd also have to choose whether the admin can to post an alert with a custom title and message (with a set amount of characters so as not to break the styling) and/or link, or just post an alert with a title and a link to a thread (because communicating with users via alerts is probably not the best way to do things).
One thing that might worry some is abuse. It's my belief that providing a good feature should override the idea of abuse, for two reasons. First, delivering features is more important, in my opinion, than stopping the possibility of an admin being an idiot via MyAlerts. Second, if an admin is going to abuse his users with MyAlerts, he'll find a way to do it without MyAlerts.
Thanks for your consideration.
The Settings page in the UserCP doesn't have any breadcrumbs added.
./inc/plugins/myalerts at line 1049
I suggest replacing
if (!$lang->myalerts) {
$lang->load('myalerts');
}
with
if (!$lang->myalerts) {
$lang->load('myalerts');
}
add_breadcrumb($lang->nav_usercp, 'usercp.php');
add_breadcrumb($lang->myalerts_settings_page_title, 'usercp.php?action=alert_settings');
I'm planning on adding an administrator area to MyAlerts in the master branch that will handle the forcing of alerts for all current users, alert settings and manual alert pruning. This isn't a massive task, but it will be a useful addition to the codebase.
I'v quoted, Repped members no-ones getting any alert?
If you would be willing to, and it isn't too much trouble, could you integrate a way to tag users and have the receive an alert when they have been tagged?
Here is an example:
@euantor
You would then receive an alert telling and linking you to the exact post that you were tagged (the same as what happens with quotes).
Also, I am having a slight styling issue on my forum with the alerts. I know you probably do not support bugs in styles, but could you give me a few steps to remove the odd line and turn the alerts into a button (or a background with text over it to support the number of alerts). If not, it is fine, I will eventually figure it out after digging through your code xD. Thanks
So I feel that the notifications circle could use a better design. I know Eric J. made a small tutorial for a rectangle with some styling that MyAlerts could use.
A small stylistic feature that I like is having the alert box be hidden or gray when there are no new notifications, and visible or colored when there are new notifications.
If we were going to do something like this, we could also include a field in the settings to change the color or set a background image (or a checkbox to use the thead styling?) for the background of the notifications circle.
Unread alerts stack up when user has an alert type disabled. For more info, see here: http://wweforums.net/showthread.php?tid=14253
The only fix I can think of right now is a modification to the cleanup task.
A board has MyAlerts and Plugins Alerts Pack installed with subscription alerts set to on. Users who are subscribed to a thread or a Forum receive an alert as like as an email every time another user posts to a thread.
User A replies to User B's thread, both User B and User C are subscribed to it.
In normal circumstances, MyAlerts should prepare 3 alerts:
But MyAlerts is smart enough to store in User A's session the alert's tid and type: it should prevent Users B and C to receive 2 alerts for the same thread or "event".
Actually, it doesn't. User B will receive correctly his thread replying alert and the subscription alert won't be generated. But User C won't receive any alert, even if he should have received one.
This happens because User A's session is populated with too few data. It will look like this at the first call (after the thread replying alert is delivered):
$_SESSION = array(
"tid" => 150,
"type" => "post_threadauthor",
...
);
The next alert would be the thread subscription alert for User B. MyAlerts checks for subsequent calls for the same event:
// 150 == 150 (true) AND subscribedthread != post_threadauthor (true)
if($tid == $_SESSION['tid'] AND $type != $_SESSION['type']) {
return;
}
Alright. This alert won't be delivered, and that's our goal. Let's skip to User C alert.
// 150 == 150 (true) AND subscribedthread != post_threadauthor (true)
if($tid == $_SESSION['tid'] AND $type != $_SESSION['type']) {
return;
}
It's exactly the same as before, so User C won't be notified. Here stands the "bug", and should be corrected. How? Just associating the uid parameter as an unique identifier for a specific user.
Reported at WWEForums. The user
lil' tit
had this issue.
http://wweforums.net/thread-19903.html
Issue doesn't seem to relate to escaping or anything, possible problem with the regex?
What's up euan! I'm writing down another plugin for MyAlerts which will feature the ability to push custom alerts to specified users.
First of all, I'd like to ask you what it's better for you: an external plugin which allows to do so, either a MyAlerts update to a major version. In this last case, I might have to merge the actual plugin I wrote with MyAlerts itself but it won't be such a boring and long work :)
Secondly, I almost finished writing it, but I encountered some problems during its development.
function myalerts_pre_output_page(&$contents)
{
global $templates, $mybb, $lang, $myalerts_headericon, $Alerts, $plugins;
if ($mybb->user['uid']) {
if (!$lang->myalerts) {
$lang->load('myalerts');
}
try {
$userAlerts = $Alerts->getAlerts(0, $mybb->settings['myalerts_dropdown_limit']);
} catch (Exception $e) {
}
$alerts = '';
if ($mybb->user['unreadAlerts']) {
$newAlertsIndicator = ' newAlerts';
}
if (is_array($userAlerts) AND count($userAlerts) > 0) {
foreach ($userAlerts as $alert) {
$alert = array_merge($alert, parse_alert($alert));
if ($alert['message']) {
eval("\$alerts .= \"".$templates->get('myalerts_alert_row_popup')."\";");
}
$readAlerts[] = $alert['id'];
}
} else {
eval("\$alerts = \"".$templates->get('myalerts_alert_row_popup_no_alerts')."\";");
}
eval("\$myalerts_headericon = \"".$templates->get('myalerts_headericon')."\";");
$contents = str_replace('<myalerts_headericon>', $myalerts_headericon, $contents);
return $contents;
}
}
In this function, you check for new alerts calling $Alerts->getAlerts method. Looking at it in Alerts.class.php:
public function getAlerts($start = 0, $limit = 0)
{
if ((int) $this->mybb->user['uid'] > 0) { // check the user is a user and not a guest - no point wasting queries on guests afterall
if ($limit == 0) {
$limit = $this->mybb->settings['myalerts_perpage'];
}
$alertTypes = "'".implode("','", array_keys(array_filter((array) $this->mybb->user['myalerts_settings'])))."'";
$alerts = $this->db->write_query("SELECT a.*, u.uid, u.username, u.avatar, u.usergroup, u.displaygroup FROM ".TABLE_PREFIX."alerts a INNER JOIN ".TABLE_PREFIX."users u ON (a.from_id = u.uid) WHERE a.uid = ".(int) $this->mybb->user['uid']." AND alert_type IN ({$alertTypes}) ORDER BY a.id DESC LIMIT ".(int) $start.", ".(int) $limit.";");
if ($this->db->num_rows($alerts) > 0) {
$return = array();
while ($alert = $this->db->fetch_array($alerts)) {
$alert['content'] = json_decode($alert['content'], true);
$return[] = $alert;
}
return $return;
} else {
return false;
}
} else {
throw new Exception('Guests have not got access to the Alerts functionality');
}
}
You select all the alerts in which alert_type
matches with currently enabled alert_type
settings for the user you're getting the alerts for.
The ability to send custom alerts doesn't need any setting because its aim is to allow admins to easily push updates and, for example, rules updates to their users. But this isn't possible with the actual configuration.
The solution is quite simple, add a "forced" column into alerts table and act depending on its value. It might be useful for other developers who want to avoid adding user settings and forcing the alert display in the drop down list.
Just tell me what do you think about it and I'll open a new Pull Request if you agree with this little change I've just suggested you.
I have been doing some testing - seems good - but I was a bit ARGGGG that the reputation does not link over to Tomm's Post Rep Feature from MyNetwork.
I know you really don't want to tread on his toes, but that is a major downer (for me at least, and probably Brad as well).
Rather than adding to the MyAlerts plugin (I read on MyBB that you were not keen to do that), any chance of a wiki article on how to integrate it ourselves? Assuming you know how of course.
Hi euan,
I succeeded into making the quoting function work together with my own edits thanks to frostschutz help. Now I'm testing it and I have a suggestion for you: it would be great if notifications would be sent also when an user modifies his own post (in general, when a post is being edited) and adds another quoted message.
I told you that this would be quite simple, here it is: https://github.com/MyAlerts/Plugins-Alerts-Pack/blob/master/inc/plugins/pluginspack.php :)
I didn't test it intensively but it seems to work fine for both threads and Forums subscriptions, without any extra query.
I know you've mentioned you want to add the ability for users to manually delete alerts and to have an enhanced alerts listing page, so I thought I'd provide some specifics on how I would like to see this implemented in the plugin.
Just so PR can have full compatibility can you modify these lines for me (pretty please, ~1300)?
if ($settings['myalerts_enabled'])
{
$plugins->add_hook('xmlhttp', 'myalerts_xmlhttp');
}
function myalerts_xmlhttp()
{
global $mybb, $db, $lang, $templates, $plugins;
to
if ($settings['myalerts_enabled'])
{
$plugins->add_hook('xmlhttp', 'myalerts_xmlhttp', -1);
}
function myalerts_xmlhttp()
{
global $Alerts, $mybb, $db, $lang, $templates, $plugins;
Shouldn't have any issues with anything but lets MyNetwork use the $Alerts variable.
Currently all alerts are off by default upon plugin installation. @euantor has graciously offered to help with a script to turn all alerts on by default but I think there is a simple way to keep the current structure and have alerts enabled by default.
Why not rather than storing a positive value when the user enables an alert type, use the method that most cookies use for visibilty: only store a value if the alert should be disabled. In this way, the plugin could check to see if there was a value stored for that alert type, and if so _only then_ would the alert be considered disabled.
This would eliminate lengthy loops to update alert settings and it will be a lot easier for admins to explain that people may need to disable alerts they don't want rather than trusting in people to read announcements rather than thinking the alerts are just gone (and possibly generating a lot of support threads).
imho if alerts are disabled by default it is a serious negative for the plugin and all plugins that are integrated with it.
With respect always,
Wildcard
If you are to add a user that doesn't exist to your buddy/ignore list MyAlerts sends a SQL error instead of the "user doesn't exist" language string that is normally sent if you don't have MyAlerts activated.
I'm not sure if you talked about this, but is there a way for the alert number (in the nav) to update without me having to refresh my page? I have the setting at 5 but it's not updating the number unless i refresh the page.
Is the option for "MyAlerts page AJAX autorefresh" in terms of minutes instead of seconds? Or ...
When a user doesn't have an avatar a missing image is generated.
Using MyBB c54a812 w/ MyAlerts 1811083
User settings are currently not handled very well in that they're serialized into a column within the suers table. This makes life hard for 3rd party developers extending MyAlerts and is just plain ugly.
To solve this issue, 2 new tables will be created.
myalerts_settings
id INT(11) NOT NULL PRIMARY KEY;
code VARCHAR(50) NOT NULL;
myalerts_setting_values
id INT(11) NOT NULL PRIMARY KEY;
value INT(1) NOT NUL DEFAULT '0';
setting_id INT(11) NOT NULL;
user_id INT(11) NOT NULL;
Actual settings are stored in the myalerts_settings table. Setting values are stored in the myalerts_setting_values table. The code column in the settings table relates to a short code which will be used in the language string. EG:
code: core_buddylist
language string: $lang->myalerts_setting_core_buddylist
This should make life much easier for developers.
I will also have to create a short upgrade script for old plugin versions to migrate previous settings to the new version of the plugin.
I feel that using /misc.php?var=value to contain the alerts page doesn't hold the plugin to the highest standard. I think, if it's possible, using /usercp.php?action=alerts would be best. If however that's not possible, having a dedicated page, such as /alerts.php, would be the best alternative.
Great work today with 1.04 release! However I've just noticed there isn't this feature request here on GitHub, so I'll add it in case you forgot it: many users - me included - requested a new alert type for when an user posts in a thread you are subscribed to.
I'm quite busy but I can help you writing down at least the first lines of code if you'd like it.
Settings still aren't very nice to play with, are they @Shade- @WildcardSearch? Talk to me about how I can make things easier. I only realized how annoying they are when working on an integrated plugin of my own.
The Settings page in the UserCP doesn't have any breadcrumbs added.
./inc/plugins/myalerts at line 1049
I suggest replacing
if (!$lang->myalerts) {
$lang->load('myalerts');
}
with
if (!$lang->myalerts) {
$lang->load('myalerts');
}
add_breadcrumb($lang->nav_usercp, 'usercp.php');
add_breadcrumb($lang->myalerts_settings_page_title, 'usercp.php?action=alert_settings');
In the old build, I think 1.2, the settings would automatically be checked to receive alerts for my friends made a new account. Since I have moved over to the 1.4 patch that fixes the default avatar, the settings are not enabled upon registration and just in general anymore.
I was wondering how I could fix this or if there's a fix for this so that users will already have their alert settings on by default and THEN they can change some of the settings off if they don't want that alert to come up. Thanks in advance and great work!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.