pure rip source
a function like this is good
$userSys->getInfo( Column, Where, Return );
eg:
Receive the username for user ID 1
$userSys->getInfo( 'UserID', 1, 'Username' );
(I'll keep in your camel case)

pure rip source
a function like this is good
$userSys->getInfo( Column, Where, Return );
eg:
Receive the username for user ID 1
$userSys->getInfo( 'UserID', 1, 'Username' );
(I'll keep in your camel case)
Last edited by Protege; 21-05-2009 at 10:16 PM.
Hi, names James. I am a web developer.
Hmm, i originally though having those two as separate functions would make working with it a little easier to novice users, although looking back you may have a point. Currenlty the method call for the info your after would be
$userSys->currentUser->getAttribute('uid');
or
$userSys->currentUser->getAttribute('name');
pure rip source??
Hmm, i think with that your moving more towards it simply being a layer in front of a database, which would really only service to limit what a user could normally do with SQL without really making it any easier.
Currently all database interaction is completely abstracted, the system in the demo for example is currently running on the flat file engine![]()
Care to put what you have of the class on pastie.org ? No particular reason, just intrigued into the development.
Update
The Magic user system framework is going ahead as planned, I've created a project on google code to track the progress, so if your interested in this project feel free to download the current version off SVN.
http://code.google.com/p/magic-usersystem-framework/
If any of you want to get involved with this project the help would be welcomed.
Also if any designers amongst you are willing to do a little spec work it, it would be great to get a nice looking default template for the demo. Aside from simply contributing, designing a template would also give you the option to have a template by link back to your own website placed in every copy of Magic replaced
Changelog since last night;
] User class re abstracted, all modifications to a users profile are now handled through the user object.
] Register function completed
] Login function completed
] update profile function completed
] Fields to be used in profile can be specified in config. The profiles can be customised totally to your own likeing.
] Default profile layout updated.
- uid,name,email,dob,register_date
] Additional fields specified in config updated
- Usertitle,avatar,description,signature,postcount
] Validator class added
] Exception handler added
] None editable profile fields created
Last edited by Mentor; 23-05-2009 at 04:18 PM.
If you really wanted to stay true to OOP then you should make it so that you can get a object for the user then have functions in that user class like getEmail, getTitle, etc.
It is OOP? though somewhat more abstracted than your examples.
The only code outside objects at all inside magic itself is the autoloader and config import (plus an installer redirect)PHP Code:<?php
include('../Magic/magic.php');
$userSys = new UserSystem();
//get user 2 (me) (all hardcoded for example)
$userObject = $userSys->getUserInfo(2);//2 being my id
echo 'Accounts name is'.$userObject->getAttribute('name');
echo 'Accounts dob is'.$userObject->getAttribute('dob');
echo 'Accounts avatar is'.$userObject->getAttribute('avatar');
//equally if u were logged in you could get your user object via
$me= $userSys->getCurrentUser();//will be guest if not logged in
$myarray= $me->getAttributeArray();//return attributes as array
//some things are accessed via direct accessors though.
$permObj = $me->getPermissions()
//or if we wanted to we can get common options as an array via
$common = $userSys->getCurrentUserCommon();
?>
Last edited by Mentor; 23-05-2009 at 04:34 PM.
I couldn't see a function to get the user id from the username so perhaps:
getUID($UName) To get the user id
Also a plugs system would be useful
Last edited by Chippiewill; 23-05-2009 at 07:11 PM.
Chippiewill.
The systems a little bit early on to be thinking about plugins, although it would be a great thing to have in the long run.
Getting a user from there username is quite inefficient on the flat file db, so its reasonably well hidden. Currently you would need to make a call to the UserSystem method with the second parameter set as 'name'
If you think it'd be useful i could easily add a wrapper object for example getUserByName('name'); or something.PHP Code:$name = 'ted';
$userObj = $usrSys->getUserInfo($name, 'name');
@Jaysun: thanks, any inputs good :p
A getUserByName() functions seems reasonably sensible - the key with these framework probjects, in my view, is to make it is as easy as possible to integrate into any site in any situation.The systems a little bit early on to be thinking about plugins, although it would be a great thing to have in the long run.
Getting a user from there username is quite inefficient on the flat file db, so its reasonably well hidden. Currently you would need to make a call to the UserSystem method with the second parameter set as 'name'
If you think it'd be useful i could easily add a wrapper object for example getUserByName('name'); or something.PHP Code:$name = 'ted';
$userObj = $usrSys->getUserInfo($name, 'name');
@Jaysun: thanks, any inputs good :p
It seems that really the best way to do that is to add as many functions as possible for accessing data, even if they do bloat the framework - the tiny difference in loading time is probably worth it...
i used to be NintendoNews. visit my blog or add me on twitter.
need help with vista? i am a microsoft certified technology specialist in configuring windows vista and connected home integrator.. pm me for help!
"I am the way, the truth, and the life. No one comes to the Father except through me"
John 14:6 (NIV)
Want to hide these adverts? Register an account for free!