Forums | Mahara Community

Developers /
Making Emails Valid Upon Login


anonymous profile picture
Account deleted
Posts: 27

20 August 2009, 0:46

Not wanting to drive anyone away from Mahara, but have you looked at BuddyPress/WordPress-MU for your public, blog driven social network? I run it at work and it sounds like it would be ideal for you and not require the hacking you're doing with Mahara.

http://buddypress.org
anonymous profile picture
Account deleted
Posts: 117

21 August 2009, 1:07

Blogs are only a very small part of our social network (although public blogs do drive traffic) and even with BuddyPress I'd have to hack the heck out of it, a LOT more than with Mahara.

I will say that that BuddyPress does look very good visually.  You can usually count on finding fantastic themes for WordPress. Looking at WordPress themes is a great way to get inspiration for your Mahara theme.

Thanks for the suggestion, though.

anonymous profile picture
Account deleted
Posts: 27

19 August 2009, 6:09

Oh, I see. When logged in, the changes to .htaccess alone are enough for http://portfolios.lincoln.ac.uk/josswinn to work. But for people who are not logged in, I see it's a dead link without your changes to view.php
anonymous profile picture
Account deleted
Posts: 27

19 August 2009, 6:16

I am wrong again. The .htaccess rules direct anyone who is logged in to their own profile, regardless of the username appended.
anonymous profile picture
Account deleted
Posts: 117

19 August 2009, 6:53

Actually, the line:

if ($userid == 0 || empty($userid)) {

is redundant, since 0 is empty.  So it really should read:

if (empty($userid)) {

I did have to make one change to lib/web.php (although it's not 100% necessary).  param_integer doesn't like 0 as a default.  So, I changed that. In lib/web.php, within the function param_integer code, I changed:

    if ($defaultused) {
        return $value;
    }

to:

    if (isset($defaultused)) {
        return $value;
    }

It's not 100% necessary, but it helps avoid "Mahara: Invalid Parameter" error messages. I'm trying to remove any case where such errors may occur, because users usually have no idea what the messages mean and will think the site has bugs, when in fact, it's usually something they did.

anonymous profile picture
Account deleted
Posts: 1643

19 August 2009, 20:05

By the way, you should never ever see those errors, unless the user mistypes something in the URL bar perhaps. That's why they're so blunt, as it were. Normally, only a coder would see them.

The param_integer function should probably accept 0 as a default, it's an integer after all. 

anonymous profile picture
Account deleted
Posts: 5

07 September 2009, 9:56

Hi All,

We used the same php but had to do a slightly different htaccess.

RewriteEngine On
RewriteCond %{QUERY_STRING} login
RewriteRule ^/?([a-zA-Z0-9_-]+)$ user/view.php?username=$1&login
RewriteRule ^/?([a-zA-Z0-9_-]+)$ user/view.php?username=$1 [L]

Which works for people not logged in, seeing public profiles, and so on.

 G

anonymous profile picture
Account deleted
Posts: 10

11 February 2010, 18:39

I have implemented the changes as noted, trying both .htaccess configurations and still cannot get the login to recognize the email as the username. Have there been any recent updates to this? My client I am building this for really wants to use emails as the username to login.
anonymous profile picture
Account deleted
Posts: 10

12 February 2010, 19:41

Using email for username.

I just changed in the registration.php file where it defines the username from firstname-lastname to email. (line 108 in my editor)

$user->email            = $registration->email;

 Now users can login using their email.

anonymous profile picture
Account deleted
Posts: 112

13 February 2010, 21:09

I didn't have to do anything mentioned in this post or registration. I just changed a few lines in the auth.php. I didn't have to change the .htaccess file either. It doesn't cause any errors either so, it must be a few ways to do this. Just a note on this.