-
Posts
1,147 -
Joined
-
Last visited
-
Days Won
4
Everything posted by onjegolders
-
Following on from my register template yesterday, I have modified it slightly to act as an "edit profile" template. It mostly works but I'm having problems with when the password gets updated. I originally thought this may be as when I'm giving the user a new pass and saving, they would no longer be logged-in as their password would be incorrect. Is that so? Here is a gist so as to not clutter up the thread! (You see I do listen, Soma ) https://gist.github.com/anonymous/0ecf562bb0f3fe923614
-
That would be great Joss, I think your example of outputting a little gallery or something would be great.
-
Nice work!
-
Nico, this is a module I've been looking at for a while now, I'd love to be able to use WP-like shortcodes whereby a user could put in [gallery] or something, but like Joss, I'm a bit unsure about where to put the code and how the end user goes about adding one?
-
Possible to register and login simultaneously
onjegolders replied to onjegolders's topic in General Support
Hmm just moved to live server and the emails aren't getting sent Anything glaringly obvious in the code? Don't know if the fact I'm using Gmail alters anything? I'm happy to just use mail() but never seems to work for me. OK, I seem to have it, it was a slightly different bit of code and now I have it working under SMTP. -
Possible to register and login simultaneously
onjegolders replied to onjegolders's topic in General Support
Brilliant, thanks so much for that Wanze! Works great now, thanks also Luis! -
Possible to register and login simultaneously
onjegolders replied to onjegolders's topic in General Support
Thanks for the tips Wanze, will have a look at them! Quite simply, the user is not getting logged in. The user is getting created fine but the logging them in part and the redirecting is not taking place. I'm not sure whether I have the login code in the wrong place or whether something else is preventing it from working? -
Have set up a front-end registration form and it all seems fine but rather than giving them a link to "Click here to login!", I'd like to log them in automatically. I was thinking that as the login takes place after the new user has been saved that it ought to work but it doesn"t seem to be working at the moment. Is this even achievable without a page reload? Here is my code currently: <?php include("./header.inc"); $headings = " <div id='register'> <div class='row'> <div class='twelve columns'> <h3>Register with us</h3>"; $form="<form action='./' id='registration' method='post'> <div class='row'> <div class='four columns'> <label for='username'>Username</label> <p class='help'>Please ensure your username contains no spaces</p> <input type='text' name='username' value='{$input->post->username}'> <label for='first_name'>First name</label> <input type='text' name='first_name' value='{$input->post->first_name}'> <label for='last_name'>Last name</label> <input type='text' name='last_name' value='{$input->post->last_name}'> <label for='email'>Email address</label> <input type='text' name='email' value='{$input->post->email}'> </div> <!-- /.four columns --> <div class='four columns'> <label for='company_name'>Company name</label> <input type='text' name='company_name' value='{$input->post->company_name}'> <label for='company_url'>Company URL</label> <input type='text' name='company_url' value='{$input->post->company_url}'> <label for='company_phone'>Company phone</label> <input type='text' name='company_phone' value='{$input->post->company_phone}'> </div> <!-- /.four columns --> <div class='four columns'> <label for='pass'>Password</label> <p class='help'>Please ensure your password is at least 6 characters long and contains at least one digit and one letter</p> <input type='password' name='pass' value='{$input->post->pass}'> <label for='pass_confirm'>Confirm password</label> <input type='password' name='pass_confirm' value='{$input->post->pass_confirm}'> </div> <!-- /.four columns --> </div> <!-- /.row --> <input class='button success small' type='submit' name='submit_registration' id='submit'> </form>"; $message = "Please fill in the form below if you would like to register in order to receive exclusive access to our brochures and latest information."; $usernames = array(); foreach ($users as $u) { $usernames[] = $u->name; } if($input->post->submit_registration) { if (empty($input->post->username) || empty($input->post->email) || empty($input->post->pass)) { $message = "Please fill out all fields marked with a *"; echo $headings; echo "<h5 class='error'>$message</h5>"; echo $form; } elseif (in_array($input->post->username, $usernames)) { $message = "Sorry, that username is already taken, please choose another."; echo $headings; echo "<h5 class='error'>$message</h5>"; echo $form; } elseif (filter_var($input->post->email, FILTER_VALIDATE_EMAIL) === FALSE) { $message = "Please include a valid email address"; echo $headings; echo "<h5 class='error'>$message</h5>"; echo $form; } elseif (!preg_match("/[0-9]/", $input->post->pass) || strlen($input->post->pass) < 6) { $message = "Please ensure your password has at least one digit and is at least 6 characters long"; echo $headings; echo "<h5 class='error'>$message</h5>"; echo $form; } elseif($input->post->pass !== $input->post->pass_confirm) { $message = "Please ensure that your passwords match"; echo $headings; echo "<h5 class='error'>$message</h5>"; echo $form; } else { echo $headings; $message = "Congratulations! You have successfully registered and have been logged in"; echo "<h5 class='success'>$message</h5>"; $u = new User(); $u->of(false); $u->name = $sanitizer->username($input->post->username); $u->first_name = $sanitizer->text($input->post->first_name); $u->last_name = $sanitizer->text($input->post->last_name); $u->company_name = $sanitizer->text($input->post->company_name); $u->company_url = $sanitizer->url($input->post->company_url); $u->company_phone = $sanitizer->text($input->post->company_phone); $u->email = $sanitizer->email($input->post->email); $u->pass = $sanitizer->text($input->post->pass); $u->addRole('registered'); $u->save(); $u->of(true); require_once("./scripts/PHPMailer/class.phpmailer.php"); $form_contents = array( 'username' => $sanitizer->username($page->username), 'First name' => $sanitizer->text($input->post->first_name), 'Last name' => $sanitizer->text($input->post->last_name), 'Company name' => $sanitizer->text($input->post->company_name), 'Company URL' => $sanitizer->url($input->post->company_url), 'email' => $sanitizer->email($input->post->email), 'Phone Number' => $sanitizer->text($input->post->company_phone), ); $to_name = "My company"; $to = "me@me.com"; $subject = "New registered user"; $form_message = ""; foreach ($form_contents as $key => $value) { $form_message .= "$key: $value\n"; } $from = "$form_contents[email]"; $from_name = "$form_contents[username]"; $mail = new PHPMailer(); $mail->CharSet = 'UTF-8'; $mail->FromName = "$from_name"; $mail->From = "$from"; $mail->AddAddress ($to, $to_name); $mail->Subject = "$subject"; $mail->Body = "$form_message"; $mail->Send(); $name = $u->name; $pass = $u->pass; if ($session->login($name, $pass)) { $session->redirect("../"); } } } elseif ($user->isLoggedin()) { echo $headings; echo "<h5>No need to register " . $user->get('first_name|name') . ", you are already are! <a href='{$config->urls->root}'>Click here</a> if you would like to return to the homepage.</h5>"; } else { echo $headings; echo "<h5>$message</h5>"; echo $form; } ?> </div> <!-- /.twelve columns --> </div> <!-- /.row --> </div> <!-- /#register --> <?php ?> <?php include("./footer.inc"); Thanks.
-
Thanks Soma, I'm just using an in_array check for my registration form template to see that their chosen username doesn't already exist.
-
Thanks both of you, they both work great!
-
Yes thanks, that outputs the names but I can't seem to be able to store them in an array?
-
Facebook and Amazon have a lot in common when it comes to aesthetics. Both are pretty ugly, but they both must be doing something right!
-
Aha! Yes I did, thanks but do you know how to output the names rather than the whole object? it keeps coming up empty when I try ->title or ->name? This is in a template.
-
Thanks Arjen. But I seem to be getting "Error call on a non-object" whenever I try to access $users?
-
As a check for my form, I'm looking to do an 'in_array' check for the username input but I can't seem to output all usernames into an array. I'm sure I'm missing something really stupid but can't seem to get the desired result!
-
You're right Soma, it's very useful but I still think there's call for a an admin-wide way of performing batch operations. For all that PW feels light years ahead of other CMS I find the "3 steps for one action" thing a bit limiting.
-
I think one thing which would really add to the ease of setting up and managing sites within PW would be added batch functionality. One small example, I had added a dozen or so new users as a testing process and I wanted to delete them. To do so I had to click each one individually, then click delete, then check the box to confirm and repeat eleven times. This is no great hardship but I believe it's a good example of the occasional bottleneck in the backend. Of course this can be done in the API and Ryan's even helped me to create my own batch delete form in the past but it just feels odd having to do this through one of my templates. I should also point out that Soma has done some great work on a module to add some batch functions but I think if pages had checkboxes and delete/edit functions on them it would be a great addition!
-
Recommend a Code editor with FTP, for working on template files
onjegolders replied to Crssp's topic in Getting Started
On a mac I have Transmit (Panic) and I can keep my local MAMP sites and my remote ones in sync and push changes directly to the remote version. Works very nicely. -
You're old-school Joss. These young'uns don't know they're born!
-
Hey buddy, not really had a chance to look at it in a while, will definitely check back though when I get a few minutes!
-
I really like the artofdining site. Great work but I have the same issue as Diogo and Binrd.
-
Agree with you on all that Joss. I must be the web guy who is the least involved with Twitter and to a lesser extent FB. I just find it such a huge time waster. Although obviously it's important for many clients.
-
You see, I'm a southerner to the northerners and a northerner to the southerners!
-
You can still access the "old" one too, there should be an option when you first land on the site.
-
If anyone's interested and I was mainly for the hype surrounding the new design, the new mySpace is now out of beta. http://www.myspace.com Definitely worth a look for the design alone!