Jump to content

bwakad

Members
  • Posts

    450
  • Joined

  • Last visited

Everything posted by bwakad

  1. Well, changed the code to this which seems to work: $test = $pages->find("template=user"); foreach($test as $member) { if($member->image) echo "<img src='{$member->image->url}' />"; } But don't really see the difference... If I use this: $thumb = $member->image->size(100,100); inside the foreach(), is that good, or do I use it somehow outside?
  2. I have this code for now which seems to NOT work in the foreach, but when I use the direct path, it does??? I added the field named "image", type set to "image", only allow 1, and attached it to the user template. $test = $pages->find("template=user"); echo "<ul>"; foreach($test->image as $image) { $thumb = $image->width(300); echo "<li><img src='{$thumb->url}' width='$thumb->width' /></a></li>"; } echo "<li><img src='/site/assets/files/1013/cnn-logo.jpg'></li>"; echo "</ul>";
  3. I like the fresh colors! But I did not like the change when going to login/register. Missed the header and all ;-)
  4. While I was looking for an easy way to make users upload an avatar, they also should be able to make a thumb display the part they want. I understand there is a cropping module (backend), hence my search. Would be cool to see the code from this link: http://www.jqueryrain.com/?ckQjAttu in PW.
  5. I have been reading too much to find the answer... What I now am building is a way for users to upload their avatar. So an image field added to the user template. Question: In site/assets/files I see there are thumbs created. Were are these sizes set. Question: If I loop through my user template pages, ususally one get to the image like $page->image (single). But how do I get to the thumb?
  6. Thanks Martijn. Seems like a reasonable solution.
  7. A million hits, and not much good results. Someone can move it to off-topic if they want to. I simply asked if one has another solution (using) PW + foundation = php + css ps. sticky footer is NOT a bottom footer perse.
  8. I am curious to see what technique you all use to have a bottom always, or near the bottom. I have tried several scripts, css hacks, and none seems to have the effect I am looking for: to display footer at bottom, under content, to display foorter at bottom, if no content. Since I am using foundation and even the developers have trouble implementing this (forum zurb), I now use this which does not give me any trouble at all... : <body> <nav> my topbar navigation </nav> <div class="wrapper"> my content </div> <!-- wrapper ends --> <footer> footer content here </footer> </body> // I use this css so that my wrapper always is at least 80% // of <body> minus the total height of (<nav> + <footer>) : .wrapper { margin: 5% 0%; /* this is outside the element */ min-height: 70%; /* this is inside the element */ }
  9. Well, since there is not really an easy way of doing this from admin side, I made special pages not visible. I then use this code in my functions.inc : if(!$user->isLoggedin()) { $menu = "string-with-markup-and-my-links-for-guests"; // login or register } else { $menu = "string-with-markup-and-my-links-for-users"; // edit-profile or change-pass } In head.inc I use this in the section part of the top-bar: echo $menu; Special pages use my template: credentials.php. The page "Credentials" is not visible but still accesible. The template has a switch() to determine what get's included. Because of the switch() I can set a default case if no other one get's included. And inside this default, I simply give some instructions and information about other stuff. So much fun to play with PW!
  10. @zwergo I really have no clue about this since, as you also found out, no one does. I do however use <input type="password"/> and use in PW pass field the pattern [A-Za-z0-9](.{6,16}). So I am thinking it would be verry hard to obsuce code in that field... but you never know...
  11. Martijn, you are really good. I see that was quite more then a normal login. It works! Since I am using this in a modal (foundation) and this modal closes when submit is clicked. is it possible (in case of errors) to redirect and echo these errors? ps. I have corrected some typos: missing ; and } at some places: <?php $email = $sanitizer->email($input->post->email); $password = $input->post->password; $amount = $pages->count("template=user, email=$email, include=all"); // if we have only one user with this email address, give the username back if ($amount === 1) { $username = $users->get("email=$email, include=all")->name; try { $u = $session->login($username, $password); if($u && $u->id){ $session->redirect("/login"); } else { $errors = "Login failed."; } } catch(WireException $e){ // throttle login $errors = $e->getMessage(); // get the error message $session->redirect("error-page"); ----------------- on that page echo $errors } } elseif (!$amount) { // no account with this email address } elseif (!$email) { $errors = "Not a valid emailaddress"; } else { // multiple user accounts $errors = "Login with username instead."; } ?>
  12. ok. Thanks for the haeds up... Now, when I use my login form (changed input to email), it does not let me login. <input type='email' name='email' placeholder='Email Adress' required/> $email = $sanitizer->email($input->post->email); $pass = $input->post->password; // need to sanitize this too? if($session->login($email, $pass)) { // login successful - change redirection later - edit - I did found this code (ryan), and it seems I need to GET the email from registered users first. But it did not work. Thinking I need to say $users = somethinghere : if($input->post->login && $input->post->email && $input->post->pass) { $email = $sanitizer->email($input->post->email); $emailUser = $users->get("email=$email"); if($emailUser->id) { $user = $session->login($emailUser->name, $input->post->pass); if($user) { echo "Login success!"; } else { echo "Login failed!"; } } else { echo "Unrecognized email address"; } }
  13. You guys always give great suggestions to think about! Pete: I was actually thinking about John Doe's. But to come back on this, I like to use email/pass for login since it is more easy to remember for people. So I will change my login accordingly. Martijn: Upon the registration I create a page for this Member, and will use the username (as you say this is a unique field). However I do not know if PW checks the uniques on a front-end register by default. If not, what to do? For the other part, I will add general fields to a member template in PW, so a user logged in can edit this field contents without by mistake change login credentials.
  14. In user template of PW I see Email, Pass and Roles. I could not see where the Username comes from... probably the title? I would like to know, how people look at a secure login. Let's say, email/pass vs phone/pass vs username/pass. What would be the most secure? If I know the email, or phone or username, it would all mean the same: guess the pass... Do I need to see login vs user template (with user extended fields) separatly? : For example, extended fields such as "about", "interests", etc. are all fields for a profile page / member page to display. I can add them to usertemplate, and call them on another template without trouble. Why would I need to add those fields on a separate template?
  15. Thanks Soma, but that is actually code which I can't use to separate menu items. Example: About link - visible to guests and members Login link - only visible for guests Register link - only visible for guests Profile - only visible for member Edit profile - only visible for member etc. The function above is cool, but it just takes all pages (links) and displays them.
  16. Okay, I agree with you that 2.4 is valid for 2.4.xxx but then you could just say PW version 2. Somehow I feel, like people do with copyright year, just make it automatic. Anyway, it IS 2.4.11 and looks great by the way! edit - and YES, I did see the link to github, but from the topic I mentioned, I was looking for 2.4.6 !!! So it was confusing.
  17. I am not so used to the github. But in this topic I came across: https://processwire.com/talk/topic/6822-module-dynamic-roles-for-pw-246/ it states, Make sure you are running ProcessWire 2.4.6 (dev branch) or newer. Download from GitHub (we will add this module to the Modules directory later). So I was searching for the dev branch (which is certainly not easy to find), but I guess it is this link: https://github.com/ryancramerdesign/ProcessWire/tree/dev But the readme file talks about PW 2.4 I would not mind using a dev branch while developing, but I do mind things could be presented a little more clear. For example, a download link to the dev branch from processwire.com was not easy to find. And as I said above, once found, a readme file for pw 2.4 while it resides in the dev branch (apparantly) 2.4.6 makes to me no sence. Just a thought.
  18. I recently started with the bootstrap 3 profile. In functions file there is this code (below) which is of course cool for displaying the menu. But I want to hide the login and register link to display in it, if they are as a member logged in. In the Access tab of the login template, I have tried to un-check the "member" user roles in the template. But for what ever reason, I can't uncheck it unless I uncheck the "guest" role... which result in only superuser to access it. If I uncheck both, and only check the "member", then guest is also checked automatically. Which result in everyone can access it. Question, how to do this??? <?php /* Navigation for ProcessWire using the Bootstrap 2.2.2 markup This menu was written by Soma based on work by NetCarver and a bit thrown in by Joss Navigation Bootstrap 3 update by Damienov, with multi level dropdown support fix Taken from */ function renderChildrenOf($pa, $output = '', $level = 0) { $output = ''; $level++; foreach ($pa as $child) { $atoggle = ''; $class = ''; if ($child->numChildren && count($child->parents) == 1) { $class .= 'dropdown'; $atoggle .= ' class="dropdown-toggle" data-toggle="dropdown"'; } else if ($child->numChildren && count($child->parents) > 1 ) { $class .= 'dropdown-submenu'; $atoggle .= ' class="dropdown-toggle"'; } else if ($child->numChildren && $child->id != 1) { $class .= 'dropdown-menu'; } // Makes the current page and it's top level parent add an active class $class .= ($child === wire("page") || $child === wire("page")->rootParent) ? " active" : ''; $class = strlen($class) ? " class='" . trim($class) . "'" : ''; if ($child->numChildren && count($child->parents) == 1) { // Add Caret if have children $output .= "<li$class><a href='$child->url'$atoggle>$child->title <b class='caret'></b></a>"; } else if ($child->numChildren && count($child->parents) > 1) { $output .= "<li$class><a tabindex='-1' href='$child->url'$atoggle>$child->title</a>"; } else { $output .= "<li$class><a href='$child->url'$atoggle>$child->title</a>"; } // If this child is itself a parent and not the root page, then render it's children in their own menu too... if ($child->numChildren && $child->id != 1) { $output .= renderChildrenOf($child->children, $output, $level); } $output .= '</li>'; } $outerclass = ($level == 1) ? "nav navbar-nav" : 'dropdown-menu'; return "<ul class='$outerclass'>$output</ul>"; }
  19. bwakad

    images

    Yes for 2 this would work. But I am unknown as to how to add this to a frontend upload and let the owner of the image crop it.
  20. bwakad

    images

    Well, the title does not say much. But I need to have profile images: A maximum of 4 images per profile, on browsing, only a thumb. but I need some help on this: 1. Any picture, portrait or landscape which is uploaded through frontend, need to be visible on the site in the same size, so that each profile has the same sized image. I know I can set a determined height and width for displaying on frontend, or maybe I need cropping or clipping for that, but how? 2. Any picture also need to get a thumb. Used in browsing. I see some modules for cropping, but how to accomplish the cropping in the frontend. Example, you see a picture you uploaded, and then you can move a square over the picture and say, yes, this is the part I want... 3. If I need the same module for both (1 and 2) it would not work I guess.
  21. @pwired, I'm just trying to explore how far PW can take me... @pete, thanks for explaining that. As you see I am still learning stuff...
  22. As far as I know Emma and Tim would work. lol But a page field is actually ONE (1) field with a value, whereas for this I would need more fields for every user, as there can be more friends... Or maybe the module Ryan created, not sure what it is called anymore, but it had to do with adding related things to a page.... I believe the video I had seen while back involved adding locations and villas or something.
  23. Except the 4 and 5. If for example (4) the comments module was able to say, only visible to... it would be good. But still 5 is to my knowledge difficult.
  24. Holiday is over and trying to read through the forum but there is so much. lol. I was talking to a friend about PW and he was curious if PW is capable for a dating site. The basics (1 and 2) what will be needed are easy: 1. Registration, User (profile) page, Login, Edit profile. Profile page has sections were some will be visible to other members if they have the right role. 2. Browse page with filter I was thinking of deviding this page for example in more parts. Each part is for a certain group. Each group has members according to profile information. Maybe it will be what they look for, or location or something else. Fitlers are then used for more specifics. 3. Connect with friends. Should be something like a checkmark next to thumbs, requesting to be friends. It needs to be accepted in order to appear in a friends list. On both user pages it needs to check if it is true. 4. Send a Message. Usually this is done without being friends. So maybe the ability to add text on that user page in a box. Which should only be visible for the receiving user. HasRole! That user can also delete / empty the text. Problem here is, how to make it so more people can do this? Or is there some kind of internal mail system to use? 5. PM messages This has to be only if two are friends. Not even sure if this is possible in PW. So far my thoughts. I'd be glad if I get some feedback.
  25. oh sorry for the misunderstanding. I was referring to the DB....
×
×
  • Create New...