All right, we are recording. So we are live. So I'd like to take this opportunity to welcome
everybody who is joining us here today. While you are joining, please do let us know in
the chat where you are joining us from in the world and maybe give us an idea of what time
it is there. I'm always curious to know what time it is we are folks who are joining
us from. So where are you joining from and what time is it there. I'm going to pop that
in the chat so that folks can see that. While you are all doing that, let's do some quick introductions.
So I'll introduce myself. My name is Jonathan. I am from Cape Town in South Africa and it is
2pm in the afternoon. So I've just had some lunch. I'm feeling nice and comfortable and ready
for this session. And then I'll hand over to my other host to introduce himself. So go ahead.
Hello everyone. Hello world. So wherever you are now. Good morning. Good afternoon. Good evening.
So here is a fine evening in India. I'm from South India. It's nice weather here. I just had
a walk around the area here. It's nice, the neighborhood is here. I hope you might hear
some noises. It's hopefully minimal. Yeah, it's good. Good to be here. Thanks for anyone
joining from the part one. So if not, you can watch the recording as well. This is part two.
I'm Lax. I'm a WordPress developer. I stuff now in my day job. I work with the plugin
most of the time. Earlier I used to customise with the themes as well. It's good. Glad to be here.
Excellent. I'm just checking the chat. We have Abdul here from Ghana. Welcome Abdul,
fellow African. We have Arta from Frankfurt, Germany. We have James from Southeast
Pennsylvania. He's joining us nice and early. So hopefully you've got your coffee or your tea
weekly James. We've got Rico. Hi Rico from Switzerland. So we've got folks from all over here today.
So thank you for joining. If you if you were in the part one session, you will remember that Lax
covered some sort of basics of plugin development and understanding the core concepts
creating the simple form. And at the end of that session, he he asked the audience if they
would like a part two, which everybody was very keen on. And so that's that's why we're here today.
There was another session covering this content last week, which unfortunately I had to I was
supposed to go host and I had to drop out of the last minute due to family emergency. And with
me dropping out, there was some technical glitches. So unfortunately that session didn't get recorded.
But Lax was kind enough to come back and do this for us again. So I'm very appreciative of his time
that he's been he's giving to us today. So thank you Lax for that. And this one will be recorded.
So we'll be able to upload this one to WordPress TV to include with the content. So that's all I
have to say Lax, I'm going to hand over to you. I'll keep an eye on the chat, but I'll hand it over
to you now to take it away. Yeah, great. Thanks. Thanks John personalizing everything. So in the
part one, we discussed about how to create a plugin. What are the minimal requirements? That's
the plugin headers and stuff. And how to create a form why we choose creating a form for the workshop
instead of you could create any other functionality using plugins. So and then how to store the data,
how to handle the submissions instead. So always creating a form is a nice way,
wherever language with whichever language or whatever your skill set is, whether you are a beginner
intermediate level or advanced. You have always many avenues to explore when you are creating a form.
So that's why we created a simple form in for this workshop purposes, we will be using a contact
form. We are going to just create simple fields, text and email fields. But once you get comfortable
with it, that's no limit. You can add more fields and stuff. So for the core requirements of a plugin,
we need it. Plugging headers for starters. And then we've been mentioned for the name of your plugin,
one of the minimum requirements of PHP version and what versions of WordPress doesn't require
this stuff. So people can install it and run your plugin. And then we use a chart goes to render
the form. We could instead of a template and stuff because creating templates for block things
is different. Right now we have some folks and filters coming in 6.7 because things get always
hit it and so many exciting things coming in. And then how to handle the submission and send
this message. We got your message. So for part two, we'll start off with where we left
in the part one. So that is storing the data. So sometimes maybe you may as well get sent
in. We have to store the data and we have to validate it. We have to make sure it's a proper
email address. It's getting saved to the database and such. So we will be validating,
sanitizing and storing that permission in this part two. Again, there is other more stuff to
but we can probably we can go for part three of it or we can we can join us for our other workshop as
well. We have so many cool stuff with the data views and so many other things coming in.
Okay, let's get started. So this is again the slice of the same from part two. Sorry part one
because technically it's the same where we are going to start off. Here we have the contact
form plugin in just added header. You will get it. And then we are using the shortcut block.
You have the form. So we can add any fields for everyone in
being able to display the success message. So that's it for the part one. Now we are going to see
how we can store this data and we make sure this is a proper email address and this is all the
data is correct. And this is by the end of this stay around, stick around and see how we can
able to create a custom post type and store this to the database so the entries will not get lost.
So for those who want to code along or you want to just go ahead and I often say this is like
some folks always curious and they want to read the climax and then come back to the last
shape request. So if you want to see how the code works, you can go to this one and we have a
branches. So you can switch to I guess this branch 10 or 11 is the last branch of this one.
And if you are new to get, you can just download the zip file and check the code as well otherwise
you can just clone this repo and you can see the last branch. And this is part one,
just in the URL. I started from scratch for part one so you can see that's where I'm going to
continue. Cool, there are some resources. We'll be sharing these links and as well in the video
and also John is sharing this one. Great, thank you. Now, enough of talking, let's go create some
code. So here if you have any difficulty in reading the text, let me know again, just maybe close
this stuff because we are technically going to use only one file. We don't need this browser to be
here as in the we are in the plugins folder WP content here in WP content plugins and contact
from this plugin folder. So in the plugins folder, we have a CSS style sheet for styling the
form and showing success message and then a empty index file. This is to prevent directly
listing. It will save us as just in case your server is not preventing it by default. So it
will prevent. So others cannot see what is in your file and yes or wait. You can prevent the
vulnerabilities with this empty file, just standard practice you can go. And this is our plugin file.
So we will be using this one a lot today. I'm going to just close the explorer here.
I'm using VS code. You can use any choice of your IDE or any editor.
And let me know if you are able to see the text or if you wanted to zoom in a little bit.
And you can stop me or you can message on any time with the chat as well anytime if you find
anything a little bit confusing or if I'm too fast. Let me know. Okay, just to recap again with the
code instead of the slides. So we need to plug in name that's WP contact form. Always use a prefix
that's recommended. So you can avoid conflicts and also you know which plugin for which project
that you are using. So if your project is ABC. So we can name it as ABC contact form. Or if we want
to have multiple forms. So that will help us like the ABC contact form, ABC register form, log
inform, anything. So always start with the prefix and add a description. Say you and your team
of question know it and add the author's name. Version is very important. It will help you
like right from clearing the cache to release management and everything. So versions version is
important. And also always mention which version of WordPress it requires. So if I am going to use
data views and stuff, I should say six plus what are the data to one that supports.
And PHP version. I am using PHP 8. You are free to use PHP 7 as well in other stuff.
Okay, so if we are about to translate this one, we need the domain text domain of this one. And
other stuff is like package and if you want to add any other disclosures and stuff, you can add it.
So that's it with the plugin headers. This is very basic stuff. You can read it in your plugin
and book as well. Once you have this one, you would have the plugins in the list.
So here, so you can see this one. So we have the name, we have the description,
and we have the version number, author names. And if you have author, you warrant that
it will be linked as well. And then you can see the plugin site for various views.
Let's go here. Sorry, let's go to editor. And you can see you can use
and our defined constants that make sure the plugin is not edited. Access will directly.
And then we have the shortcut that renders the form.
So a shortcut is just a what's the shortcut code you want to render. So if you want to have just
form and then the callback. So you might have noticed what press has gallery. So you're going to say
gallery and then what press handles the galleries that way. So square brackets and name of your
the shortcut and it will end up. We don't have any attributes here. So if you want to have
attributes, you can pass it like form ID or you want to show the form title. You can have
free free to add that for this. Just like you're pretty simple. We have the shortcut and
the callback method. And we are using output buffering. It starts here and we have the form
just in plain HTML. And then we get the output buffering and render it.
We have the style sheet. Just we are including it. There's no javascript involved with here.
If needed, we can add that as well. And we have an action. You could use the wp hook or any
if you want to use custom tools. Instead, you can be custom handlers as well. This is the callback
and it checks. So if you are coming from any PHP world, like Rupa, Lara or any even with PHP,
this is equivalent of checking your form data in javascript. So we are checking the data in post
object because we are using the post method here. So we check the post array. If the form gets
submitted and we are using the first name, email and message. Then we are rendering this
success message. Hey, where data is okay. We are going to do
and see I'm going to the site. This is the site and here's the form.
I'm going to just fill some data. So let's say test.
Yeah, so I have the success message here. Thank you for contacting us. We will get back to you
shortly. So here you can, if you want to change it, you can display it on the top or you can hide
the form and display the message. Anything which depends on your requirements for the purpose,
I'm just depending it to the content. And now whatever the data is, it's just a success message,
but we don't store the data. We didn't email that. So the data is almost lost because we are
just learning. We are just starting it out. Let's see how we can store this data. To store the
data, I'm going to use custom post types, but before all that, we need to make sure that data is
properly sanitized and validated. So anybody here knows the difference between sanitization
and validation or why we have to sanitize. I'll go one, two, and three, then
I'll ask John to explain. Just a minute, I'm going to, yeah, I'm going to, yeah, here we are sanitizing it.
So you see here we are just checking if the post array has past name. And this is what press call
method. So if you actually see it, you can see, just pass through the filter. Let's see here.
I was about to show how the PHP way of handling it. So the sanitized text field is used to sanitize
the text fields. The same applies to email. So you're going to sanitize the email. So if it is
any, let's say the text data is not valid, you're going to get just empty. It can be just from
special characters or in data that doesn't match. I don't have any examples, but you can see.
Yes. If the data is not valid, it will be considered. It's not going to return.
Let's see. That's for text area, you can just sanitize text area field. Or if you want to do it,
take it one more level deeper, you can use the sanitization filters and do it. For most cases,
we can use just the WordPress call methods and the text field. That's fine.
And I think if you notice, we missed the certain fields here, going to add the last name.
Let me be quick. I'm just going to get this done and make it last name.
In most cases, I just do the RA map and run this recursively. But for making it more readable,
I like to go with this method. And I think we missed the subject as well. So I'm going to add
subject to the same subject is also a text field. So I'm just going to do it.
Okay. I didn't count, but anyone came up with the answer, like, sanitization, validation,
why we made that one. So we need to sanitize data so that we don't want any invalid or malicious
information, which is data. For example, if someone enters the JavaScript, you are expecting first
name, but they could add a JavaScript tag or this way you can prevent any success or any other
vulnerabilities. And we need to also validate. So we are actually checking if the data is
not empty. Otherwise, let's say if the form is submitted and any of this data is empty,
still the success message will be shown. So that's not correct. That's not what we want. Let's say
you are creating some student registration form for a school or college. For your project,
you have a registration form and email is important. And if the email is empty or it's not
of email address, like for some reason, the user entered their first name in the email.
I still do. Sometimes I enter wrong links, wrong data, the first time I enter a form.
Sometimes I, we don't make mistakes. So it may not be an email address and you didn't
properly check it. And the user will be waiting for email or something, but it's not because we
didn't validate it. We didn't sanitize it. So the user assumes that they did it correct,
but it's not. Something is missing. And so as a result, you lost one user. So to prevent all
that stuff, we need to sanitize and validate it. So we are sanitizing here. And another
stuff that we need to add is a non-spirification. Non-spirification is a unique number.
We need to add it to the form and validate it. So you can consider this as a token. So you
order something in a restaurant. You order something and they give you a token or you order
number. And when you pick up the order, you're going to say, hey, and this is my number. So you get
your what you order for. Right? It's the same way for every request. So every order has the
order number. So every request, WordPress has a knowns number. Let's see, add it. It's a unique
number. It's going to be you're going to add it to the form. And when you check it, you're going to
make sure the non-spirific date.
So you can see here, we are adding a non-spirited. Let's see what are the parameters.
So you're going to have a name, what is the action? You can break that as well, like in our
documentation, out of the links. So that's good. And if you are coming from, let's say,
a true call or a larval say, because I work with a few other stuff that I'm just more curious about.
Larval call this as a CSR of token, CSR of field. And true call is as well the same. They call it
I guess it's true call token. Not sure the exact long full method name, but it's token. So
it's again a unique field. It's like the token number or order number. We are going to make sure
for every request. So right now we added it. And let's see,
let's inspect here. We don't need this stuff. We want to see it. I'm going to refresh
and now we should have, now we should have the non-spirific date. You can see the value. So
as we said, readable or quite a little bigger. So you can see the non-spirific number is like
four, five, three, six, some string. It has alphabets and integer. And if I refresh it again,
it's the same, but it's based on this value. This is the name of auto speed. And this is the value
and you're going to make sure this value is not empty and it matches when you accept the form
submission. So right now you can submit the data. We don't have the non-spirification. It's
going to just pass. But when you add it, let's see here. Before sanitizing all this stuff,
we need to stop the bad players. It can be a bad, sorry, it can be a bot attack,
root force or anything. So we want to make sure. So we have a core method, verify non-spirific
in the name of the field and watch the value here. And you can see the
we can enter a error message like a relative once. Are you any other method? Any other message
that you want to submit? Let's see here. I'm going to alter this one, set up this and just
making it something, add this data, I'm going to say something. So right now we have the non-spirific
that is strong. So if I did me as a bot, I like to be a bot with AI coming all over the world,
so Lax bot is sounds good. So let's go here and submit the form didn't go through because
our non-spirific value is strong. So if let's go here, yeah, we're going to just
just rub refresh. So if there is a bot or spam bot or something like they want to or somebody is
trying to do any other sort of like they want to send spam to your site, they could they could know
you can guess you can guess the field names, you can get their field names and stuff and you can
try to send the data intercept the HTTP request. They can manipulate the data, like the data gets
tampered and you may get hundreds of spam for your form. So this way is one level of preventing spam.
Still we get spam that's why we have a lot of anti-spam plugins, but this is a very pretty basic
and required step. Whenever you create a form, make sure to verify the notes check. It could be
Ajax based or anything. For Ajax, you can also make sure check post-referring check Ajax
referral that one as well, important one. So we added the notes verification and we make sure
everything has the data in it. We are not letting if it is empty, we make sure it's empty in
district. We are not letting anything to pass through. So we are good with this bot. Now we have to add,
we need to add a custom post tag. See here instead of me typing everything I'm going to
get our helpers to the job is to the custom post tag.
Yeah. So by the way, I learned this from John. He's a great teacher. I think John, do you remember it?
Yeah, so he says yes. I do. I do. Yeah, because I used to register everything in the top
are at the bottom that I already like. Sometimes I don't even write comments. That's why I just
start writing comments now. So it becomes more readable. Okay, so in the init code, we are registering
our post tag. Now it should be form entries and now I want this. I want it to be
varicible. Slug should be let's say entries. And we want title editor. We want actually custom
fields, but I want to show without it, you know, not to show like that. Let's talk please.
Okay, let's go here on just here. We need to name it as entries.
And here, see, I made it public through, publicly variable through. We are going to set it now.
But in the beginning, let's see if we got that one working and that. Let's go to the dashboard.
Oh, I think, I think I missed something here. Where? Where?
Function. No, no, the functions get that. Okay.
So if you see here is a form entries. Once people submit the form, it should be stored here.
Let's say I knew you get the title description stuff. Let's add it to the post tag.
What's the name of the post tag? We don't want it to be publicly available to people.
So it will not be showing up in search. If someone is searching for the name, John,
it's not sure. So we can just avoid it. But we wanted to be showing the UI so you can
read about all this fascinating stuff. If you are building this for a headless CMS or even
for Gutenberg, you have to mention the show interest. You have to allow it to add the support for
REST API here. Okay. As RK is false, we don't need all that. I don't think it's false,
many positions. You can change the many positions and everything. I'm sure many of you already
know how to create a custom process. So I will not bore you with that. Let's add insert. Yeah,
let's insert it in the submission itself. So right now we have the data, but we are not doing
anything. We're just displaying the success message. So after validation and sanity session,
I'm going to insert the data into the database. Let's see. Let's create a array of data, first name,
or snap now. Message. Actually, we don't need this array. Now I'm going off the limits here.
I want to insert it as a CBT. So I'm going to call WPTV. Now, no. Let's go.
Let's see. Here. Yeah. This is the way we go. So here, we are going to use the WP
insert post. If you are updating, you can use the WP update post. God. I missed my keyboard now.
Sorry for too much going back and forth post title.
Content. First type status. Let's say meta. Yeah, that's the one I want. So here, you can see
in the meta main meta input. We want to store all this data as post meta.
I guess there's something this.
Yeah, no.
Sorry. Yeah, I'm supposed to be that.
Oh, I'm missing here. Anybody?
You haven't got the array wrapping around the array. So you haven't got the array
to keep it. Yeah. Yeah.
Oh, I don't want to use the short, short array syntax. So we're going to be in trouble.
That's for me. Yeah, yeah. I mean, I don't because we are still using the longer, long
from array right. So I want to. Yeah. WPCS. Yeah. WPCS. Yeah. So just in case, if anyone is starting,
so new to WordPress. So it's like, for PHP, we will be already, PHP 8 will be using the short
array syntax, but WordPress, we just go with it for methods to use the long form array syntax.
So we have array and I think it just can be really formatted well. Yeah. Let's go here.
Oh, it's little bit readable. Okay. So we're trying to insert. We have array and post title.
I want to actually prefix it with.
Oh,
yeah. So we have a, it will be considered as form entry and the first name, last name,
and then we have the content. We store the message as a content because we don't know how long
we don't have a restriction of the message. So it could be 1000 characters, 2000 characters,
let it be in the message field. And post type is our post type. I hope we need to make sure
the post type is, yeah. So this is our post type. We need to make sure post type is correct.
Say it as we're going to publish and meta input. So you can add, you can store it like this,
or you can serialize and store it, but I prefer this way to keep it simple for now. We can
do all other stuff later. Yeah. Let's go. We're going to save this one and then
see if we don't have entries now. Let's go ahead and add an entry. Yeah.
Subject. Subject is word first. I mean, let's add it. Okay. So now my name, last name,
subject and email and stuff. Let's add it. Okay. So thanks for contacting us. I hope
gets saved. Yeah. So we got it. So first name, last name. Yeah. So and then
since we said public as false, so you don't have the view button here, so you get only you can
edit. So you can add that stuff. You can add a custom view and stuff. You can cover it later.
For now, it's like let's go here and you can see this one. But what about the custom field? So
we want to see other details as well, right? But the subject was the email address. So we can
contact them. So let's add the support here. Sorry. Let's call you to fast. So we can add custom
fields. So now we should be able to see email, last name, last name and the message. I think
message is already here. So that's something we need to remove. Let's go ahead and do it right away.
We are storing the message is content already. So okay. So
I'm not using this array of faults. I'm going to just delete it.
Let's go ahead. Oh, they do anything wrong.
Okay. I removed the data. So it shows like this now. Okay. Let's go back.
Okay. Cool. We are good now. So we don't actually have created an array and then I'm using it.
It's kind of redundant. So for an ideal world, you don't have to do this one. So you can just
because we already have it as a first name, you can just use the first name. Yeah. Let's go ahead.
By the way, if you are looking at GitHub, the code will be little different because I have it,
you know, almost the same, but the data part is not there. Okay. So we have the data and we are
seeing the data here. Now let's, the other step would be we can display them,
display the email address and the name or any other stuff here. So so far, how
any questions, any doubts or if you want to anything to be explained again or what is the other
ways that we can do it in a better way. I see some developers here. Let me know.
Okay. I just want to, well, well, if anybody does have questions, you're welcome to unmute,
you're welcome to type them in the chat. I just want to say, I think it's really cool how you're
showing, you know, just good, good practices, you know, sanitizing your data, sanitizing it early,
using the, the builds in insert post function to insert the data instead of using WP query,
sorry, WPDB. I just want to emphasize that to folks, you know, whenever you're working in WordPress,
whenever you're developing with WordPress, if you find yourself doing something manually,
like generating a unique number, go and see if WordPress has something for you and you will find,
you know, nonsense, for example, and you can use nonsense that way. There are a lot of,
I, I sometimes will, will put something out. It's somebody will say, hey, there's a function
for that's going to use the function rather. And one of the benefits of using the, the built-in
functions is a lot of the times they will be doing a lot of cool things under the hood that you're
not even aware of that make your code better, faster, more secure. For example, using custom
post types for, for form submissions this way, one of the things that you can do later is you
can query those forms of missions. And if they're cashed using the WordPress caching mechanism,
you know, if you're using the built-in functionality, it makes your website faster and more
performance. So I love, I just want to say thank you to you, Lacks, for showing those sort of,
you know, always use the internal functions, not, not writing your own.
Yeah, thanks. I, I tend to still tend to do it. I used the other methods when I,
and then I found out like, let's say if you are doing any caching,
trying to improve the performance, that helps a lot, instead of doing another query,
instead of maybe the data that you are trying to insert or read would be already somewhere in the
app. So it's better to use the built-in functions. Our opt-in, like in other,
like in some other authors can be using that as well, instead of using your own methods.
Sometimes it's kind of, we might have, like I use the data right now, like this specific array,
it's unnecessary, something like, sometimes we, we got a little bit one or two steps extra that
could be optimized. Okay, so here I'm just going to add the email. Okay, so let's say if you have
100 employees like this and you want to contact this person, yeah, so I want to email this guy,
but you have to go, click and see it. So instead, you can just have a column here. So
so in WordPress, this is, I just many years ago, with .NET, I don't work with .NET anymore. So
.NET, I guess they are calling us to still report or some, some report table. So they have,
basically this is interesting, right? So you have whatever the fees you want and you can do some
other actions with it. You can filter them, sort them. So this is a listing in WordPress, we call
this as post list table. So here, if you want to add more, more columns and make them, you can
sortable or you can allow them to be edited. In fact, if you want to add or edit the email address,
you can bring them here as well, allowing, we get it. Let's see how we can add the email address
here. So we use the filter manage, that's the post type slide. You can, our post type slide is
managed from that form and then the post column. So basically, this is managed post column.
If you use that hook, you have to manually check if the post type is this and run something. So
instead, you can go this kind of approach. So you don't have to do one more check, your code is
more readable and much better. In the add a callback and so on. So we get the active columns,
whatever the columns are and we are appending, we are adding email here and you want to show,
it can be email, email address, anything you want to show and then this will just add the
column name. Let's say I'm going to commit this one, I want to just show what it will do.
So you can see we have an email but it doesn't have a value because we just added the column,
but to add the value here, we need to use this action. So you can add any custom columns
to WordPress. So when you are doing it, you have to use manage and then the post column.
So if you see, take a closer look, you can see this is a filter. So you were just,
they both almost look the same, but they are different. So manage post and it's got columns,
but this one is manage post custom columns. So this is another action. This action allows you to
hook into and you can add whatever value you want to display. So for example, if you want to,
just add to this one title, you want to append something to the title, you can.
So here, right now we have email column and we want to get the PostMidout that can display.
Let's see here. So we got the email stuff. And if you want to start it,
you can make it sortable and you can add other columns as well. You can change the order of the
stuff. And then if you want to have more other fields like we get it and allow them
so many other possibilities as well. And the other common feature that
what people do with this kind of history, listing is export. Right. One text for them is a PDF,
or you can text for them is a CSV file and any other file that will be nice or you can have
something like bulk edits in the email or archive, but you can do so many stuff as well.
So if you want to hook into these actions, we have hooks for that. We want to.
So there's another cool feature that like just now John pointed out like,
we are using custom post type and WordPress gives you this option. So for example,
let's say you have hundreds of entries and you want to see who submitted the forms during
October, you can filter them out. So this is because this is a WordPress code feature. We didn't
write code for it, but WordPress gives you this. So you can save a little bit of time for you on that.
So and what else like you can since we are using this post list column, you can also filter
it across. So let's say if I'm going to some something, I don't know if anyone did this to
you, John, or give me. No, this is the first, but I like it. Yeah. Yeah.
So let's say, yeah, it's got some meter. And let's go here, see the increase.
Oh, whatever. I think I missed out with something.
What could be the possible issue here? I don't know the insert post and we have the data.
Not sure. Whatever. I didn't do anything extra.
Yeah, that was something I think I can make it does a bit of just add something for you folks to
figure out why you just didn't say it. I guess it should say it. Okay, maybe John did some
magic spell. Not to have that. John's no entry in the record. So I was trying to show
you know, if you have multiple entries, you can search them as well. So the searching list
filtering by dates and also this, like, you know, if you have more entries, you want to
you find a lot of spam and you can just select them and trash them. All this stuff, you can just
record methods as well. And if you are coming from JavaScript world, like, you can use the data
views. They are pretty new. You have to use the latest version or the desktop with Gutenberg.
Then you can use the block things and stuff. You can use the data views and
the admin screen refresh is coming along nicely. You can see all that new stuff as well.
Great. So if you all have any questions, comments, let me know.
Well, it doesn't look like we have any questions. There was a question earlier on that somebody
was wanting to accomplish a certain thing, but that was kind of outside of the scope of this workshop.
So I've sent them off to the support forums and asked them to post a link there.
So what I'll do, what I'll do, lakhs after this call, Andrew, if you're still on the call,
I'll share the link with myself and lakhs. And then we'll hop on the support forums and we'll
share some feedback with you there. But there's a specific sort of way that Andrew wants to do
things and it's going to take too much time trying to do that in the session. So thank you,
Andrew, for sharing the link. I'll share that the lakhs after this.
I almost want to, when you just test the form again and see if it is still broken,
because I almost want to say, let's leave it like that and let's put the code somewhere and
let's see if you can figure out what the bug is. So just test it again and just see if it does
break. So save the code, save that code, stick it on just somewhere and then we can leave it for
folks and we can say, hey, go check it out, see if you can find the bug. Because me debugging
code and finding problems in the code is just as much fun as presenting code. So that would be my
challenge to everybody here today. Go and check out the, the, the, the, the guests that I'll get
lakhs to share in the in the meetup comments after this and then see if you can figure out what the
problem is. James says, is it possible to do a master detail form with these methods? James,
you might need to explain to us what you mean by a master detail form. You're welcome to unmute
if you would like to. I'm not quite sure what you mean there.
Yeah, I found out. What was it? Yeah, I miss the message field. Yeah, you miss the message field.
Yeah, so the data of message was not there. Oh, yes, that's right. Yeah. So what
was the question? So what press? Okay, be customer at the top. James is customer at the top list
of the invoices below. I would assume, so it's difficult to say for sure based on, based on not
having like a full detailed list of your requirements, but I'm not sure how are you, are you wanting
customers to submit their invoices? Are you wanting to be able to view their invoices using
the custom post types? Is that what you're, I think that might be what you say, allow customers
to view the invoices via the custom post type methodology. I would say theoretically that would
be possible. You would need to also have some kind of user permissions involved so that you can
only give them access to that custom post type. And then you would need to add, be able to attach
the, if you want the invoice to be like, I guess a downloadable PDF, you would have to import it that
way. Lacks, do you know of any plugins that might support this kind of functionality out of the
box instead of having to code it for yourself? Sorry, can you be, so what James is asking any,
what you want to be able to set up an environment where he can allow customers to access their
invoices using the custom post type UI. So you would create, I guess, an invoice custom post type,
and then you would want to be able to add a downloadable PDF to it. You would also need to have
user permissions because you would need to specify certain types of users or customers. I feel like
there's probably a plugin out there that does it, but I don't know everyone.
Yeah, so there are, I think WP data tables or like, there are a few plugins out there. You
can, you don't have to write code, you can just populate the custom post type and then you're
create a shortcut out of it and render it in public or based on the members you set up on and
stuff. And there is like, I guess, there's a number of press, there's a number of plugins.
Yeah, so there you can, it's basic, you don't have to, there are a lot of plugins, if we don't
have to even pay for them, like you can just allow them to, the basic features itself, like
allow them to view and download like a restriction. Only this level of users can view.
Or another thing is if you are into coding, you can actually do something like, you know,
you can check their user level and if not, you can hide this stuff, you can
not make them clickable. So they cannot actually go and view or see the invoices. You can see
that it's a invoice for a gun, but they cannot go into it. But since it's a invoice,
it's a, let's say, a private or specific to certain users, maybe you can want to hide it totally,
instead of system making not clickable.
Try a comment. Yeah, that actually raises a valid point. There's a tutorial that I did a
while back specifically about custom post types and capabilities that dives into how the
capabilities work for the custom post type and how you can restrict users by capability type.
I'm just finding that link and I'm going to show it in the chat here. So yeah, I would say it's
definitely doable. But I would, I would always recommend that folks first look for a plugin,
like, like, like, say, like a membership plugin of some kind, there's member press,
there's paid membership's pros and other one that'll help you manage the membership side of things
instead of having to code it yourself. But if you, if you're like me who is the kind of person
who does like to code it specifically for the environment, I do believe it would definitely be
possible to, to set up a custom user type for a customer to create a custom post type for
invoice and then, and then have something like this inside of a WordPress dashboard. Yeah.
Cool. Oh, James says I would use it as a learning exercise to pull my own. That's, that's a perfect,
yeah, that's a perfect, perfect idea. I always do that. I come up with, with the
example projects to learn new things. So that sounds like an excellent one, James. James,
I want to put it out there. If you do end up building this, please do share the code with us.
And we can, we can share it with other folks and they can learn as well. Maybe you can come
and do an online workshop. That'd be great. Yes. All right. Okay. We're getting close to time.
So I just want to check if there are any other questions. Laks, I think you're, you're wrapped up now.
Was it, was it other things you wanted to share? Yeah. So that's the thing. Like, I would like to
just point out, let's say, what is my therefore. So future, after once you get familiar with all
this stuff, you can extend like you can add more fields, you can add a, you know, always a multi-step
form. You can make it step one, add your personal details, step two, add your, let's say,
membership details or stuff like, and file uploads are another fun to explore. So you can see how to,
and how, if you don't have to write code, what presents the file system and stuff,
so you can see how to use that API. And also, you can use PHP classes, because I see
many people say PHP is over the PHP is dead, but maybe if you are modern,
coming back from other programming JavaScript or other stuff, you can see
classes are there. We have classes with PHP, what process full of PHP classes. So you can see,
get some inspiration, use classes to organize this code, and also add how to use WP email,
sorry, WP underscore mail to send the email and how that things goes. And like we discuss,
they can use data views, you can convert this into a blog, so many other possibilities.
Excellent. Yeah, that's, that's the cool thing. It's interesting that you've done this workshop
now, building a simple plugin, form plugin, because I do find form plugins to be
the one example I always tend to go back to, because they can start so small, but then there's
so much more that you can build on to it. So yeah, there's so many ideas there. I feel like there's
another couple of workshops out of this in the future somewhere, relax. Maybe once we've,
maybe once we've finished our course cohort, then we can look into some of those.
Speaking of the course cohort, if you are here today, we are running another
learn WordPress course cohort. I'm going to share the link in the chat chat. So what a course
cohort is, it's kind of like these online workshops. It's a series of six weeks. You join a group
of learners going through a series of content together. The next one we're doing,
lacks will be facilitating and I will be co-hosting with them. And we're going to be very much focused
on sort of an introduction to plugin development. So very similar to the last two sessions that
lacks as Dan for us, very introductory level stuff. So if you're new to WordPress plugin development
and something that you're interested in, do check out the course cohort announcement. See if it fits
into a day in a time we're doing it every Wednesday at this time. So it's the same time as these
workshops. So if you're here and this is a suitable time for you, it'll be great for the course
cohorts. Signups in this Friday. So if you want to take part in the cohort, you need to sign up
before this Friday. And the only requirement from you is that you have some time in the week to
work through the content and then an hour every Wednesday to join us for the asynchronous sessions.
So please do check that out if you're interested and give it a read through. And if it's something
you want to join us in, please do fill in the sign up form. From my side, lacks again. Thank you
so much for all your work that you put into today. Thank you for hosting this workshop today.
It's always fun for me to see someone else doing these because I could just sit back, relax,
and let you do all the work. But I just want to say thank you to you for all the work you've put
in. I know that preparing these workshops takes a lot of work and a lot of effort. So from my
side and from above to everybody here today, I want to say thank you very much to you for sharing
your knowledge and that here with us. If folks want to find you on the internet or online,
where can they get hold of you? Yeah, so it's my name. Lack's Maria Pan. You can find me on Twitter,
Instagram, all the social media, and also LinkedIn. Same on WordPress, Slack as well. So we are all
if you are in just starting out any demo, there's no mistake or there's no silly questions,
all questions are welcome. You can join us in the training team. Even if you are not able to
make this to the cohort, still there are a lot of courses and lessons are there. So
I hope to see you there. Yeah. Absolutely. Awesome. Great. Well, thanks. Thank you so much for
joining us here today. I'll give you three minutes back of your day. James, I look forward to seeing
what you do with your invoices plug-in. Andrew, I'll have a look at your link in a second.
Everybody else, thank you all for joining us. Enjoy the rest of your Wednesday.
And if you're joining us for the cohort, we will see you very, very soon. Awesome. Thanks for
spying. Thank you.