Jump to content

maxxd

Gurus
  • Content Count

    962
  • Joined

  • Last visited

  • Days Won

    24

Everything posted by maxxd

  1. What exactly are you trying to do? The sample code (not the source code, but the usage example) is pretty straight-forward. Select the action hook you want to use (codex listing) and call the bp_notifications_add_notifications() function at that point. Note the difference in the sample code between the ' bp_activity_at_mention_add_notification ' function and the called system ' bp_notifications_add_notification ' function - the first calls the second at the time the ' bp_activity_sent_mention_email ' action fires. If you're not familiar with WordPress's action and filter hooks, I'd recommend doing some digging into them. It's a pretty easy concept to grasp, though admittedly the WP documentation can be lacking and/or outdated, especially right now as some major changes are happening with the core.
  2. Personally, I learned from books - specifically, 'Core PHP Programming second edition - revised for PHP4!'. Don't even bother looking it up; it's still there but it was published in 2000 so it's a joke at this point. My favorite book is 'PHP Objects, Patterns, and Practice' (currently on edition 5), but that's sounds like it's higher-level than what you're currently looking for. However, the point is that different people learn different ways. I've met people who just jumped in and started cobbling some code together from S.O. and Google and somehow (to me) still ended up being good programmers. I've also heard good things about Codecademy, but have never actually used it myself. There are a plethora of YouTube tutorials, books, and written tutorials out there - just vet them carefully before you use any of what they have to say on a publicly-accessible site (this is a great place to do that). Whatever you do, make sure to find forums like this one and ask questions when you have them - and take the answers and code reviews that may be given.
  3. maxxd

    PHP sessions

    Any page with php on it needs to have a .php extension unless your server is set up to parse pages with an HTML extension, which it's hopefully not (it'll slow down plain HTML pages). Beyond that, what you're describing is a basic multi-page form and yes, using sessions is a good solution to this. As to how to use sessions, the manual is a great place to start.
  4. @phpsane, @benanamen is right - you should know the difference between single and double quotes by now. For review, please read this: http://php.net/manual/en/language.types.string.php#language.types.string.parsing. In case it's still confusing, please note this line: When a string is specified in double quotes or with heredoc, variables are parsed within it.
  5. Ah - yes, blur will occur on focus in and focus out. Forgot about that, but glad you figured out the trigger you needed!
  6. To add to the point that @ignace is making here, it's also very simple to load a page containing a form, open the inspector for your browser and change any value for any form field. Client-side validation may not catch this, but the server-side processing (model) code validation will.
  7. If you're specifically looking for a PHP solution, DateTime::diff() sounds about perfect. You'll have your difference, but be able to format that difference in a variety of ways. Unless I'm not understanding the issue.
  8. Have you tried the blur() event on the field? I can't guarantee it'll do what you want (I'm away from my computer right now), but I'm pretty sure that element.onblur() fires when a form field autocompletes as well as when the user navigates away from that field.
  9. Public repositories on GitHub are, as both benanamen and gizmola have pointed out, free. If you don't want (or don't have the time) to learn the command line aspects of git, you can use SourceTree or GitKraken. I have to say, if you're developing in Windows, SourceTree has problems - on mac, it's excellent. SourceTree is completely free, and GitKraken is free for non-commercial use. Neither is required for help here, but either will change your life if you're not currently using a versioning system. And both will give the people on this forum the chance to look at the entirety of the code you're using, which will help us help you.
  10. What framework are you using?
  11. What hook are you using to call the function that uses get_option()? Are you using AJAX to get the value? If so, are you using it correctly? Post your code - that'll help.
  12. You're going top have to describe the problem better. Are you saying you want the user to fill out the form then immediately be redirected to the new page? If so, there are a couple other things to consider, but ginerjm is correct in his statement about gathering the values and using a header redirect. Are you saying you've got the form saving the information properly to the database and need to know how to get the data from the database? If so, it's going to depend on how and where you saved the data. Either way, it's probably going to involve using an action hook at some point, so where is this code happening? Are you creating a custom theme, a child theme, or a plugin? Basically, what does mean exactly?
  13. The code you've posted doesn't have anything to do with a database. You're making a curl call to update-availability.php. If that file is supposed to update a database value, we'd need to see the code in that file.
  14. Applying opacity to a div affects everything within the div, including type and nested divs. Use background opacity via rgba() to do what you're wanting: body{ background: url("https://image.ibb.co/h93Ndo/abstract.jpg") top right no-repeat; background-attachment: fixed; } .body-container{ display: flex; flex-direction: column; justify-content: stretch; align-items: stretch; background: red; color: white; min-height: 100vh; } .header{ flex-grow: 0; background: rgba(58, 152, 253, 1); } .two-cols{ flex-grow: 1; display: flex; flex-direction: row; justify-content: stretch; } .left-container{ display: flex; flex-direction: column; justify-content: flex-start; flex-grow: 1; flex-basis: 20%; background: rgba(59, 74, 83, 1); } .content{ display: flex; flex-direction: column; justify-content: flex-end; flex-grow: 1; flex-basis: 80%; background: rgba(255, 255, 255, .7); } Also, is there any reason why you needed to add the !important to the display rule on the .body-container div? @gizmola - apparently I'm going to need to read that article as well as I've not found float collapse to be an issue using flexbox. Or at least I've not recognized that that's what it is... Anyway - thanks for the link!
  15. You've applied the top margin to the body element, so of course it's pushing the body down. Apply top padding to body-container? Sorry - not quite sure what you're asking on this one. As for the background, that really shouldn't be a problem with the structure as it is. gizmola's correct about float collapse, but (I could be wrong here) I'm not sure it applies in this case. If you need to add z-index (again, not sure why at this point) add position: relative; to the divs. That should allow the z-index to work as expected.
  16. For this simple situation, I'd use flex. With a decent transpiler it'll work well in ie11 (10 mostly works once transpiled). .body-container{ display: flex; flex-direction: column; justify-content: stretch; align-items: stretch; background: red; color: white; min-height: 100vh; } .header{ flex-grow: 0; background: gold; } .two-cols{ flex-grow: 1; display: flex; flex-direction: row; justify-content: stretch; } .left-container{ display: flex; flex-direction: column; justify-content: flex-start; flex-grow: 1; flex-basis: 20%; background: green; } .content{ display: flex; flex-direction: column; justify-content: flex-end; flex-grow: 1; flex-basis: 80%; background: blue; } <div class="body-container"> <div class="header">Here's the header</div> <div class="two-cols"> <div class="left-container">menu</div> <div class="content">hello world</div> </div> </div> Give that a shot. Once you get that working, you could always start the move toward semantic markup with header, main, article, and sidebar elements.
  17. Note that requinex's snippet checks for the existence of all the variables, so it's the equivalent of using '&&', not '||'.
  18. Also, you might want to look into PHPMailer - it's safer and more reliable than PHP's native mail() function, and it has debugging options for situations just like this.
  19. You're checking to make sure $_POST['submit'] is set, but not checking $_POST['timer'] before you attempt to assign its value to $result. As to the stop() function issue, that's weird - there's a jQuery stop() function but you're not using jQuery. I'm not aware of a stop() function in JavaScript itself, but that doesn't mean it doesn't exist. Either way, naming the function stopTimer() is more descriptive and probably a better idea anyway.
  20. This is not the code that cyberRobot was talking about. I have to assume there's a startTimer() and stop() function somewhere? If not, then figuring out why this isn't working just got a lot easier... Also, you've got an empty h1 element and you don't have the '>' at the end of your </form> tag.
  21. There's an intrinsic difference between divs and spans. Divs don't display inline unless specifically told to do so, while spans do. So in a case such as this, you'd use a span element instead of div. In this specific case, you'd listen to requinix and use a strong tag as it's semantically and structurally correct.
  22. It shouldn't be showing anything at all. You're not using the dollar sign on either dept_id, then you're not using dept_id and you're making up $actid out of apparently nowhere. In addition to that, you're overwriting the value of $result on each iteration through the foreach loop, meaning that even if everything worked correctly and there were no typos in the code, you'd only expect to get the last result and the code is doing exactly what you're asking it to do.
  23. You could also look into the full text search - https://dev.mysql.com/doc/refman/8.0/en/fulltext-search.html I know the link is to version 8.0 documentation, but full text has been available since at least 5.5.
  24. Barand's right by pointing out not to constrain the height. Your height is the same as your line height, which is why you're getting overlapping text. Kill that and (if necessary) add a display: block; to the .review rule set and that should do it.
  25. Looks like there's work happening in the background that's not being shown right now. The data entry form uses 'raq_*' for it's field names, but the email script uses 'user_*' for it's array indexes. Somewhere there's a function that takes the $_POST data, manipulates it, and returns an array using a different set of indexes. Follow the program flow until you find it.
×
×
  • 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.