Jump to content

tinacious

Members
  • Posts

    87
  • Joined

  • Last visited

Everything posted by tinacious

  1. You're right, making my own login form got the job done way easier. I should've just done that from the start... The first link helped. Thanks!
  2. Thanks but that doesn't work either.
  3. Hey, I changed "yourFrontendRole" to an actual role but it doesn't work. I get a server error when using that. It's detecting the role because superuser has no problems logging in but upon logging in with my 'standard' role I've created, it causes a 500 error. I think it's having trouble at the $this->session->redirect part. This is what mine looks like (it's not working) class LoginRedirect extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'Login Redirect', 'version' => 1, 'summary' => '', 'author' => '', 'singular' => true, 'autoload' => true, ); } public function init() { if($this->user->hasRole("standard")) { $this->addHookBefore('ProcessHome::execute', $this, 'redirectToFrontend'); } } public function redirectToFrontend(HookEvent $event) { $this->$session->redirect($pages->get(1)->url); } }
  4. Hi all, I would like to redirect the session after successful login for a specific role. I want to keep a specific role in the front-end most of the time and upon successful login, would like to redirect them to the front page instead of the Pages section in the back-end. How would you suggest hooking into the login function and redirecting that role upon successful login? I know I'll need to use $session->redirect(). Thanks!
  5. Ok so I gave it a shot with creating a module by altering Ryan's code you linked to and this seems to be working so far (I think). Here's the module using that code teppo linked to, slightly modified to match my requirements: <?php /** * Edit Yours Only * */ class EditYoursOnly extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'Edit Yours Only', 'version' => 1, 'summary' => 'Custom module to allow users only to edit pages they created. Applies to role \'standard\'', 'author' => 'Christina Holly, TinaciousDesign.com', 'singular' => true, 'autoload' => true, ); } public function init() { if($this->user->hasRole("standard")) $this->addHookAfter("Page::editable", $this, 'editable'); } public function editable(HookEvent $event) { // abort if no access if(!$event->return) return; $page = $event->object; // criteria required in order to edit if($this->user->name !== $page->createdUser->name) $event->return = false; } } If anyone sees any problems that this could cause, please let me know. So far it appears to be working as I want it but I haven't tested it thoroughly. Thanks!
  6. Hey teppo, thanks for the reply, this is the sort of thing I'm looking for. The "only grants edit access if this page was created by current user" is key. Any idea how to do this? You mention a module that hooks to page::editable. ProcessWire core already checks edit access on a per-template basis, would I need to address this when hooking into page::editable? Also, is this module publicly available? I would love to know how to go about this. Would you recommend creating a module, using the code Ryan wrote that you linked to, except altering the $page->name to be $page->createdUser? I haven't created modules yet so I'm wondering what the best way to go about this would be. Thanks!
  7. Hi all, I am creating a site that will have multiple users in ProcessWire and I want to be able to limit the ability to edit pages so users can only edit the pages that they themselves created. I noticed the default functionality allows you to assign roles yet anyone with this role appears to be able to edit whatever pages and templates have access to that role. Thank you for your help!
  8. Manfred, the slight shifting looks like it shows up because of the active state indicator. Good eye. Oops on forgetting alt tags for social media icons. I'll address these as well as other things you passed through the validator... I'm not sure what you're suggesting with the image on the biography page—I intended to have the text wrap around the image, not show up in columns, so as to avoid a large area of unused white space. As for your suggestion for using icons as background images, I chose to use images as elements instead of using them as background images because background images show up pixelated on retina displays (iPhone, iPad, retina MacBooks). I initially wanted to use icon fonts but found that the ones I chose were not compatible with older versions of IE. In an effort to keep up with the times and support retina display all the while still thinking about Accessibility and supporting older versions of IE, I opted for using images as elements instead of background images. If I went with your proposed solutions I'd have one too many fuzzy images for mobile users. No thanks! Thanks, I'm not sure how long it took. There was some iteration to get the colours to work with the photography but eventually these were the colours we went with.
  9. Hey everyone. I've created another screencast for a ProcessWire site I developed. Another you ask? My first one was of my own site, here. I developed this website for a Toronto-based opera singer from Norway. Nils needed a website where clients could go to learn about him, listen to his music, watch his videos, look at pictures and see where he'll be performing. The website features custom Responsive Design and a separate mobile image gallery for phones and devices. Read about the project and see some screenshots here, visit the website here, or view the . The admin theme used is a modified version of an older version of the Teflon admin theme.
  10. Since I asked, I'd love to be a part of making it. I'll contact you via private message.
  11. I was wondering if maybe the ProcessWire site could have a directory of contractors that work in ProcessWire kind of like how the ModX site has. I think it would be a great way to make connections and spread the word about ProcessWire.
  12. Thanks! I didn't realize ProcessWire could do that! That's great!
  13. Thanks Nik, using a break within the foreach loop worked (without the $firstUpcomingEvent line). I used this code: <?php $today = mktime(0,0,0,date("m"),date("d"),date("Y")); $events = $pages->find("template=calendar-event, sort=calendar_event"); foreach($events as $event) { $date = $event->getUnformatted('calendar_event'); if($date > $today) { echo $event->render(); break; } } ?> I did not try your other suggestion because I tried your first one and it worked, but it does look like a more efficient, less bloated way to accomplish the same task. Thanks for your help!
  14. I haven't tried your suggestion but wouldn't it get the first event based on sorting order (ascending)? I want to get that but using the condition that the date is no earlier than today, i.e. "get events sorted by date in ascending order, from that get the first event but only if the date hasn't past yet." I want to get the soonest upcoming event.
  15. Hi everyone, thanks in advance for your help. I have an Event set up using a datetime field. I'm trying to grab the earliest event that has not yet passed, e.g. soonest upcoming event. This is what I have so far. <?php $today = mktime(0,0,0,date("m"),date("d"),date("Y")); $events = $pages->find("template=calendar-event, sort=calendar_event"); foreach($events as $event) { $date = $event->getUnformatted('calendar_event'); if($date > $today) { echo $event->first()->render(); } } ?> The first() part is throwing an error but I put it here so you can see what I'm trying to do. What would be the best way to go about doing this? Thanks for your help.
  16. Thanks Ryan, both of these options are great. Thanks!
  17. How do I grab the admin user's email address? Thanks!
  18. I cleared my cache before posting to see if that was it (is that the same as a hard refresh? lol) Anyhow, I just checked now and the top right admin bar area works again. Yay!
  19. I'll attach a screenshot. The green arrow points to the area in question. There is a down arrow beside my username that looks like if I hover or click I should see more options. I feel like this was the functionality before. I was able to easily get to Content I Follow and my notifications I think from this area. There is no longer any functionality when clicking/hovering (can't remember which it was) in that area. Finding the Content I Follow is less intuitive now because it is not as easily accessible.
  20. Nice work, it looks great! One thing: I miss the way the admin section in the top right worked, with either clicking or hovering to see notifications and see content I follow, and all those other things up top. It's no longer as intuitive as it used to be to see the content I follow. I'm using Chrome. Actually, I've been clicking around and can't find the Content I Follow section anymore... Am I just missing something? Was also going to note the padding but you moved really fast with that one! It looks amazing! Nice work. I love the new site design.
×
×
  • Create New...