 So that's from the message issue queue and Obviously when I read it I felt ashamed Because I do make a fuss about the message model and regarding that commerce stuff I still have a really sad memory of Ryan from commerce guys Literally on his knees begging and crying and saying no let's have one product for each variation And I was like nah, we will have one million products and And and I felt ashamed because you know this guy is using my model And he doesn't work for him and now we need to lose more time in getting into the issue and write a new issue So I've decided to rectify that problem and I've invented and actually developed the RAG EAG commonly known as the ridiculously annoying issue generator or in short rage so The idea of rage is that it automates your issue submission So in the first version, I actually had one checkbox Obscure back complexity and when you submit it It basically finds an issue that already has tons of comments and adds another comment And it makes sure to add a lot of low quality information there and Why are you laughing? It's serious and And just in case you the maintain it don't have enough low quality information It will make sure to zip the whole internet and attach it to the issue But I told myself that I could do better I could make it obscure even more obscure So I changed the checkbox to obscure and when you submit it It creates something like can create work a group. It doesn't work But I'm a perfectionist, you see and I told myself I'm a tie. You can do better than that So I made the obscure checkbox obscure and now And now when you submit it, it just says can't and it won't Next we have the checkbox saying every piece of information is equally important And I think it's pretty self-explanatory what the output is After that we have the assume the maintainer knows everything Nay, assume the maintainer knows everything in every possible language And when you submit it the output is this error Who knows which error it is it's in Tamil that's the the clue that I can give you It's the maximum function testing and I'm using google translate to help me with that and Thanks. Thanks to to google translate it to google translate I've actually realized that it's also a cultural thing because The same error has different severity level in different languages So for example, if I'll ask A google translate to read out like the English version. It sounds like that Fatal error maximum function nesting level of 100 reached aborting So you can hear by her tone. She's not really mad at you or angry But she's kind of disappointed and that's the Spanish version To better understand the next checkbox, I would like to read a little poem Once upon a time there was an issue and now it is fixed and now it is closed and now it is dead So the next checkbox is called resurrection when you click on When you click on the checkbox You have a slider with the issue q etiquette awareness And you're able to change the different levels and basically when you submit it when we're starting with the minimum Like the the the lowest level it will find an issue that is already closed for years And the next step that it will just set it to active After that it will set the the start the priority from From normal to critical and of course it will not fail adding a comment such as Setting to critical as I'm on a tight schedule And of course me as a maintainer you can You can guess how I React I screamed at the office everybody stop this guide is on a tight schedule Next is setting the status that needs review meaning that you as the maintainer you need to review What this guy is saying? And then if you take the slider the issue q etiquette awareness slider all the way to the maximum It will do the most insulting thing It will set the status to needs work meaning that You the maintainer you thought you fixed it, but you need to work on it just a little more And after I finished working on On rage on on that version. I have actually realized that rage can also cater the maintainers And this time I don't need the checkbox says and fancy widgets I think it's just enough to have one button saying generate response. So when you click on it, it just generates a response so organic groups I have I had quite a few sessions and postcards and blog posts about the basic concepts of organic groups So I'd like to take advantage of this presentation and talk about Some more advanced concept and we will talk we'll start with the selection handler Which is actually applying not only to og it's part of the entity reference So it applies to entity reference in drupal 7 and it applies also to entity reference, which is now in the core of drupal 8 So What do we have here? We know og the basic staff we have group and we have group content and it's a group and permission on the on the Group level and it's working nicely with field api in entity api and views and so on But let's talk about that idea of selection handlers. So over here. I have a post. This is a group content So I see the title and I see a group audience field now I'm as an administrator I see two widget one is the your groups and one is the other groups and remember your the your groups is changing from user to user So amityze use your groups is different from jim's your group or or john's your groups and What i'm seeing over here that your groups I call it a field mode in in og didn't have a better name So this is the default field mode every user will she will see it and the other groups This is only for privileged user. I call it the admin field mode so og is taking advantage advantage of the fact that Entity reference is plug pluggable and it allows us to have our own logic when we are creating select when we are creating sorry Have our own logic when we want to fetch values into the your groups so For example, if I go to the group audience field settings and I've enabled the model called organic groups example This is part of the og package. I have a new selection handler that I can now change So looking a bit into the code This is og and I have og example plugins entity reference selection And let's have a a tiny look at the code. It's not really important What's written over here just to understand the concept. I have the og example selection handler I have the function build entity field query, which is basically the function that builds the logic of saying Which groups should appear in the your groups and which one should appear in the other groups And in the og example i'm doing a really silly example saying if the field mode is default meaning a Meaning a normal user then show me all the groups that are below node ad 5 Otherwise, if I'm an administrator in the other other groups show me all the node ideas that are above 5 and in Drupal comments, uh, we took advantage of that acquires Drupal comments and We've written a selection handler for Drupal comments that allows People to post content into groups. They don't belong to up until now that was not Let's say easily possible in Drupal 7 and now thanks to those selection handler You can have it for example in Drupal comments, but this is now also now part of og itself out of the box You're able to have create permission meaning create create node permission for non-members And this is using entity reference prepopulate Up until now up until now we didn't have that and every time People were asking me why we don't have it I was saying because we don't have enough context and I like to explain For example, if I have a group content a certain node that is associated with the other groups and the user comes and wants to Edit that node Then the og system knows which groups to ask is that user allowed to edit that group But when I'm creating a new node, it's still not associated with any group. So I cannot know it However, if I go to node at post right now in the og's new version if I go to node at post Under your groups. I see nothing However in the url if I pass it the field name and the group id Then og is smart enough to know that That group should be populated and it checks if I have the permission and then he uses it uses it Multiple sorry multiple group audience fields This one is one of the reasons why I rewrote og the second time and Because at first it was really hard coded to the field called og group ref But it's no longer hard coded and again using an example Drupal comments. I will I will try to explain this concept. So In Drupal comments They want to have what they call trusted contacts. It's basically a mini facebook So not only a user can post contact into different groups, which are nodes. They also want to have This feature that will allow a user to have friends Okay, like in facebook and they'll be able to To post content in To themselves So basically what we were saying since we already have the og infrastructure in place We're saying okay each user is actually also a group So I'd like to go over the different The different screens so we'll better understand the flow of how we built it. So we have here The users The account setting fields we can see that og out of the box has just one field called group membership Through that field that's an entity reference field a group audience field Which is referencing nodes different nodes that the user belongs to So in order to have that functionality the trusted content functionality We go to the og field settings. We make a we Make a user also a group a bit confusing but that's the way it is And we also had another group audience field remember multiple group audience field Now that's that's the second field and the second field. I call it this time trusted contact So now again in the account settings fields, we can see that the user now has Is a group okay just by adding that field that that group field and a second field called the trusted contacts After that I create a new og membership type Okay og membership That's the entity and it can have different bundles like node can have different node types So different bundles article page and so on so does og membership So usually when you use og then The membership is the default It's the default bundle that you can have as many bundles as you want and you can attach different fields to it and so on so Back i'm looking at the trusted content fields and I click on the edit link and then in the field settings I'm able to say that the target type is a user meaning I'm going to reference groups which are users and when I'm going to reference it when I'm going to create a new membership I'm going to create it through the trusted contacts membership And now when I'm going to a specific user user one edit for example I can see I have two group audiences and each group audience is referencing its own groups And here lays all the power because you can have as many group audiences as you want with different settings One can have can be required in multiple value and the other non required with with one value And for the coders among us if you want to attach if you want to associate Two content together then you use the function og group, which is the api function But have a look that i'm Creating that association through a specific field called the trusted contacts That was the most hard Concept to explain from here. It became it it becomes easier So when we have that now it makes more sense that we have the roles and permission per group type We didn't have that before so I can have completely different roles. I'm talking about og roles Not site-wide roles. I can have completely different roles for the node and group And for the user itself different roles and different different permissions The people page was also overalled and now what we are seeing here. That's Completely views. Okay. Nothing is hard coded here even the group over you on top. This is just An area handler. You can you know remove it or change it or move it to the footer or whatever you want And down below this table is again using views and views bulk operation to have different actions So you can set different roles. You can set different status active active pending block and so on And you can now also edit the membership directly From that table if you have the right permission and change the different fields So you can change maybe the request message, but maybe you have exploration dates attached to it donations or whatever You can do that query magic so We know that the post is referencing a group Using entity reference But we're actually not using the field storage Meaning that if you go into in the database in the table of the field, there's nothing over there We actually use the og membership entity to do that referencing and the reason we are using it Is because we need some metadata. It's not enough to say this post is associated with the group We also want to know when was it created? What is the state active or pending and we can add different fields to it So even though we don't have that information in the field storage We can still have such a query saying Bring me all the nodes which are referencing through a group audience field as specific group And through some black magic and voodoo. It will actually work Accessibility so This one is again back to back to the issue q. I saw this issue not long ago asking to evaluate og for accessibility and We've actually seen this page before that's the first page. I thought about that This page should definitely have should be checked for accessibility. I had some doubts and I was really I really I was really curious so I downloaded a screen reader and It's pretty pretty amazing how smart screen readers are and how they can analyze the page and I actually recorded it And I want I want you to hear bundles post group Fields group audience group group group group group group group group group Holy crap. How many more groups? Oh my god. This page sucks. I adjust a screen reader I can't bear it any longer Please make it stop Patches are welcome So first we had the message model and now we have the message stack The message stack is composed of three different models message message notify and message subscribe message is Probably the important model is and it's what's doing the heavy lifting So the idea of message is that it allows us to create Different activity stream Activity streams and it has zero assumptions regarding how I want to create those activity streams So to better understand the the the concept of what the Message is we have different message types It's equivalent to saying like we have a no type right article page and so on We can have different message types and those messages are basically templates of events that happen So I can have for example, you can see No, you can't because it's It's too tiny Imagine that you can see that It's basically some html saying a link to a user that created a link to some title using some Drupal tokens And it has also a special token Which is hard to see which is just at site and with curly brackets instead of the The normal brackets and we'll talk about those tokens later And when I go into the message type itself and I edit it So I see some information. What's the name of the message and so on But I also see the message text. That's a field that's a normal field with multiple values And it has different deltas and each delta I call a partial for some reason. I don't know That's the way how I call it and in each delta you are you are able to have your own Own text so on delta zero or partial number zero I have the text saying What we saw before the user that created something something and in the second in the second partial we can see Wow, in the second partial we can see that there is a token And a token that brings the nodes teaser We can also attach different fields to those message types. For example, the node reference fields So we can have our own logic going on there And like I said message has zero assumption regarding Regarding how you're going to use it is not as smart as a screen reader So we cannot read its own its own text. So it's up to you the implementer to To create new messages. So if you will enable the message example model, it's part of the Message part of the message package. You can see that we have here hook node insert There's actually more comments than code itself We have here hook node insert meaning when there whenever there is a new node that is being created create a new message Reference reference it to the node that was just created and save the message And this means that now we have a new message message with id number one Like there is node with node id number one. There is message id number one saying two-step or created proba quibos vocal I always make sure to read it out loud whatever the bell generated created and If I create many messages like that Then I will see the view that comes with message example show me all the messages that were created and It doesn't look very exciting. I know that Yeah, it looks a little lame But I can throw some buzzwords at you and since you are all geeks I think you'll get excited like translatable fields and tpl overrides and pre-process function and view modes And personally these words fill me up with so much joy. I've decided to make a nice postcard out of it but also with some Hard work and using for example the message model along with babel model This is a mess. This is a model written by fooby which allows you basically to have Comments attached to different entities. So with some glue code and a little styling we're able to have Activist activity stream that looks a bit like facebook So we talked about the translatable field and that's One of the biggest features of message That field that message text field, which is a normal field is actually translatable. That's part of what Drupal cores Gives us so it means that one that field can hold information for the english version and for the spanish version and for the tamel version so The text this text which is completely unreadable is in english And that text which is also completely unreadable. It's in spanish So the tokens are in different places, but those are the same tokens Just the word that are gluing it together and are in spanish So if I go to en slash message example or ea slash message example I'm seeing the same message just being rendered in different In different languages same message ID different language so beforehand We saw that orange looking Weird looking token So what happens let's talk about the yellow token the yellow tokens the normal one. I have here the message field node reference title Every time I show this message message every time you hit f5 every time you're refreshing your page Message loads and it goes to the token system and it tells the token system Please bring me the title of that node and the and the token system node loads the node Gets that gets the title and brings it back to the message and that's fine because you know, it's drupal Somebody might edit the node and change the title and I wouldn't want my activity stream to reference Stale data. I wouldn't want it to reference and I wouldn't want it to show a title Which is wrong, but if we're looking at that orange token Which is the message username meaning bring me the username. There's absolutely no reason For message every time it's being load every time it's being shown to Ask the token system bring me that username bring me that username that username is not going to change so there's really no value in loading the user every time and Asking the username So if we're using that special token then message understand that whenever the message is being saved It calculates the information getting the username for example amity and hardcodes it So the next time I'm going to show the message instead of calling the token system I'm just going to replace it with the already hardcoded version and I won't like to you message when you're showing it. It has some performance penalty and You should take care about it and whenever I'm thinking about performance I think about mark sonabown from aquia He's a real performance. He's a real performance wizard And I learned a lot from him and he's also a wizard With words. He's really adequate and And I really like the tender way. He explains how to improve performance So it's true You should cast your views Even if it's just for 10 seconds or 30 seconds or one minute don't hit your database so hard Next in the stack the message notify So now we have a message and we understand it and the next logical thing is After we had the activity stream Is sending it and pay attention. We don't call it a message email We call it message notify because it it's it has a pluggable architecture Basically message notify allows us to have Notifier plugins and those notify plugins are responsible for two things Declaring view mode which we'll see in a few in a few minutes and sending it Out of the box message notify comes with two plugins One is the email notify plugin and the other is the sms notify plugin. So the email for example Is responsible of having a subject and a body and the logics for example that we need to strip the tag from the subject Whereas in sms we don't have a subject without just have a body and we need to make sure that we have a phone number So again looking a bit at at code These are the view modes For the email saying I need to have a view mode for the subject and a view mode for the body And then again looking a bit at code the code is absolutely not relevant right now Just to understand that this is the amount of code needed to create the plugin and for example We can see that over here. We are stripping the tags from the subject So now the view modes should make a little more sense remember remember those partial that's delta So over here i'm now in the managed display of my message type So under the email subject view mode I take the zero partial Just the partial just that part will be on the view mode and in the email body I'll take another partial and Message is actually nice enough That whenever you're editing it it shows you Each view mode that partial appears and now I think you can see the true power of message because You can have a lot of different view modes meaning you can have for example If you have an activity stream you can have a teaser activity stream And you can have a long activity stream and you can send an email with certain partials and you can send SMS with other partials and each one will render itself As you decide it will render itself plus the correct language message subscribe And not only reach we reached the last stack in message subscribe We've also reached slide number 102 and I always tell myself that that's the best slide to actually introduce myself So my name is Amitai Burstin Amitai Burstin is the nickname and I'm from I'm a co-founder of Gizra Gizra is a boutique development shop in Tel Aviv Israel and we're doing some interesting stuff and we have some fancy clients One of them is Harvard University Harvard University That our team is working with their team and in case you have a university and You're looking to develop a site. You should definitely look at the open scholar distribution Even if you're not going to use it, you should definitely look at the code. There are some great stuff over there Another client that we are working is is aqua. I guess you probably heard about them. We're helping them work We're helping them in development of the Drupal comments And that's like a really really rapid sales pitch that I gave you and Actually like 90 percent 99 percent of the reasons Why I'm here in Drupal cone is because I want to find the next big client but there's one more percent of why I'm here and that's because basically I'm really proud of what I'm doing and I like it and I like people using it and I Guess what I'm trying to say is like Twitter is nice and evaluations is nice and everything but I really encourage you to take advantage of the fact that you guys are here and I'm here and if You use my models and you enjoy it or my presentation and so on come say hello introduce yourself and I can assure you that that one percent is what keeps me motivated for the rest of the year So back in the days in Drupal 6 although there is also a Drupal 7 version. We had messaging and notification I wouldn't say what I think about it I just put two arrows regarding Showing when it when it was last updated So basically message subscribed Is just a really thin layer just a more of a glue model which glues together message and message notify and the idea is that The subscription system is actually being dealt by flag model So we can have different flags for example The subscribe underscore user subscribe underscore node basically every flag that is prefixed by the word subscribe Message subscribe treats it as its own, but it's important to know that the word node in user is not important We can have also subscribe underscore og and and and it will use it The flag is actually responsible On showing the flag links. So you are able as the implementer again. It doesn't have many assumptions It's up to you the implementer to decide where your links should appear and if you want to Define the access then flag is a great model and it has its own hooks and its own access system that you can Set according to your business logic and if you enable the the message subscribe UI, which is an optional model It will show you a tab in the user page Which just shows you all the different content you are subscribed to again. This is views This is really highly cost customizable if you if you don't want to use it You can just you can just turn it off But let's talk about the flow of message subscribe because unlike message. It has a little some assumptions so A comment was added somebody posted a comment And then it's up to you to create a message from it Okay, who comment insert or something like that And then it's up to you to pass it on to the message subscribe send message That's the main the main function And then from there it's up to me to get the basic context and now when I say context I just wanted like every other model to abuse the word context. So it's not context model context It's not situl context. It's not panels context. It's my own context and when I say context And when I say context, I mean for example the node that the comment belongs to the comment author and the node author And then from the node I extract also the terms that are associated with it and the groups that are associated with it And from that I get the subscribers Okay, I get all the people who actually flagged one of those entities And then after I have all the user list I can pass it on to message notify And I don't pass it on just as a as a flat list I pass it on with the users with every with the notify plugins So one user can get they can get the message Through email another through sms another through fax and so on Sorry So it's really highly customizable If you want to alter the context or the subscriber list you can do that And there is also integration with Drupal qapi because we want to make it scalable I cannot send 1 000 emails at once. So if you check the Use q option then it will just create an item in the in the queue and then it's up to you to create a drush from it It's up to you to execute the drush that will actually do the sending and You can see that up until now and if you've been following different presentation that I've done I've never said that it's working In a performance way. I never said that it's working fast and It is working fast. I said it just is time and it is working performance, but The reason I'm not saying it is mostly from like personal issues and the issue is that Me and my father for years we have this Weird funny argument that I say that faster is better exclamation mark and my father is saying no and These are funny arguments like we're laughing and everything and and My dad has retired this year after working in the same place for 37 years in the same job and A few months back we had the same argument and I said faster is better and He didn't laugh. I mean he looked a little sad as if As if things are really just too fast for him So I mean I love my dad and I didn't want to feel want to make him feel bad so I thought about Where fast isn't necessarily better in the computer world and I realized that password hashing is like a good example So for example if I have the md5 algorithm if I'm a hacker and I want to hack into a site and The site is using the md5 algorithm Then it it returns their response too fast. So as a hacker it might take you to find one password Let's say three days and if you have other algorithms Smarter algorithms like the big grip what happens the big grip gets the password And then it rehashes it like a hundred time and then it returns the response But it does it really really slow So the same hacker if it would take three days in md5 it will take like 12 years With big grip and I explained it to my father and he's really intelligent, but he didn't really understand it and And I I wanted to give him another example And I found it very beneficial to explain to educated people like my father like like like you folks to give it example from the world of math and Sorry, I have a typo here. I meant math like crystal math So we have our math addict and And and that's our hacker and every night he goes to clubs. He has this this trick he has every night He goes to this club. He says he's somebody he's somebody else in person to be somebody else He goes inside the club. He steals all the money And he buys math and every night he goes to the club. That's the bouncer that he sees that's md5 He's really strong. He's really fast. Not the most intelligent person in the world So the math addict said I'm benny and and the bouncer is looking at the lead and said I don't have no benny So he goes, I'm johnny. I don't have no johnny and then And then the hacker takes a big breath and he goes Ricky gwen jane eric derrick elvis brad brit alex tony brody chris one wait wait Oh, oh, yeah, mr. Ryan. Sorry. I didn't recognize you. Oh, yeah Go go go right in go right in by the way the cashier is all the way in the back And every club for some reason is hiring this bouncer and i'm telling you this hacker This math addict is being parting is stealing so much money in buying The best math out there. I'm not talking about normal math. I'm talking about hyzenberg quality blue math And then one day our hacker is walking in the street and he sees a huge club He's never seen something that and he approaches a really cocky approaches To the entrance of the club and over there. He sees mr. Big Cripped An old jewish guy from brooklyn Not very fast not very strong Super intelligent It takes a big breath Ryan bright wait wait wait wait wait You saying your name is brah. You say your name is ryan. I have to check it. I'll go back I have all my list over there. I will check it. But first i'm still on the phone with mother. Excuse me Yes, mother Yes, I had the kugel. It was good No, the gefilter fish I relate for later. Yeah Mother I have a very important customer here. It's a dirty filter high But you know all anonymous users are treated alike. So I need to check it Goodbye mother Okay, I go back to I now go to the back. I have a little vote here, but I will go to the back Anyway, so it goes all the way to the back now. It's maybe slow, but it's very organized So it goes over the list Ah Yes, I see a ryan And oh my god, the hacker is like twitching and I don't know what are the symptoms of when you're taking math and you're getting excited But it's like All excited and but now we need to take it 99 more times So obviously the hacker is kicking and screaming and spitting and getting crazy And then it turns around and it goes away and he swears that he will never come back to this club And mr. Bicript is getting back to his to his front desk and he mumbles to himself I'm obligated to give them a response. But this time I will use a new technology. I've learned I will send them a text message. I will send him a text message with the message notifier sms plugin And he types on the computer really slowly and then he screams to the hacker, which is all the way down the street Hey ryan look at your phone Thank you A q&a means questions and answers by the way, so Amate first of all, thank you very much for everything you do Atrium two would not exist without all of your modules. So thank you very much. Thank you I do have a question on the the email notifications and the message notify module So right now with the email and sms we're sending out a an individual message every time there's an event generated Is it on your roadmap to do some kind of digesting where you have like a weekly summary kind of thing? Is that something you would be looking at putting into the the message stack? Or is that something you'd be looking at a contrived module to help with? I think it should start with the contrived the problem with the with digest is I don't know how to do it in a generic way I'm not sure there is a generic way So I think it could be explored in contrived and then if we have something solid we can move it back into the message stack Okay, we'll try to help you out with that. Okay. Thank you Any more questions? All right, everybody. Oh, yeah, sorry Hi, hi, uh, so You talk about the notifications. I talk about a lot of things. Yeah, but Is there a way or uh, what is the best way For the other way around so you send me a notification by email. I reply And send you a mail and it becomes a comment or something You should talk with mike just behind you because they just did it in open atrium, right? And I yeah, they just did it the fact that you are able to to answer via email and gatherers. Okay, cool So another question You talked about Inogi Different membership types. Yeah, can you please make? Some other example Yeah, when you use different for example, if I have an Expiration membership that I want a membership to be expired after one month meaning for me expired Meaning that the status will be from active to pending then I have an I will have an expired membership type And I have a date filled on it And then I will need some custom logic like in hook cron or something Check all the message all the membership types that are now beyond that date And if so just load those membership type set the status from active into pending and save it In that case, why would you use different membership types instead of a field inside the same membership? Because like you like a page is not an article. It's something different. It represents something Something different. Okay. Thank you. Thanks Hey there just speaking as a distribution developer I wanted to say thank you because this this whole architecture and this whole stack of og2 And the message modules have really made it not just possible But practical for us as distribution developers to do things that our clients want and that we want as as product designers And so, you know, thank you for your innovation in this space It's really been useful for all of us, you know commons and I know for atrium and commerce and really and all of the distribution So thanks. Thank you. Thank you all for coming