Jump to content

maxxd

Gurus
  • Content Count

    962
  • Joined

  • Last visited

  • Days Won

    24

Everything posted by maxxd

  1. Have you considered 'membership_plan_feature(s)' or 'plan_feature(s)'? It certainly seems to me like the most descriptive table name. Entitlements could apply to either member or membership plan.
  2. That's not the error, that's the file and line on which the error happened - show us the entire message, please.
  3. You can add bookmarks to PDFs. It's in the left toolbar. Basically, break up into chunks. It's not an exact description of what you're proposing, but my brain's a bit fried by many things right now and it was the only word that came to mind. In all honesty, it sounds like it's a question of preference - kinda like storing images in a database using a blob. I'm not a fan of it personally, but some people are. Neither side is really right or wrong, just convicted. Too true!
  4. It could absolutely work. For me, though, I'm not sure it'd be worth the extra overhead. After all, now you have to devise and code a way to track what page a user is on when she "closes" the book both when the user is and is not connected to the internet (the user could start reading at home, then continue in the car on a trip or something). And I know I always want bookmarks when reading technical docs, let alone highlights and whatnot. However, that's for me and my situation, which is obviously different than yours. I don't think you'll run into any major issues if you basically serialize your books into posts stored in a database, but as has been pointed out it's not really that great a boost to the security of the book itself. Could be a fun project to code, though 😁.
  5. Amazon offers an app that helps you to create an e-book from a Word document. My 70-year old dad has published and is now selling at least 2 e-books on Amazon right now using it. I can ask what exactly the name was if you don't feel like googling it yourself. If you're determined, however, I'd agree with pretty much everybody on this thread - put the files outside the webroot and serve them only after you run your account verification. If the user is determined to steal something off your website, there are so many ways to do it that no anti-theft practice is going to stop them. Sorry.
  6. On the off chance someone finds this in the future, apparently the answer is that you don't specify the auto-increment column and the call to $table->timestamps() must come last in the method. I finally dropped the $table->bigIncrement('id'); line and put the $table->timestamps(); call last in the stack, and now it works. So, you know... cool.
  7. Hi y'all. So I'm not new to frameworks in general but am new to Laravel specifically. I'm working through a thing and am running into an issue where a migration will create the specified table, but won't create the proper columns. Using the example in the documentation I get this behavior. For instance, <?php use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class CreateFlightsTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('flights', function (Blueprint $table) { $table->bigIncrements('id'); $table->string('name'); $table->string('airline'); $table->timestamps(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::drop('flights'); } } This leaves me with a table named 'flights' that has the columns 'id', 'created_at', and 'updated_at'. Please note this code is copied and pasted from the Laravel migration documentation. Anybody have any words of wisdom on this? It's driving me nuts and I'm sure it's something simple I just don't know about.
  8. Drupal works on the idea of hooks - predefined actions that fire at certain times in the execution of the application and will run any functions or object methods that have been assigned to that hook. Think mini state-machine, kinda. See here for more information, and here for a list of native hooks. I haven't dug too much into Drupal, honestly (I looked into it as a WordPress replacement at my previous job, but decided the admin area would be too difficult for our clients to work with), but once I got the list of available hooks things got much, much easier to deal with. Like any framework or CMS, there's a lot of "magic" that happens. It's kind of a pain and a bit difficult at first because - well yeah, you're absolutely right - a lot of it isn't terribly well documented if it's documented at all. However if you don't want to build the thing from scratch you're gonna have to deal with that. As far as I know, using a framework like Laravel or Symfony isn't going to be all that different with regard to this kind of thing - they're all dialects of PHP, and each has their own idiosyncrasies. Now that having been said, if what you've described is the full extent of what you're looking to do I'd be rather surprised if there weren't plugins available in the Drupal ecosystem that can do what you want without having to code at all. Maybe some custom JS or CSS just to personalize things but the heavy lifting should be taken care of out of the box.
  9. Honestly, given the light specs you've described I think a framework would probably do most of the work for you. If you're wanting to learn, do it from scratch - what you've described is not tough to do (it is, however, tough to do right - which makes it a good learning experience). If it's a work thing where you're on a deadline but you've got free reign, look at some frameworks. Heck, what you've described can be done in WordPress with little to no coding.
  10. It looks like your validation script makes zero sense, but it's hard to tell without braces and/or correct indentation. But it certainly looks like the first thing you do is attempt to assign $_POST['account'] to $acct_subject if and only if $_POST['account'] is empty.
  11. Your while() criteria is incorrect and unnecessary. I haven't tested this code, but give it a shot: $acceptedStates = [ 'Feasibility', 'Measure Up', 'Model Drawing', 'Concept Design', 'Developed Design', 'Resource Consent', 'Construction Documentation', ]; $xml = simplexml_load_string($response); $xml = usort($xml, function($a, $b){ return $a['job_due'] <=> $b['job_due']; }); foreach($xml->Jobs->Job as $item) { if(!in_array((string)$item->State, $acceptedStates)){ continue; } $projects[] = [ 'job_no' => (string)$item->ID, 'job_name' => (string)$item->Name, 'job_due' => date('d/m/Y', strtotime($item->DueDate)), 'job_status' => (string)$item->State, 'job_staff' => (string)$item->Assigned->Staff->Name, ]; }
  12. All that having been said, if you're using $_POST input in a WordPress environment (which obviously I know you are), use some kind of safety features. I'd recommend at least using a WordPress nonce in the form output and data validation routines, and use the wpdb::prepare() method on the query. It's not a prepared statement exactly, but it is a little more responsible than just blindly trusting user-submitted data, especially if you're expanding your user base as you said you were in one of the other threads.
  13. Either of these functions will do what you want, and without you having to recreate the wheel.
  14. Don't let my bad mood scare you off - most people around here are very helpful and nice. Having said that, one of the things that's going to help you learn how to code is to try things. The code you've already seen in this thread uses class-based selectors and dynamic ID and class assignment. So, if you extrapolate the two, you can use the dynamic class/ID assignment you've seen with the appropriate selector method. If you try it and it doesn't work out, then post the code you've tried and we can help you figure out why it didn't work; the important part is to show the work you've done.
  15. It's not. Here. Yes. Here. Admittedly, I'm asking you to think a little when it comes to some of it, but ... really? Beyond that, Barand has been his typical self and gone above and beyond the call of duty to answer your questions in no uncertain terms and with concrete code examples; yet there are more requests to simply do it for you.
  16. I would use grid. Using the data-pos="n" attribute selector in CSS and JS you change the color as you want. You could also just use the IDs in the linked fiddle if that's easier. You could also use the nth-of-type() selector in CSS to cut down on the typing if you want.
  17. Give them different attributes as you create them. What does your code look like so far?
  18. Use get_home_path(). require_once(get_home_path().'wp-admin/includes/class-walker-nav-menu-edit.php');
  19. Try esc_attr() or get_post_field('post_title', $post, 'display')
  20. It looks like you should urlencode($subterms->name). What CMS are you using - knowing this might help you get more specific information about your problem.
  21. There is a way to do both these things. Reading the manual is a great place to start.
  22. This is not how you do a prepared statement. You're still injecting the variable directly into the SQL string. Check the manual for the proper way to use prepare() (note that the link is for PDO, but the concept is the same for mysqli.
  23. There's a part of me that thinks they're developing future PHP specifically to make the kids think they're programming in JavaScript... I mean, I actually really like fat arrow functions in JS, but every time I see an example of it in PHP I have to pause a second and readjust my brain.
  24. Given the requirements from your company, I'd definitely argue that you're not an idiot. There are times when you have to just do what you've been asked to do, no questions. And yeah, if there's a chance that you'll be moving to a different CMS, extracting specific data from the posts table is difficult at best.
×
×
  • 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.