Jump to content

Harmster

Members
  • Posts

    137
  • Joined

  • Last visited

Everything posted by Harmster

  1. Hey I'm trying to log a user in with a cookie. cookie stuff works fine as far as I can tell but logging the user in without a password gives me a bucket of problems. $u = $users->get($user_id); set_remember_me($u->name, $wire); echo "<br />Username retrieved from: ".$u->name; $users->setCurrentUser($u); $session->_user_id = $u->id; echo "<br />After setting current user: ".$user->name $remember->trash(); It echoes the following: Username retrieved from: Harmster After setting current user: guest What am i doing wrong, or what is the correct way to do this?
  2. Hey, I started on my tag system with repeaters... It works, but I get a bunch of errors... And I've got no idea what the problem is. These are errors in the session->error and I've put them in a JQuery plugin called toastr. It looks like this: What can I do to change this? Or is this only in debug mode and it doesn't really matter?
  3. The main reason for people not switching to Linux based distros is still that they are not confortable on it. Even I as a developer find it hard to get into Linux just because I grew up using Windows 98, xp, 7 and now 8 and I'm not used to the terminal, which linux distro's heavily rely on. And as for the most famous desktop distro for linux, Ubuntu... The Unity UI is just horrid, it feels so cheap... And + the fact that most of the business software wont run on linux distros, it still is a poor gaming platform (thanks to steam its getting better) it's just not as easy as windows is... And the fact that XP support ends.... Boy.. that aint a suprise...
  4. Hey, [NOTE] I have no idea if there's a better way, already a module that does the same or slightly different I just made this and I love to share this in case someone needs it! Onto the intro: every time I use the PHP Mail() function I find myself frustrated in the way I receive these e-mails so I found a library PHPMailer that lets you use SMTP fairly simple and because I love processwire I made this into a module Get it here: Github Basicly you use it almost the same as the PHP mail function, but this time you setup your SMTP (I've tested it with gmail) and call a method called send() on $phpmailer. Here's settings for gmail: - security: tls - port: 587 here's a example of usage: $subject = 'test'; $message = "Test message"; $r = $phpmailer->send($subject, $message, array($user->email => $user->first_name. " " .$user->last_name)); Arguments: - Subject: string - Message: string(html or whatever) - Recipient: array(email:string => name:string) - Attachment: array(path:string) !OPTIONAL It returns a 1 on success and an error string on failure. Use it, or don't. See you all around
  5. You'll also get errors when you use $config->paths->root in images etc (500 i believe) but if you use $config->urls->root you'll get away with it. I believe there's a different way of approaching things. Not sure why, never really looked into it but if someone is able and willing to explain that would be nice!
  6. Hey, The title may be misleading, I just lack the correct definition. I have 2 templates, Tags and Images. The tags template has 2 fields, a PageField Image with a link to an image and a TextField Title that functions as a tagname. Now I am building a search function and I am trying to achieve a 'join' like behavior where I can search on tags (Title) but in the Tags templates but also on Title in the Image templates and join them in a PageArray together (Only the Image templates, just retrieve the Image template with the Tag template's field Image). How do I achieve this with Processwire Selectors? In MySQL I think I would do something like this: SELECT tag as t, image as i WHERE t.tag=$tag OR i.title=$title JOIN tag ON t.image=i.id //This is far from correct but only used to give an indication of what I am trying to achieve..
  7. But thats for HTTP requests, I dont think PHP even uses that if you include a file? Since its called UrlRewrite. I'll try it this afternoon or tomorrow with the 2.4 on a webserver (If i can get one in time) I doubt that its inpossible top include files since if you just include a php file on a template it works too. EDIT: Did you make a page for Login? ill try and upload a complete 2.4 version with the module installed so that you can see what we did different. Give me half an hour EDIT2: I am a bit confused about the behavior of the HybridAuth... It takes me a bit longer EDIT3: I've encountered the same problem. I think I need to find a fodler that doesnt have that restriction but I cant seem to find one...
  8. Oh, never knew that. Ive developed a few modules that always let me include PHP files, I am not sure whether or not that is a HTTP call, since I only include it. - Localhost - 2.3 - http://localhost/index Ive registered http://localhost:80 on facebook both as app and as website. As for now I dont have a webhost available (....) but it shouldn't make any difference.. What are you trying to do? I've got it working by having the module folder (called ProcessHybridAuth) in the /site/modules/ folder then install it via the processwire admin and the put the code I wrote down earlier on a template called index (The home page / ) and then accesing it by localhost/project/
  9. if you assign level1 = 1 and then try to print an array i doubt it will work since you assigned an int or even a bool (Since 1 could also be true) and you try to print an array If you wish to print it should work with $level1 = array(1); That and i dont really understand your question, try and formulate your question instead of just stating a line and another line.
  10. No, never seen that issue to be honest. I just placed all the files in /site/modules/ and I installed it since the module will include the Auth and then create the object in the module itself. I did use it on a template though.
  11. Okay (Sorry for double posting, but I think this is worthy of having its own post) https://github.com/hawiak/hybridauthforprocesswire I've started witht he devleopment, I haven't tested anything because I am running this on a local machine, as for now the module has a bunch of inputfields and generates an object hybridauth, this is then bound to a fuel in the init() method and hoepfully you will be able to use it in your project as $hybridauth. Are there people that could help me with this? Or atleast test it? EDIT: It does work for facebook: Ive put this on my index(It throws a redirect loop but thats because its on my index_ if (isset($_REQUEST['hauth_start'])){ Hybrid_Endpoint::process(); } $adapter = $hybridauth->authenticate("Facebook"); $user_profile = $adapter->getUserProfile(); print_r($user_profile);
  12. Alright, sounds really good, I'll take a look today I have a few days spare and I think the everyone here could find this enjoyable. I'll let you know
  13. Very interesting Plugin, though, what do you expect from a plugin in processwire? It seems like its almost ready to use as it is?
  14. Could you also provide some code, Its hard to reproduce the error without it.
  15. My idea (And don't take my words for it) is: The session needs to be re initialized and the credentials used must be set in order to generate other dependancies like the $user object. I took a look in the method in the $session class and you can see that a cookie is generated and some other things are set. Code for reference: https://github.com/ryancramerdesign/ProcessWire/blob/03387f8283d518e9cc405eff8f05cd6a5bf77c4c/wire/core/Session.php#L257 public function ___login($name, $pass) { if(!$this->allowLogin($name)) return null; $name = $this->fuel('sanitizer')->username($name); $user = $this->fuel('users')->get("name=$name"); if($user->id && $this->authenticate($user, $pass)) { $this->trackChange('login'); session_regenerate_id(true); $this->set('_user_id', $user->id); $this->set('_user_ts', time()); if($this->config->sessionChallenge) { // create new challenge $challenge = md5(mt_rand() . $this->get('_user_id') . microtime()); $this->set('_user_challenge', $challenge); // set challenge cookie to last 30 days (should be longer than any session would feasibly last) setcookie(session_name() . '_challenge', $challenge, time()+60*60*24*30, '/', null, false, true); } if($this->config->sessionFingerprint) { // remember a fingerprint that tracks the user's IP and user agent $this->set('_user_fingerprint', $this->getIP(true) . $_SERVER['HTTP_USER_AGENT']); } $this->setFuel('user', $user); $this->get('CSRF')->resetToken(); return $user; } return null; }
  16. Yeah, thats probably a good practise, though I just started to implement this, I think I want to implement infinite scrolling too
  17. Thanks for all your tips, for anyone also looking for a solution int he future ill describe what I did: I created a wrapper called tags and a new template tag. In the template I made 2 fields, title and page (A single page array) Then I created a searchbox and the following code: if($input->post->submit){ //form has been submitted; $tag = str_replace(',','|', $input->post->tag_search); $results = $pages->find("template=tag, tag=$tag"); } This is for searching on multiple tags.. This works like a charm and it is very, very flexible! Thanks everyone for your time & help!
  18. Hey, I am, for my final project on school, making a picture database. The client wants to search in the database and I figured I implement a tag system. What is the best way to implement a tag system? A repeater field, a string field or an asm select ish input field? Thanks
  19. I've got the same case I love the design although the front ports broke somehow... Also a logitech fan I have a Logitech G510 and a Logitech G9x mouse. They're for gaming mainly but I love the macro's on the keyboard.
  20. Sure a Lot of mac people around here.... I am using a custom build pc with windows 8 (3.4ghz quadcore, 8gb ram, 2gb amd card) and 2x 24" inch dell displays. I also have a lenovo y500 and a surface pro lovely devices
  21. Currently I am facing an issue Twig related. The issue: When I tried to use the CSRF methods from PW in a twig template I encountered an error. I've tried hundrerds of different things and on Stackoverflow I didn't find the solution either. http://stackoverflow.com/questions/20602840/cant-get-twig-to-work-with-method-from-object If anyone knows something more I'll glad to hear from you.
  22. Sorry I was busy with my internship. So I haven't replied for a while. What do you mean, how I render everything? I added a hook and then used methods from the module to echo the result from those methods. I'll try and update this more but I am very busy finding a job atm (anyone in Zwolle area? please? )
  23. Also, from the API: $page->viewable()
×
×
  • Create New...