Jump to content

Robin S

Members
  • Posts

    4,928
  • Joined

  • Days Won

    321

Everything posted by Robin S

  1. Right you are, I didn't read carefully enough. AdminCustomFiles sounds like a good solution.
  2. The whole module should be in /site/modules/ to begin with. You don't install modules into /wire/modules/ - that is only for the core modules.
  3. Thank you, adrian. That fixes it. Just adding the curly braces around $fM['type'] was enough to avoid the error message. Before I read your reply I was doing $function = $fM['type']; $fields->add( self::$function($f, $fM['label'], $data[$f], $fM['desc']) ); which also worked.
  4. When used with PHP7 I get this fatal error: Uncaught Error: Access to undeclared static property: MaintenanceMode::$fM in /home/mysite/web/test/site/modules/MaintenanceMode/MaintenanceMode.module:94 Is there an easy fix for this?
  5. @Neo, I might be misunderstanding the flow of events but if you don't want people who haven't paid to submit the form you only render the form after payment. This wouldn't require any special Form Builder feature, just normal template logic. So it would go like this: User submits payment to MercadoPago from a payment page on your website. You check the response from MercadoPago to see if payment is successful. There must be some method in the MercadoPago API for this. If the payment was successful you render the form, maybe populating a hidden field from a get variable if you want to match the form submission to a payment. User submits the form for moderation.
  6. @creativejay, my guess is that this is caused by mod_security. Try disabling mod_security (or ask your host to disable it) and see if that resolves it.
  7. Thanks, I think you're right. However on a shared server I don't think it's possible to change the MySQL timezone. I found the following suggestion for adjusting the MySQL timezone via PHP: mysql_query("SET time_zone = '-6:00'"); Is there a better way to execute this using one of PW's $database methods? And where would be the right place to put this? In /site/init.php? It would be nice if the Session Handler Database module saved timestamps with PHP's timezone so this wasn't necessary. GitHub issue
  8. I installed the core Session Handler Database module but the times shown are out by two hours. That is, the time for a new login is shown in Session Handler Database as "2 hours ago". Probably a timezone issue, but what setting do I need to adjust to correct this? The timezone in my config is correct.
  9. I'm not sure what would cause the error you're getting, but something you could try is migrating without using the Export Site Profile module. My normal procedure is: Export the database using PhpMyAdmin on the old host ZIP all the files on the old host, download ZIP Create a new empty database on the new host and import the database export from step 1 Upload and extract the ZIP on the new host Edit config.php to change database name/password if necessary
  10. I'm striking the same problem. I'm using Ryan's findRecentComments function (which in turn uses FieldtypeComments::findComments). This works well if you want the latest comments from any page. But I want to limit the list of latest comments to pages with a particular property. I think the only way to do this is to use the pages_id value of a comment, which stores the ID of the page the comment is on. First I was hopeful that pages_id would support sub-selectors but no joy there. So then I figured I'll build a PageArray of pages I want to limit my latest comments list to and give that to pages_id in the selector, but that doesn't work either. Even manually entering a set of bar-separated page IDs doesn't work. Is there some trick to getting pages_id to accept anything apart from a single page id? Edit: This line explains why the problem exists. I have submitted a GitHub issue / feature request.
  11. My project allows paying users access to protected front-end content and my client is concerned about users sharing their login details among a group rather than each purchasing an individual account. Of course there is only so much you can do to protect against this and there will always be loopholes, but I'm wondering if I can provide some basic protection against this. My idea is a maximum of two IP addresses may be simultaneously logged in to any user account, but I'm not sure where to start with implementing this. Is there an existing module or snippet that would give me a starting point for limiting simultaneous logins? I'm also interested in hearing any other ideas for tackling this issue. Thanks.
  12. Hi @Hardoman, welcome to the forum. There are two ways you can achieve this. 1. If all the pages you want to link to with target="_blank" have the same template you can use the 'xtemplates' option. Example: $nav = $modules->get('MarkupSimpleNavigation'); $nav_options = array( 'xtemplates' => 'my_template', 'xitem_tpl' => '<a target="_blank" href="{url}">{title}</a>' ); echo $nav->render($nav_options); Now all links to pages using my_template will have target="_blank". 2. If you need to use a different or more specific selector than just template you can use a hook. function menuSpecialLinks(HookEvent $event) { $child = $event->arguments('page'); // current rendered child page // any logic with $child possible here if($child->name == 'my-page-name') { // set the return value of this hook to a custom string $event->return = "<a target='_blank' href='{$child->url}'>{$child->title}</a>"; } } $nav = $modules->get('MarkupSimpleNavigation'); $nav->addHookAfter('getItemString', null, 'menuSpecialLinks'); echo $nav->render();
  13. Okay, replace filter() with find(): $tagless_images = $page->images->find("tags=''");
  14. Yes, I probably will do a normal cron, but I'd like to get my head around Lazy Cron just so I understand how it works. And I must be thick because I'm still not getting it. I think I understand about how it depends on the timestamp in LazyCron.cache, but when is the first timestamp set. Because doesn't everything depend on that? Presumably before any Lazy Cron hooks are added there is no timestamp at all. Then I add my first hook, and it's an "everyDay" hook. Does this set the timestamp... a) On the next page load immediately after I save the hook (let's say it's 2pm when I happen to save this hook). Then my hook will forever fire at approximately 2pm every day, give or take depending on page loads. b) It has nothing to do with when I save the hook, but rather it's fixed to some standard time such as midnight. So I save my hook at 2pm, but it first fires at midnight (same day? following day?) and then will forever fire at approximately midnight every day, give or take depending on page loads. Edit: I also understand that by nature a lazy cron will drift in time because the variations in page loads accumulate with every execution, but I'm still interested in when that first execution takes place. Thanks for your patience.
  15. Thanks. Still not quite clear on when the first execution will fire. Let's leave aside the issue of page views and assume my site continuously gets page views every second. If I create a new hook for "everyDay" and happen to save this hook in my ready.php at 2pm, does 24 hours elapse before the first execution, and then the hook fires again 24 hours after that, at 2pm every day? If that is so, how can I arrange for an everyDay hook to fire at a given time (approximately)? Say 1am. Because even if I follow the suggestion in the lazy cron docs and set a normal cron job to load a page at 1am, if 24 hours has not yet elapsed it's not going to trigger my lazy cron. That's just going to keep on firing at 2pm isn't it?
  16. I don't think the "B" and the "I" icons are meant to represent <b> and <i> HTML tags - they are likely carry-overs from the icons used in word processors. As far as I know pretty much all WYSIWYG editors insert <strong> and <em> tags for these buttons. The CKEditor docs confirm the Format dropdown is only for block-level elements so that's what's probably crashing it.
  17. For my CKEditor fields the "B" (Bold) button does apply the strong tag. I think the Format dropdown is for block-level elements.
  18. Does reversing the sort order help? sort=-my_repeater.my_checkbox
  19. If I have a Lazy Cron hook with an interval of "everyDay", when during the day does the hook fire? Is it every 24 hours from whenever the hook is first set or is it tied to a particular time of day such as midnight every day?
  20. Nice work! Just a heads up that on the International page the map marker for the export to New Caledonia is actually sitting on New Zealand, not New Caledonia.
  21. I doubt it makes much (or any) difference in terms of performance but you can do the same a bit more briefly like this: $items = $page->children("sort=title"); $items->prepend($items->find("featured=1, sort=timeon"));
  22. Thanks for the suggestions. Going down this road could lead to a very fractured roles setup, and kind of amounts to treating each role like a permission. But that does give me the idea of solving this via custom permissions that can be shared by two or more roles. Which is probably the way to go.
  23. Just installed PW3 so I could get a closer look at the new images field. The appearance and interactions are both really slick. Some feedback: I think having the option to get an overview of which images in the field are landscape vs portrait, which have descriptions and which have tags is very important. The aspect ratio thing could perhaps be solved with a toggle between fit and fill for thumbnails. But for the description and tags I think we need to be able to toggle to something like the old list view. Not being able to see these things across all images would be a real annoyance in some situations. I think there needs to be a max-height set for images in the enlarged view. As @titanium pointed out, some images could be very tall and narrow and at some point the enlarged view will get excessively tall. Perhaps the enlarged image area should be defined as a 1:1 ratio and the image scales to fit.
  24. From what I've read on the forum I believe the Dynamic Roles module has some serious bugs and probably should not be used for production websites in its current state.
  25. The new user-admin permissions introduced in v2.6.10 are great, but I don't think they work in quite the right way. Suppose I have these roles: superuser editor member guest The two of interest here are editor and member. Editor is a site editor/administrator and member is a front-end-only user. There are various restricted front-end pages that guest does not have access to - the member role is needed. Users with the editor role have also been given the member role, so they can browse the front-end as a member would. It is possible to set the site up differently so editors do not also have the member role and restricted front-end access is given to member or editor, but in principle roles are meant to be cumulative so it's not unusual for a user with a higher-level role to also be given a lower-level role. The problem comes when editor needs to be given admin access to the Users section. What is desired is that editor can only edit users with the member role alone (and the guest role of course). At first glance you would think that giving editor the user-admin-member permission and not the user-admin-all permission would achieve this. But if the role has user-admin-member permission it also gives the ability to edit other users with the editor role. This should not happen in my opinion. It would be better if the user-admin-[role] permissions worked such that a role needs to have the permissions for all the roles another user has before they can edit that user. So to edit another user with the editor role the permissions needed would be: user-admin-member user-admin-editor Hope I've explained this well enough.
×
×
  • Create New...