Page 1 of 2
User Profile plugin + gravatar
Posted: Fri Dec 09, 2005 4:54 am
by jerwarren
I've extended the user profile plugin to enable the ability to use gravatar images rather than local user image files. It doesn't cache the images like the gravatar plugin for comments does, because I think that is silly. The user can now select whether to use the local image or gravatar, and also the size of the gravatar image to be displayed.
diff here:
http://nyquil.org/uploads/serendipity_e ... .php.patch
(This needs to be rightclick and saved, the browser apparently strips out all the newlines, which is new to me)
Re: User Profile plugin + gravatar
Posted: Fri Dec 09, 2005 1:31 pm
by garvinhicking
The caching for gravatar images was done, because gravatar.com was unstable and down for a larger time period in the past, BTW.
Thanks a lot for your patch, I just committed it to our CVS. BTW, I changed your indenting from TABS to Spaces and abstracted the language to use constants!
Best regards,
Garvin
Posted: Fri Dec 09, 2005 5:58 pm
by jerwarren
I was under the impression that the SPARTACUS plugin was fetching plugins from CVS, but when installing this plugin now, the changes aren't in it. Am I just mistaken about how this works?
Do changes of this type not show up until the next revision of s9y?
Posted: Fri Dec 09, 2005 8:26 pm
by judebert
The stuff is built on a 24-hour cycle. Just wait a bit and it'll show eventually.
Posted: Fri Dec 09, 2005 8:42 pm
by jerwarren
awesome. Thanks for the info
Bugfixes + more features.
Posted: Mon Dec 12, 2005 1:08 am
by jerwarren
I forgot to actually add the gravatar size to the configuration setup, so I went ahead and fixed that. Also, I added a configuration for a default gravatar image to be displayed, and a configuration of gravatar rating level.
As, I feel it would be alot more configurable to wrap a div around the user image so that people can add background colors, borders, and reposition it, I've gone ahead and changed that as well.
If you'd like to see it in action on the test install I use to troubleshoot, check out
http://balloondating.com/blog/.
Here's a patch:
serendipity_event_userprofiles.diff
That patch
should make the necessary changes to both the php and the english language includes, but I'm new to this whole patchmaking thing. My apolgies if it doesn't work like it is supposed to.
Re: Bugfixes + more features.
Posted: Mon Dec 12, 2005 9:30 am
by garvinhicking
Great, your patch was perfect! I committed it as is!
Regards,
Garvin
user profile?
Posted: Wed Dec 14, 2005 4:37 am
by jerwarren
While looking through the code in the plugin, there appears to be a huge amount of options such as AIM, Yahoo, Skype, etc. Is that a planned feature that never made it to the plugin release? There are many, many things the plugin thinks a user ought to be able to specify, but I can't figure out how one would specify them.
I figured I would ask before I start tinkering around trying to "finish" the plugin..
figured it out
Posted: Wed Dec 14, 2005 5:11 am
by jerwarren
i just noticed the 'profiles' link on the admin page, which answered my question, but raised another.
There currently doesn't appear to be a way for a non-admin user to edit their own profile.
In order to achieve this, would the best plan of action be to have the profile plugin add options to the 'personal settings' page?
Re: figured it out
Posted: Wed Dec 14, 2005 3:52 pm
by garvinhicking
That's a very good suggestion. And quite easy to implement, actually.
Just edit your include/admin/personal.inc.php file, and after the closing </form> at the end of the file add this:
Code: Select all
<?php
$add = array('internal' => true);
serendipity_plugin_api::hook_event('backend_sidebar_entries_event_display_profiles', $from, $add);
?>
Then the page should show up in the personal preferences...
Best regards,
Garvin
personal settings
Posted: Thu Dec 15, 2005 2:48 am
by jerwarren
That code did indeed add it to the personal settings page, but it doesn't appear to enable the ability to edit. View is the only option.
I'll dig through the plugin and see if I can't figure it out on my own, but if anyone has any ideas I'd be happy to hear them.
Re: personal settings
Posted: Thu Dec 15, 2005 11:29 am
by garvinhicking
Hm, the userprofile plugin does have some code that checks the permissions.
This code:
Code: Select all
function checkUser(&$user) {
global $serendipity;
return ($user['userlevel'] < $serendipity['serendipityUserlevel'] || $user['authorid'] == $serendipity['authorid'] || $serendipity['serendipityUserlevel'] >= USERLEVEL_ADMIN);
}
Is responsible for fetching the users. Do you get any values in the dropdown of the profile plugin so that it contains the own userid, or is the dropdown empty? (the one with the view button next to it)
Best regards,
Garvin
user profile editing
Posted: Thu Dec 15, 2005 8:20 pm
by jerwarren
Yeh, I found that bit of code, and it seems as if it should be doing it, but it isn't.
(Incidentally, doesn't the first part of that OR statement and the last part do exactly the same thing?)
It's almost as if $user isn't getting set properly when backend_sidebar_entries_event_display_profiles gets called from the personal settings page, causing neither of the OR conditions involving $user to be met.
I get the full list of users in the dropdown, and can view all of them, but can only ever see the edit button as an administrator. The currently logged in user is always selected by default upon loading the personal settings page.
Re: user profile editing
Posted: Thu Dec 15, 2005 9:58 pm
by garvinhicking
jerwarren: Did you try a print_r($user) within the function call? That you can check what the actual input is?
(The first and last IF statement can be different, if the current user is not a Admin!)
Regards,
Garvin
Posted: Thu Dec 15, 2005 11:43 pm
by jerwarren
Something is indeed fishy.
while logged in as the non admin user 'jer' (authorid 2) $user['authorid'] before calling backend_sidebar_entries_event_display_profiles' is 2, inside the checkUser function it is 1.
I've been up and down through the plugin trying to figure out where $user is getting assigned improperly, but I can't find it.