Jump to content

requinix

Administrators
  • Posts

    15,286
  • Joined

  • Last visited

  • Days Won

    435

Everything posted by requinix

  1. Do you mean that you have it outputting "please work" at the moment you want to? The only things wrong with that second piece of code are (1) it doesn't call $citizen->selectCitizen() and (2) it's supposed to return a value ($res) that you can use to determine if it worked. You haven't really shown very much of your code, but it doesn't feel like standard MVC so far...
  2. If you want help understanding what an error message means and how to fix it then you really need to tell us what the error message is.
  3. What are you trying to execute? When what button is pressed? And what is your question that we can help you with?
  4. Well, first thing you're missing is valid HTML. Second is that you're using inline Javascript events from the '90s instead of modern event handlers. And third is that if you want to know about the form submitting then you should be having the form tell you when it's about to be submitted instead of the button when it's being "clicked". Fourth is that either of these is better than a confirm() dialog: 1. A checkbox in the form that says they want to do whatever it is the form does. Mark it required so the form won't submit without it being checked. Then you don't have to write any code at all. 2. A modal popup where you can customize everything and make it fit with the appearance of your site. The form's button instead triggers the modal, and the modal is what actually submits the form. Fifth is that cancelling an event requires either returning false from the inline code (which is also '90s code) or using an Event object that you can .preventDefault() on (modern).
  5. Aww, then it's adjusting for timezones. You can go the longer route too: const from = new Date($("#from").val()).toLocaleDateString(); Javascript isn't particularly good with dates, but it can do the basics if you're willing to learn more about it.
  6. Are #from and #to date <input>s? Use .valueAsDate to get Date objects, then call their .toLocaleDateString() methods to get the date in a locale-based format. It might not be exactly dd-mm-yyyy, but (a) it's probably still good and (b) you can customize it some if you want. const from = $("#from")[0].valueAsDate.toLocaleDateString(); const to = $("#to")[0].valueAsDate.toLocaleDateString();
  7. I have no idea what your hosting provider offers; if you/she uploaded the original files then you should be able to upload those files again, or if the hosting provider set up WP then they should be able to do that again. Finding out what was deleted would be really helpful - for you. Find out what files you're supposed to have, perhaps by setting up WP somewhere, and compare with the site to see what's missing. A bit more drawn out process will be to find and read whatever error messages are being created (because WP won't be just "down" without saying why) and use that as a clue. Perhaps some of those messages will be talking about trying to use files that don't exist...
  8. They're log files? Is it important to recover them? Since they are just, you know, logs... Files are files. Any sort of file recovery thing appropriate for that OS and/or filesystem would work, but those tend to need low-level disk access. Did you try asking the hosting provider if they can do anything?
  9. Are we talking "make an election" like CIA? I could help you with that... but then I'd have to shoot you.
  10. Is this another "someone else did some work for me earlier and I don't understand what they did so please do the work for me this time too" question? This $loggedin = $_SESSION['member_id'] ?? 0; plus this if ($loggedin) { both look very much like they qualify as "activated only when logged in as a user or admin". Have you tried applying that to "the link" (I don't know what link you're talking about) so that it only appears when the person is logged in?
  11. I'm confident that the less complicated one is the better solution. In terms of code, all you need is something that can tell what option the user selected, and something that can do what it needs to do to give the user the PDF they requested. Try writing the code yourself. If you have problems getting it to work then post what you have with a description of what you're trying to do and what problem(s) you're having with it.
  12. I hear a lot of "Barand did this" and "Barand did that". Do you actually know what he did? Because if you don't then that's a problem and you need to start learning... If you can read the code then the first thing you can do is find out/remember whether it's using mail() or a library. Which is it?
  13. One of those options is significantly less complicated than the other, and the outcome is the same.
  14. If the tutorial is telling you to do something you don't want to do then why are you using the tutorial? Tutorials are not documentation. Try reading the documentation.
  15. It doesn't matter to PHP. It does matter to HTML and your browser. Because you told it that the button should be connected to some form named "form". The real problem is that you were specifying a form attribute at all. 99% of the time you should not: just make sure the button is contained within the <form> and you're set. The only purpose of the form attribute is to associate the button (or other input element) with a <form> that's somewhere else on the page.
  16. Works for me, provided that I'm not using Firefox and that I think the desired behavior is to change the background color of the SVG to red. If you're trying to change the background color of the .inside-svg element then you've vastly over-thought this...
  17. It does automatically work. It just doesn't automatically work the specific way you want it to. kicken said to use session_set_cookie_params. Have you done that yet?
  18. Last time you asked about this, on our Discord as well as StackOverflow, and I believe you made a thread too, people pointed you to the API documentation. I'm reading through it right now and I don't see anything that says you cannot use custom prices for subscriptions. I do see really obvious ways to specify (1) that the checkout session is for a subscription, and (2) what price you want on each item. Have you even tried creating a (test) subscription with a custom price yet? Or are you just assuming that it's not possible?
  19. So you want to allow both (a) "TMP" plus 1-5 numbers, and (b) 1-5 numbers then "M"? 1. You need ^ and $ anchors, otherwise the regex will only check if the string contains something that matches it. 2. {5} means exactly 5, but you've been saying "up to". 3. What about zeroes? That's not in the regex now but I'd be surprised if you didn't want to allow them. 4. To allow both patterns, tell the regex that you want to allow both patterns using a | /^(\d{1,5}M|TMP\d{1,5})$/
  20. "Tag" is still fine. It's not like that term has died off or anything. And it applies to all... well, to all tags... not just certain ones. "META tag", "HTML tag", "NAV tag", whatever. "Element" is the other one in common usage. Means the same thing. Probably a bit more proper. Maybe the word you're looking for is "semantic"? Because the idea of those new tags/elements is that they have a semantic meaning: while DIV is just whatever, HEADER is specifically for "a header", and NAV is specifically for navigation, and such. Makes it easier for automated processes (like search engines) to analyze a page.
  21. Yes. it's possible to do this. But you need to change how you do events. Using inline on* events is old and makes solving your current problem a little harder. Your first step is to modify how your hover comments work to use modern Javascript practices with event listeners. Your HTML for the button will be as simple as <but1 type='button' id='1' class='btn btn-warning hover-comment' value='Savin'>1</button> That removes the onmouseover, onmouseout, and onclick handlers, and instead added a class name of "hover-comment". Your new Javascript code will add an event listener using that "hover-comment" (or whatever you want to call it) - how you do so depends and I can't tell just from what you've posted. Once you have the modified HTML and the comment hover functionality improved, it will be much easier to do the "store the comments in the buttons" that you want.
  22. Does the uploads/ directory exist? And does it exist at (I think:) /paypal/uploads?
  23. I searched for "woocommerce_email_order_meta" and found this post which seemed helpful. In other words, search your application for anything that's hooking into woocommerce_email_order_meta and you should find (a) some place which renders the email's content and/or (b) some place that lists what fields to include in the (default?) template. You'd modify the former to include the order notes however you see fit, and for the latter you'd add the notes to the list of "fields" it returns.
  24. Yeah, I think the post+user+display name table is the answer as well. A less traditional answer would be to go pseudo-NoSQL and store a JSON blob of user ID/display name mappings in the post; it comes with minor upsides and minor downsides, and probably isn't worth it. There are still some holes in here to potentially address, though. Like, if anonymized names are optional then there are two input spaces of (actual usernames) and (generated display names) and any overlap between them could be a problem. But they don't really affect database structure, I don't think.
  25. It's like asking how to improve your skills with a pipe wrench: you can either use it when it's appropriate to do so and recognize that probably won't happen very often, or you can come up with reasons to use it that weren't going to happen naturally. How about lurking #regex on StackOverflow? You don't have to post replies yourself if you don't want to - just use them as exercises. (And do keep an eye on the answers too, as that's part of the learning process.) Plus, I imagine that'll also help teach you when regular expressions aren't the answer to a problem...
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.