Jump to content

adrian

PW-Moderators
  • Posts

    10,912
  • Joined

  • Last visited

  • Days Won

    349

Everything posted by adrian

  1. You could create this functionality yourself without too much work. I am not a form builder expert, but I have integrated PayPal into a manually created front-end form in PW. If you want to use FormBuilder I think you want to hook into: FormBuilderProcessor::formSubmitSuccess Do you already have form builder and access to the VIP support board for it? There are a lot of posts over there about hooking into it and adding functionality. Here is some info I posted about paypal integration with PW: https://processwire.com/talk/topic/5281-paypal-payment-method-for-processwire-shop/?p=67670 Using the IPN feature of PayPal to return payment success and then publish the page should be pretty straight-forward. Let us know if you have any more specific questions once you get started.
  2. <link rel="stylesheet" href="<?php echo $config->urls->assets; ?>scripts/foundation/css/foundation.css"> Although the convention is to put them under templates/scripts etc, in which case you'd want: <link rel="stylesheet" href="<?php echo $config->urls->templates; ?>scripts/foundation/css/foundation.css"> This way you will always have the full url to each resource. You could also just do: <link rel="stylesheet" href="/site/templates/scripts/foundation/css/foundation.css"> These root relative paths will always work no matter what page you are on.
  3. I can't see what is missing, but have you tried this approach to ensure that your call to load the module also loads all required js and and css files: foreach($config->scripts->unique() as $file) echo "\n\t<script type='text/javascript' src='$file'></script>"; foreach($config->styles->unique() as $file) echo "\n\t<link type='text/css' href='$file' rel='stylesheet' />";
  4. You could also have these links added as entries to the Redirects module (http://modules.processwire.com/modules/process-redirects/).
  5. Hi @joer80. Looks good! Just a few minor layout issues I noticed quickly in Chrome (not tested elsewhere): Unnecessary horizontal scrollbar appearing at all widths The very bottom dark grey is full width (maybe more), but the lighter one and the banner one are not quite (seems like only on the homepage) At narrower screen widths the contents of the bottom list of links (light grey div) are touching the left edge of the viewport - needs some margin/padding
  6. This works: $this->addHookAfter('InputfieldImage::render', $this, 'addTest'); public function addTest(HookEvent $event) { $event->return .= 'test'; } No need to go with InputfieldFile because your changes are only relevant to image fields.
  7. isLoggedIn() doesn't actually have anything to do with whether the user is actually logged in or not - all it does is check if the current user visiting the page is in fact a registered user and not a guest: https://github.com/ryancramerdesign/ProcessWire/blob/6cba9c7c34069325ee8bfc87e34e7f1b5005a18e/wire/core/User.php#L294 So there is no way it could be of any use for looking up whether a specific user is currently logged in or not EDIT: Sorry that might have come across too adamant - of course the user's id is stored in a session variable. I think Pete's synopsis of how tricky this can be is spot on!
  8. I think this should help with what you are trying to achieve: function isUserOnline($userid, $mins=1){ $table = SessionHandlerDB::dbTableName; $sql = "SELECT COUNT(*) FROM $table " . "WHERE ts > '" . date('Y-m-d H:i:s', (time() - ($mins * 60))) . "' " . "AND user_id=" . $userid . " ORDER BY ts DESC LIMIT 1000"; $result = wire('db')->query($sql); $row = $result->fetch_array(); return $row[0]==1 ? true : false; } $whois = $pages->get("template=user,name={$page->name}"); if(isUserOnline($whois->id)) { echo 'true'; } else{ echo 'false'; } With this function you can pass the id of your $whois user to the function and have it return true or false as to whether they are logged in or not. You can pass a second argument to increase the time from 1 minute if you'd prefer. eg: if(isUserOnline($whois->id, 5)) { // 5minutes Hope that helps.
  9. I didn't have to bother. Check out this answer: https://processwire.com/talk/topic/5318-select-online-users/?p=51205
  10. I see - now I understand. I don't think there is any way to interact with the sessions table using the API, so I think you'll have to use some SQL. Take a look here at the code from the Sessions Process module: https://github.com/ryancramerdesign/ProcessWire/blob/master/wire/modules/Session/SessionHandlerDB/ProcessSessionDB.module#L62 I don't have time to write up an example at the moment, but hopefully you can figure it out from there. Otherwise, I will try to help later
  11. Are you trying to test if the logged in user is the person whose page it is? if($user->name == $page->name)
  12. The path history module should take care of those redirects for you. I haven't actually used the date archiver module, so not sure if there is something built-in to take care of this, but from a quick read, it doesn't sound like it. One other possibility is http://modules.processwire.com/modules/process-redirect-ids/ which allows URLs to contain the ID of the page, so even if the name/path changes, the link will always work - just like the way this forum uses the topic ID rather than the title part of the url to load the page.
  13. Thanks @jtherczeg. The best way to handle bugs (no matter how small) is probably by posting an issue at Github (rather than a PR). Thanks for spotting!
  14. Yep $p = $pages->get(xxxx); $p->parent = $pages->get("/archive/"); $p->save(); But with that approach, you might find the Date Archiver module useful: http://modules.processwire.com/modules/process-date-archiver/
  15. Hi @mameluco and welcome to the forums. Here is a pretty comprehensive thread on the issue: https://processwire.com/talk/topic/858-sqlite-has-ftt-could-it-be-a-viable-alternative-database-backend-for-pw/
  16. There are a few small things wrong with that code - missing parent, save not save() etc. This works for me: $p = new page(); $p->template = 'basic-page'; $p->parent = $pages->get(1); //set parent to homepage $p->title = 'testing7'; $p->save(); $p->images->add("http://i.imgur.com/nFJzvUQ.jpg"); $p->save(); Are you talking about the thumb that gets created when you have "Display Thumbnails in Page Editor" checked. The 200 in the filename is throwing me, since these are usually 100px high. I am getting the thumbnail created as soon as I load the page in the admin. What version of PW are you running?
  17. Do you need them actually tagged somehow as expired, or could the selector in your template file just exclude all posts before a certain date? $pages->find("created<xxxx"); or perhaps from a custom published_date field, or whatever.
  18. Macrura has developed module for this scenario (I think): https://processwire.com/talk/topic/6417-processwire-profields-table/?p=64275 The other thing - if you just want to make use of creating child pages with the PageTable interface, rather than actually use them in a PageTable field, check out: https://processwire.com/talk/topic/6102-batch-child-editor/?p=59733 The latest version's edit mode works very similarly to the PageTable edit mode - take a look at the screenshot for "3. Edit" in the first post. You can add new, sort, delete, quickly rename, and click to edit all fields in a modal popup.
  19. Absolutely not - I like what you have done - you just might want to consider changing the layout via a hook instead of modifying the core.
  20. Hi blad - take a look on the Input tab of your images field and check the "Display thumbnails in page editor" option Of course it doesn't float them like you have, but you can use the grid mode toggle for that - button at the top right of the field in the page editor. PS Not meaning to suggest your enhancements aren't nice by the way
  21. This post should be helpful: https://processwire.com/talk/topic/4960-limit-number-of-pages-that-can-be-added/
  22. Are you running 2.4 stable? Does this dev commit fix the issue for you: https://github.com/ryancramerdesign/ProcessWire/commit/c18cf1e62eaafb3df1071a8c0936e5346721f754
  23. It looks like ProcessDatabaseBackup is already on the way https://github.com/ryancramerdesign/ProcessWire/commit/52c09f5ef1980b7cad3876e8332254f3792e795d#commitcomment-7463067
  24. The backup/restore stuff was easy thanks to Ryan I haven't given the module a permission setting so I think that limits it to superuser accounts. Are you seeing otherwise? Something a little weird I just noticed - if you try to enter the url to a Process module, eg: http://pwtest.dev/admin/setup/migrator/ when logged in as a user without the appropriate permission, you get this error: TemplateFile: Unrecognized path - maybe that's better than a meaningful error saying you don't have permission or something? Anyway, I think this is locked down sufficiently to superusers?
  25. @djr - in case you haven't seen it yet, Ryan has added a WireDatabaseBackup class to the core: https://github.com/ryancramerdesign/ProcessWire/commit/52c09f5ef1980b7cad3876e8332254f3792e795d Maybe you can make use of this directly in your module once PW 2.5 is released.
×
×
  • Create New...