benbyf

Members
  • Content count

    575
  • Joined

  • Last visited

  • Days Won

    3

benbyf last won the day on July 18 2016

benbyf had the most liked content!

Community Reputation

571 Excellent

About benbyf

  • Rank
    Hero Member

Contact Methods

  • Website URL
    http://www.benbyford.com

Profile Information

  • Gender
    Not Telling
  • Location
    London / Bristol, UK

Recent Profile Visitors

13,672 profile views
  1. think i fixed it! adding $user->setOutputFormatting(false); GRRRRRRRRRRRRR OF() trips me up everytime. is there a good reason why this is here?? can't it default to not always being a pain
  2. Hello, having trouble getting PW to save my user or field in cron hook. It seems to report the same field info each time unchanged. It should be counting down in seconds. public function init() { // set to every30Seconds in settings $this->defaultInterval = $this->cron_check; // add hooks to CRON $this->addHookAfter("LazyCron::{$this->defaultInterval}", $this, 'checkUserSubscription'); } public function ___checkUserSubscription(HookEvent $e){ // seconds since last lazycron $seconds = $e->arguments[0]; $log = wire('log'); $field = $this->exclusiveRole; // users with specific role and field $users = $this->users->find("roles=$field"); foreach ($users as $user) { // get stored time $currentTime = $user->get($this->fieldName); // if time not null if($currentTime){ // evalute stored time minus time past $resultTime = intval($currentTime) - intval($seconds); $log->message("result ".$resultTime); // save user page $user->set($this->fieldName, $resultTime); $this->users->save($user); } } }
  3. Hi @kaba86 as @dragan mentioned you can simply add another foreach loop to check another level down. I would defiantly check out some tutorials on using processwire to get yourself kickstarted in the right direction and theres lots of quality tutorials not to mention some of my own. https://processwire.com/docs/tutorials/ <?php $children = $pages->get('/')->children; foreach($children as $child){ $class = ""; if($page->id == $child->id){ $class = " current"; } if($child->id == $page->parent->id){ $class = " parent"; } // echo nav links echo '<a name="'.$child->title.'" class="ajax-link'.$class.'" href="'. $child->url .'">'. $child->title . '</a>'; // new code below $childChildren = $child->children; foreach($childChildren as $subChild){ $class = ""; if($page->id == $subChild->id){ $class = " current"; } if($child->id == $page->parent->id){ $class = " parent"; } echo "<div class='sub-item'>"; echo '<a name="'.$subChild->title.'" class="ajax-link'.$class.'" href="'. $subChild->url .'">'. $subChild->title . '</a>'; echo "</div>"; } } ?> The above is not optimised or elegent - just off the top of my head. I seem to remember one of the default themes has a funciton in it's _func.php file that gives you a nest page list given a page varible (and optional max depth) so you could use that too. Hope that helps (also please post you website when its done
  4. So no idea what happened here in the end, I solved the issue by deleting the Role, adding the role again and assigning the template as viewable. This solved it by I have no idea why (I guess there must have been a setting somewhere that was conflicting).
  5. no dice. Same headers, same server, same version of PW (latest stable), same permissions as far as i can see and same roles but one site wont let that the members user access a template :/ grr
  6. Sorry, hows the best way to do this?
  7. Thinking im starting to lose it. could there be a bug in PW 3.0.62? still cant seem to get this to work with the template view permissions set to guest no-view and member role can view if($session->login($username, $pass)){ $session->redirect($pages->get("/events/")->url); }
  8. thanks @ethanbeyer. its so unbelievebly strange, it must be server settings as it works fine as I have currently on dev but not on live. Thanks anyways though!
  9. Sure this has been asked a million times but cant find a simple answer. Trying to set the page to redirect to after login in the front end - i.e. not on the admin login page. some reason this works for super users but not normal users redirecting to a page which is viewable by members not guest role users. $showLoginError = false; if($input->post->user && $input->post->pass) { $username = $sanitizer->username($input->post->user); $pass = $input->post->pass; try { $session->login($username, $pass); // redirect user $session->redirect("/events/"); } catch (\Exception $e) { $showLoginError = true; } }
  10. Couldnt get the tracking and partial headers to work together so ive allowed the RSS feed direct link to the file and only track when viewing on the site. This seems to work now on itunes and means users can track through the audio which was erroring before :/
  11. ? think you have to make the form yourself, no? or do you meand the Stripe button? not sure you can style much coming direct from Stripe.
  12. how? its a shared host, so god knows.
  13. Update: Seems to work fine on dev site and not on live. could there be some strange server differences happening?!
  14. Thought I's try SystemNotifications and found it over kill as I would get alot of warnings, changes and errors appearing and persisting which was scaring my client. But now I'm unable to uninstall it without getting errors on the user edit page saying it requires a module that doesnt exsist any more... anyone had this issue or can recommend how to use this module correctly?
  15. HELLO! having user Role issues. I've got a Role: members and a template that is set to only allow view of Members and to redirect anyone else to / but id redircts Member users still currently, and only alows people to view the page if the template is set to view on the guest role also. Any help would be appreciated. I'm running ProcessWire 3.0.62