It is, under certain conditions. Firstly, the parent class must be loaded (or invokable through an autoloader) before the child class, and secondly whatever invokes the child class will need the full class name and that seems a bit long for the current system.
It's a bit fucked up... First of all, the notifiers aren't auto-loading, they're explicitly loaded and invoked in the initializer, and a hook is used to allow for other notifiers to plug into it. Seriously..?
:-/Wouldn't it be simpler to, I don't know... Force Notification::issue to require getNotifiers('Likes likes') or 'Likes:likes', or whatever structure that calls for the file to be loaded if not already done..?
Same for any situations where the 'likes' notifier is requested, anyway.
Autoloading is currently tricky because the class names don't really match the filenames but we could do something with it if we wanted.
Hmm, I think they do..? (Once you ucfirst them, of course...)
See, there's more potential for likes than we're currently using; there's no reason why we couldn't attach likes to media items, for example. I know media items have ranking, but I can see the use for likes on media items as an additional option.
It's actually quite tempting to ditch media ratings in favor of likes, but in that situation, things like fox.noisen.com lose some of their interest, at least for me -- since I like giving very precise ratings to these audio files. But really, in 95% of the cases, a like would even be preferable, because it's much easier to 'grasp' for users, who these days are so incredibly lazy...
:P(BTW, I'm surprised that id_object doesn't even get its own key..?!)
It'd be better served as a key on (notifier (6), id_object) really from what I remember.
Dunno if it matters that much -- if id_object is included as "AND id_object ...", MySQL will prioritize the first test (if it's keyed) before this one, right..?
Posted: June 24th, 2013, 11:14 PM
I want it to be impartial, plus you got a huge freaking gallery inside the forum so I'd doubt that it's just a forum :P.
Oh, you have no idea how many times I regretted including AeMe by default in Wedge...
:^^;:Not because it's not maintainable -- it is -- but for two reasons:
- too many 'loose licenses' in the code, meaning it's currently not compatible with Wedge's, and it will eventually force me to change most of the libraries to make it work, while I wouldn't have had to do it (so soon), had it been a plugin...
- my original plan was to ditch the attachment system, and replace it with media items uploaded to a default, fallback 'attachments' folder. Hmm... Well, I never got around to do that. Too much attachment code, too many things to change entirely. I could have done it at the beginning... But three years later, I'm just wary of huge code overhauls, and I don't see myself ever doing it, which is a pity...
And it was a good idea, and it should be extensible. Maybe a crazy plugin author gets a good idea and implements something else for their notifier, it doesn't hurt to keep that option open.
And a good idea from John, I think..!
Notifications.php is the "controller" here, it handles the notifications logic. If you have a better name go ahead, but I've thought a lot about my code and to me it makes perfect sense.
Why is Notifications a plural, and Class-Notification a singular, for instance..?
:PWhy is weNotif called that way (Wedge standard is "wefirstletters", all lowercase), and why is it an object to begin with?
Hm, maybe. Notification::issue kind of made sense to me since Notification class is sort of the "model" for doing the DB interactions with individual Notification rows. Although it can be made different, not sure.
issue_notification, really, and everything that's in the issue method...
Notification::issue($id_author, WeNotif::getNotifiers('likes'), $_REQUEST['msg'], array(
'topic' => $topic,
'subject' => $subject,
'member' => array(
'id' => we::$id,
'name' => we::$user['name'],
),
));Possible change...
issue_notification($id_author, 'Likes likes post', $_REQUEST['msg'], array(
'topic' => $topic,
'subject' => $subject,
'member' => array(
'id' => we::$id,
'name' => we::$user['name'],
),
));With the second member meaning: Likes.php notifier file, 'likes' notifier name, 'post' type.
This way, I can easily do a notification for a thought, with 'Likes likes thought' for instance... Likes.php could then get the 'thought' request, and if it doesn't support it, make a request to something, so that it autoloads it... From a plugin, for instance. But I'm not a specialist of object management, so... It's a bit over my skill level, I guess.
After that, in the database, either store as 'likes_thought', or as 'likes' with an extra field called 'type', as I suggested... Thus, id_object would immediately reflect the type of item it relates to; really, if you want to get all notifications related to post #123, you can't simply search for anything with id_object=123, since this would also return all notifications for thought #123 or media item #123, wouldn't it..?
Ah well...
I'm currently holding my changes, been doing so for a week now, I don't know where to go...
(Mind you, this isn't the only thing I've been stuck on; I'm very, extremely stuck on getting infinite scrolling to work 100%, and despite several internal rewrites, I still can't get it to behave better than it currently does.)
(I made it work on mobile devices, though... Which is an achievement of sorts, but it needs more love
:P)
Also, I modified your template to ensure that the periodical e-mail doesn't use any HTML, which it did in your version, hmmm... Who cares, this e-mail has yet to be sent to anyone, anyway...
:P