Is any way to add a new field type to Profile module. I would like to add image upload field, similar to that one in Pagesetter. That users can easily add their own photo.
--
rgfdgafgaf
Watch
GitHub Core
Show your support for Zikula! Sign up at Github account and watch the Core project!
GitHub Modules
- michiel responded to »password problem« 10:01 AM
- mazdev responded to »Hide "Register new account" and change template to 3 col« 07:50 AM
- mesteele101 created topic »Zikula 1.3.3 - Site Search 1.5.2 - Unable to turn off plug-ins« 07:48 AM
- mesteele101 responded to »ERR (3): E_USER_ERROR: Smarty error: [in pagesvar:pagesitem2en line XXX]…« 25. May
- mazdev responded to »Pages 2.5.0 and updating - Page not found« 25. May
- mesteele101 responded to »Zikula 1.3.3 - Selecting a category in Pages not working« 25. May
- mdee created topic »How to implement returnpage ?« 25. May
Zikula Blog
- Anatomy of Open Source Projects on Mar 07
- Continuous Review on Mar 01
- Not Invented Here on Feb 24
- How to Contribute Your Code at Github on Jan 13
- 10 Steps to Coding-Nirvana: Tips for Successful Module Writing on Nov 12
- Submitting Bug Report Tickets That Get Results on Aug 17
- Cozi Tricks #1: Syntax Highlighting on Aug 07
Login
Profile module - new field type
-
- Rank: Freshman
- Registered: Dec 30, 2006
- Last visit: Apr 20, 2010
- Posts: 58
-
- Rank: Legend
- Registered: Dec 11, 2002
- Last visit: Oct 21, 2009
- Posts: 11674
Please add a feature request (or if you code it yourself, a patch) to the tracker on noc.postnuke.com/projects/postnuke.
I'm afraid that what's in the module at the moment is all that's available, but that can change in the future.
--
itbegins.co.uk - Zikula Consulting
birtwistle.me.uk - Personal Blog
Please read the Support Guide -
- Rank: Helper
- Registered: Sep 16, 2004
- Last visit: Oct 21, 2009
- Posts: 731
There are several modules to do that - pnAvatar, Avatar (1.1 for .764, 2.0 for .800) and pnUserPictures.
Try them and see which work for you.
pnAvatar and Avatar both use the standard avatar field, just allow users to upload personal avatars. Avatar allows you to set the upload directory, so that if you disable the editing of the avatar field in the user profile, users can then just upload their own and not accidentally (or intentionally) use someone else's. -
- Rank: Freshman
- Registered: Dec 30, 2006
- Last visit: Apr 20, 2010
- Posts: 58
Yes, I know about Avatar module but unfortunately version 2.0 for .8 not support personal avatar's... maybe only don't want for me :(
Anyway I want to have avatars and user pictures. I thought about copy and rename all avatar module to User Pictures module :) and install as User Pictures but since personal avatars are not personal any more it's not a good solution.
I have already add, a image upload type to select option and add, a template to view it but I have problem to do the upload... I don't know how to execute upload function inside a Profile form and pass back uploaded image path into input field so it can be saved... I have tried use Ajax but it seems I'm not enough smart
I'm still thinking about that avatar module I have to look into it...
I want to make a friends page where instead of avatars in last seen or on-line block will be picture and other stuff it's going to be some kind of dating service
Spring is coming... love is in the air
--
rgfdgafgaf -
- Rank: Helper
- Registered: Sep 16, 2004
- Last visit: Oct 21, 2009
- Posts: 731
Take a look at the Avatar 2.0 upload, it uses a few PN classes to perform it, do some checks, and such.
So you want to have an avatar AND a picture?
I have Avatar 2.0 working on a few .8 sites, but I had to adjust 1 thing in the code (I'll have to look up what I did), and make sure it pointed to a writable folder.
NCM -
- Rank: Team Member
- Registered: Jan 02, 2003
- Last visit: Oct 21, 2009
- Posts: 800
uheweb
I have Avatar 2.0 working on a few .8 sites, but I had to adjust 1 thing in the code (I'll have to look up what I did)
Please add this to the tracker at the NOC project if it is a general problem with Avatar 2.0.
Kaik
Yes, I know about Avatar module but unfortunately version 2.0 for .8 not support personal avatar's...
Can you explain this please? If it is a bug, it should be fixed.
--
"He is not dangerous, he just wants to play...." -
- Rank: Freshman
- Registered: Dec 30, 2006
- Last visit: Apr 20, 2010
- Posts: 58
uheweb
So you want to have an avatar AND a picture?
I have Avatar 2.0 working on a few .8 sites, but I had to adjust 1 thing in the code (I'll have to look up what I did), and make sure it pointed to a writable folder.
Yes, a want to have avatar AND picture.
Landseer
Can you explain this please? If it is a bug, it should be fixed.
User's are able to load their own avatar and it is saved correctly with pers_uid so folder is writeable. Problem is because in the main view user's can see all avatars including private also they can choose other users avatars.
I think this problem have been reported already...
--
rgfdgafgaf -
- Rank: Freshman
- Registered: Dec 30, 2006
- Last visit: Apr 20, 2010
- Posts: 58
Sorry for double posting
Ok I found it and make a fix it's a simple fix but is working...
old avatars pnuserapi.php functions with bug's
Code
...
function Avatar_userapi_getAvatars($args)
{
if (isset($args['uid'])) {
$uid = $args['uid'];
} else {
// no user ID is passed, so assume the current user
$uid = pnUserGetVar('uid');
}
$avatardir = pnModGetVar('Avatar', 'avatardir');
$allavatars = FileUtil::getFiles($avatardir, true, true, null, false);
$avatars = array();
foreach ($allavatars as $avatar) {
$parts = explode($avatar, '_'); //Kaik: no way to work...
if(is_array($parts)) {
if(!isset($parts[1])) {
// normal aatar, so it's OK
$avatars[] = $avatar;
} else {
// check for permission; Kaik: even if somehow $parts[1]
// will exist then for sure uid.fileextension will not be same as any uid in pn
//...no way to get personal avatar
if(SecurityUtil::checkPermission('Avatar::', $parts[0] . ':'
. $parts[1] . ':', ACCESS_READ) || $parts[1] == $uid) {
$avatars[] = $avatar;
}
}
}
}
asort($avatars);
return $avatars;
}
...
function Avatar_userapi_checkAvatar($args)
{
// check if the avatar is allowed for the user
$avatar_ok = false;
$parts = explode($args['avatar'], '_');
if(is_array($parts)) {
if(!isset($parts[1])) {
// normal avatar, so it's OK
$avatar_ok = true;
} else {
// check for permission
//
if(SecurityUtil::checkPermission('Avatar::', $parts[0] . ':'
. $parts[1] . ':', ACCESS_READ, $args['uid']) || $parts[1] == $args['uid']) {
$avatar_ok = true;
}
}
}
return $avatar_ok;
}
My bug's fix
Code
...
function Avatar_userapi_getAvatars($args)
{
if (isset($args['uid'])) {
$uid = $args['uid'];
} else {
// no user ID is passed, so assume the current user
$uid = pnUserGetVar('uid');
}
$avatardir = pnModGetVar('Avatar', 'avatardir');
$allavatars = FileUtil::getFiles($avatardir, true, true, null, false);
$avatars = array();
foreach ($allavatars as $avatar) {
$parts = explode('_', $avatar);
if(is_array($parts)) {
if(!isset($parts[1])) {
// normal aatar, so it's OK
$avatars[] = $avatar;
} else {
// check for permission
$uidpart = explode('.', $parts[1]);
if( $uidpart[0] == $uid) {
$avatars[] = $avatar;
}
}
}
}
asort($avatars);
return $avatars;
}
...
function Avatar_userapi_checkAvatar($args)
{
// check if the avatar is allowed for the user
$avatar_ok = false;
$parts = explode('_', $args['avatar']);
if(is_array($parts)) {
if(!isset($parts[1])) {
// normal avatar, so it's OK
$avatar_ok = true;
} else {
// check for permission
$uidpart = explode('.', $parts[1]);
if( $uidpart[0] == $args['uid']) {
$avatar_ok = true;
}
}
}
return $avatar_ok;
}
hmm...
edited by: Kaik, Mar 18, 2008 - 03:35 PM
--
rgfdgafgaf -
- Rank: Helper
- Registered: Sep 16, 2004
- Last visit: Oct 21, 2009
- Posts: 731
Landseer,
the forumdir gave me trouble, so I changed it to:
Avatar_admin_modifyconfighandler.class.php line 74 in 2.0 RC1:
Code
if ($data['forumdir']) pnModSetVar('Avatar', 'forumdir', $data['forumdir']);
So, if no forumdir was set, the lang. define wouldn't need to be set either and possible throw an error on null. I didn't investigate further.
Also, on my system I kept getting the type returned as "jpeg" . I followed the code, and at no point could I see where it would return jpeg instead of jpg as the filetype.
I fiddled for a while, but finally just added jpeg to the end of the allowed filetypes.
Seems image_type_to_extension function would return jpg:
Code
case IMAGETYPE_JPEG : return $dot . 'jpg';
But I would always get back jpeg....how, I have no idea! It boggled me as its just a simple switch and jpeg cannot be returned anywhere. The night grew late, so I just gave up and added jpeg in the admin settings and all worked fine.
NCM
UHEweb / SwitchBit -
- Rank: Helper
- Registered: Sep 16, 2004
- Last visit: Oct 21, 2009
- Posts: 731
As for being able to choose other's avatars, I just disable the field in the User admin.
Then, they are forced to use the avatar module to manage their avatar.
Don't delete the field, just disable it. The Avatar will still add to the DB correctly, and as far as I've seen, PN will still fetch and display the avatar correctly everywhere.
NCM -
- Rank: Helper
- Registered: Sep 16, 2004
- Last visit: Oct 21, 2009
- Posts: 731
Same thing happens on this site - you can hijack another's personal avatar...
Admins - just disable the avatar field in the main profile page
-
- Rank: Freshman
- Registered: Dec 30, 2006
- Last visit: Apr 20, 2010
- Posts: 58
I have found another small bug in Users/pnuser.pnp line 337
is
Code
should be
Code
I will add this to the tracker at the NOC project I'm waiting for registration email
The other thing is that when you add/edit dud field in Profile should be option to add default value for that field, which is set during registration.
Similar to blank.gif like in avatar but not hardcoded as it's above.
--
rgfdgafgaf -
- Rank: Team Member
- Registered: Jan 02, 2003
- Last visit: Oct 21, 2009
- Posts: 800
@Kaik: Thanks, the code fixed a bug I was chasing for a longer time. This avoids avatar images being hijacked by others in 2.0, I am not sure if I will fix this in the code used here.
@uheweb: image_type_to_extension() in PHP5 returns jpeg in case of a .jpg file, I changed the upgrade function in Avatar to add jpeg to the extension list if jpg is found.
Both changes will be committed to the Avatar-SVN today. Please do not post bugs here at all as we do not look into the forums to find them, please always use the bug tracker on NOC.
--
"He is not dangerous, he just wants to play...."
- Moderated by:
- Support
