• Content Count

  • Joined

  • Last visited

Community Reputation

66 Excellent

About ethanbeyer

  • Rank
    Full Member

Recent Profile Visitors

707 profile views
  1. Sorry for the late reply - thank you! That had been confusing me a lot.
  2. I've been looking for the answer for this everywhere - and I appreciate the answer. But *where* in the Core is the "textformatters" attribute instantiated?! I can't find it anywhere. I don't see it in the Textformatter class, or Field, Fieldtype or FieldtypeText. Any ideas?
  3. ethanbeyer

    @Jon this sounds a little strange. Reading most of your comment, I would think that this might have something to do with your Office365 having sending limits that you're going over. The TLS issue is what makes it weird, though - because if it was a limits problem, that would not be happening. Is there anything in the logs that gives what error is encountered, rather than saying it just stops sending?
  4. ethanbeyer

    At the risk of sounding very pedantic, this condition would result in the timestamp for any page with template cache enabled, which is not what I'm looking for. I only want the timestamp to appear on cached versions of the page - so if I am logged in, and am served a page that doesn't give cached pages to logged-in users, I don't want the timestamp (or maybe I would have a different comment that said this page was generated now and is not cached, etc). On the other hand, if I was not logged in, and looked at the source for the same page and was served the Cached version, I'd expect to see the timestamp. Essentially, I am looking to inject the comment ONLY at the time of the creation of the cached page, not on normal render - so this makes me wonder if there's a hook I could grab before page render to determine whether or not the page render was being performed in order to create a CacheFile. Does this make sense?
  5. ethanbeyer

    Well, I feel a bit silly. I didn't think that needed to be done because of the call to $sanitizer->selectorValue($input->get('s')); . Anyhow, you solved my problem - and I think you're right: String Selectors are probably an easier method to go with than Array Selectors until they've been documented better.
  6. ethanbeyer

    In theory, yes - but the largest problem with that approach is that the timestamp is always there. This is mostly for my OCD brain, but I essentially wanted a sanity check in the source that would quickly show that a page was or was not cached, and when.
  7. ethanbeyer

    As a follow-up...has anyone ever built a site using delayed output with template caching? This is a new frontier for me and I don't know how to set it up.
  8. Not sure if this is possible - but I'd like to add something like this to cached pages via Template Cache: <!-- Page Cache Generated 2018-05-22 @ 12:45:44 UTC / Expires 2018-05-29 @ 12:45:44 --> I thought there might be a way to see if a cache file existed for the page in question, and if it did not, to include that comment in the render->cacheFile->save(). Does anyone know?
  9. ethanbeyer

    I don't think anything has changed with Repeaters in this realm yet.
  10. I'm trying to build a Search Template. The way I had been doing it was by constructing a Selector one string at a time in an array, and then imploding that array with ", " in order to create a Selector that was passed to $pages->find($selectorStr). This is a bare-bones example of what I was doing: $search = $sanitizer->selectorValue($input->get('s')); $selector[] = 'template=member'; $selector[] = "field1|field2|field3%={$search}"; $selector[] = "(repeaterField.fieldX|repeaterField.fieldZ%={$search})"; $selectorStr = implode($selector, ", "); $results = $pages->find($selectorStr); This worked as expected, and I was able to utilize OR-groups within the Selector. There is a problem, though: for whatever reason, despite sanitizing the incoming value, if the user input a string like "test,foo", ProcessWire threw this error: Exception: Unknown Selector operator: '' -- was your selector value properly escaped? field='foo', value='', selector: 'include=all, children.count>0, title%=test,foo' (in /var/www/public/wire/core/Selectors.php line 378) So I moved on to Selector Arrays, and now I'm having trouble with OR-groups. I found out about Selector Arrays (not documented at all as far as I can see in the API Reference) through a ProcessWire blog post about 3.0.13. Here's the code (using the actual field names, unlike above): $selectorArray = []; // template $selectorArray[] = ['template', 'directory-member']; // basic fields $selectorArray[] = [ 'field' => [ 'dm_firstName', 'dm_middleName', 'dm_lastName', 'email', 'dm_ficmTitle', 'dm_addressStreet', 'dm_addressCity', 'dm_addressState', 'dm_addressPostalCode', 'dm_birthday', 'dm_phone1', 'dm_phone2' ], 'operator' => '%=', 'value' => $searchStr ]; //repeaters $selectorArray[] = [ 'field' => [ 'dm_contactREP.dm_contactMethod', 'dm_contactREP.dm_contactValue' ], 'operator' => '%=', 'value' => $searchStr, 'group' => 'repeaters' ]; // search the parent's name $selectorArray[] = [ 'group' => 'parentTitle', 'field' => 'parent.title', 'operator' => '%=', 'value' => $searchStr, ]; // sort $selectorArray[] = ['sort', 'dm_lastName']; $selectorArray[] = ['sort', 'dm_firstName']; The problem is that the Selector is rendered like this (clauses broken into Newlines): template=directory-member, dm_firstName|dm_middleName|dm_lastName|email|dm_ficmTitle|dm_addressStreet|dm_addressCity|dm_addressState|dm_addressPostalCode|dm_birthday|dm_phone1|dm_phone2%=test, repeaters@dm_contactREP.dm_contactMethod|dm_contactREP.dm_contactValue%=(test), parentTitle@parent.title%=(test), sort=dm_lastName, sort=dm_firstName, status<1024 For OR-groups, the whole clause should be wrapped in parentheses - not just the value I'm searching for! So, two questions: Why would a comma in the search value break things that are supposed to be sanitized, and two, how do I get the OR-groups to work as intended?
  11. ethanbeyer

    @alexmercenary Could you post your code? Chances are the variable you're trying to use the attachment() method on isn't an instance of WireMailSmtp.
  12. ethanbeyer

    @gebeer I've looked at your solution and put it in place - and it s a much better start than I would've thought of. I'm not sure it does everything I need it to right now, but I can keep tinkering and I will report back. This is the first time when something ProcessWire does hasn't made a lick of sense to me.
  13. ethanbeyer

    @gebeer It looks like you got further into the solution than I did. Tabs and repeaters were a problem for the Profile Edit screen for me, too. So I eventually gave up and gave users of that template type a role that gave them page-edit permissions, but I hadn't worked out how to make sure that people were only editing their own profiles - so I think your two hooks are helpful there! I know there's a difference in form and function for Profile Edit and Page Edit, but our scenario (where Users = Content) seems like a time when keeping the two completely separate breaks down. I think your method is clean and I will give implementation a shot. Thank you!! Edit: Just saw you'd posted twice in this thread, and just now read the first: That. Exactly that. In full! If it's on a profile page, and I've given the user the permission to edit their page...they should be able to do whatever is necessary on it.
  14. ethanbeyer

    That's strange!
  15. ethanbeyer

    In my _init.php file, the first thing I include is _login.php: <?php // Handle logouts if(isset($input->get->logout)) { $session->logout(); $session->redirect($page->path); } // If they aren't logged in, then show the login form if(!$user->isLoggedin()) { // check for login before outputting markup if($input->post->user && $input->post->pass) { $user = $sanitizer->username($input->post->user); $pass = $input->post->pass; if($session->login($user, $pass)) { // login successful $session->redirect($page->path); } else { $session->login_error = 'Login Failed. Please try again, or use the forgot password link below.'; } } ?> <!DOCTYPE HTML> <html lang="en"> <head> <title>Login</title> <link rel="stylesheet" href="/build/css/app.css"> </head> <body> <div class="container py-5"> <form action='./' method='post'> <div class="row"> <div class="col-12 col-sm-6 offset-sm-3"> <h1>You must be logged in.</h1> <div class="login"> <? if($input->post->user && $input->post->pass) { echo "<p class='error'>" . $session->login_error . "</p>"; }?> <p><input class="form-control" type='text' id="user" name='user' placeholder='Username'/></p> <p><input class="form-control" type='password' id="pass" name='pass' placeholder="Password" /></p> <p><input type='submit' class="btn btn-primary" name='submit' value='Login' /></p> </div> </div> </div> </form> </div> </body> </html> <? die(); // don't go any further if not logged in } If I go to, I am met with a login. After logging in, it takes me straight to the URL I intended to go to before needing to log in. You could change the $page->path to $pages->get('/events/')->httpUrl; - would that work?