1 fsecchi Jun 11, 2006 00:34
3 fsecchi Jun 11, 2006 10:52
Certainly Edb.
I am using Sparkle v0.9.2. About adding a new field I had thought about it but and as you rightly said it is not so much the adding of the field but finding all the locations to call upon that new field - I hope I have not offended anyone.... ;)
I was only able to hack the back office, last night I was going to have a look at the front end this morning. In the file admin/_user_form.php I touched up the code around
Lines 133 on
<?php
form_select( 'edited_user_locale', $edited_User->get('locale'), 'locale_options', T_('Preferred locale'), T_('Preferred locale for admin interface, notifications, etc.'));
}
else
{ // display only
form_info( T_('Login'), $edited_User->dget('login') );
form_info( T_('First name'), $edited_User->dget('firstname') );
form_info( T_('Last name'), $edited_User->dget('lastname') );
form_info( T_('Nickname'), $edited_User->dget('nickname') );
form_info( T_('Identity shown'), $edited_User->dget('preferedname') );
form_info( T_('Locale'), $edited_User->dget('locale'), T_('Preferred locale for admin interface, notifications, etc.') );
}
$fieldnote = '<a href="mailto:'.$edited_User->get('email').'"><img src="img/play.png" height="14" width="14" alt=">" title="'.T_('Send an email').'" class="middle" /></a>';
if( $allowed_to_edit )
form_text( 'edited_user_email', $edited_User->dget('email', 'formvalue'), 30, T_('Email'), $fieldnote, 100 );
else
form_info( T_('Email'), $edited_User->dget('email'), $fieldnote );
if( ($url = $edited_User->get('url')) != '' )
{
if( !preg_match('#://#', $url) )
{
$url = 'http://'.$url;
}
$fieldnote = '<a href="'.$url.'" target="_blank"><img src="img/play.png" height="14" width="14" alt=">" title="'.T_('Visit the site').'" class="middle" /></a>';
}
else $fieldnote = '';
if( $allowed_to_edit )
form_text( 'edited_user_url', $edited_User->dget('url', 'formvalue'), 30, T_('URL'), $fieldnote, 100 );
else
form_info( T_('URL'), $edited_User->dget('url'), $fieldnote );
if( $edited_User->get('icq') != 0 )
{
$fieldnote = '<a href="http://wwp.icq.com/scripts/search.dll?to='.$edited_User->get('icq').'" target="_blank"><img src="img/play.png" height="14" width="14" alt=">" title="'.T_('Search on ICQ.com').'" class="middle" /></a>';
}
else $fieldnote = '';
if( $allowed_to_edit )
form_text( 'edited_user_icq', $edited_User->dget('icq', 'formvalue'), 30, T_('ICQ'), $fieldnote, 10 );
else
form_info( T_('ICQ'), $edited_User->dget('icq', 'formvalue'), $fieldnote );
/* Removal of the AIM part
if( $edited_User->get('aim') != '' )
{
$fieldnote = '<a href="aim:goim?screenname='.$edited_User->get('aim').'&message=Hello"><img src="img/play.png" height="14" width="14" alt=">" title="'.T_('Instant Message to user').'" class="middle" /></a>';
}
else $fieldnote = '';
if( $allowed_to_edit )
*/
/*This is the Skype bit Begins*/
if( $edited_User->get('yim') != '' )
{
$fieldnote = '<a href="skype:'.$edited_User->get('yim').'?call"><img src="http://download.skype.com/share/skypebuttons/buttons/call_blue_transparent_34x34.png" style="border: none;" width="34" height="34" alt="Call me!" /></a>';
}
else $fieldnote = '';
if( $allowed_to_edit )
/*This is the Skype bit Ends*/
{
form_text( 'edited_user_aim', $edited_User->dget('aim', 'formvalue'), 30, T_('AIM'), '', 50 );
form_text( 'edited_user_msn', $edited_User->dget('msn', 'formvalue'), 30, T_('MSN IM'), '', 100 );
form_text( 'edited_user_yim', $edited_User->dget('yim', 'formvalue'), 30, T_('Skype'), $fieldnote, 50 );
form_checkbox( 'edited_user_notify', $edited_User->get('notify'), T_('Notifications'), T_('Check this to receive notification whenever one of your posts receives comments, trackbacks, etc.') );
form_text( 'edited_user_pass1', '', 20, T_('New password'), '', 50, T_('Leave empty if you don\'t want to change the password.'), 'password' );
form_text( 'edited_user_pass2', '', 20, T_('Confirm new password'), '', 50, '', 'password' );
}
else
{
form_info( T_('AIM'), $edited_User->dget('aim') );
form_info( T_('MSN IM'), $edited_User->dget('msn') );
form_info( T_('Skype'), $edited_User->dget('yim'), $fieldnote );
form_info( T_('Notifications'), ($edited_User->dget('notify')) ? T_('yes') : T_('no') );
}?>
</fieldset>
<?php
if( $allowed_to_edit )
{
form_submit();
}
?>
<fieldset>
<legend><?php echo T_('User information') ?></legend>
<?php
form_info( T_('ID'), $edited_User->dget('ID') );
form_info( T_('Posts'), ( $action != 'newtemplate' ) ? get_usernumposts($edited_User->get('ID')) : '-' );
form_info( T_('Created on'), $edited_User->dget('datecreated') );
form_info( T_('From IP'), $edited_User->dget('ip') );
form_info( T_('From Domain'), $edited_User->dget('domain') );
form_info( T_('With Browser'), $edited_User->dget('browser') );
?>
This is what it now looks like, I know a little formating has to be taken care of but that is a consequence of the new larger button on the side of the text input.
4 edb Jun 11, 2006 11:24
Cool. Thanks. 0.9.2 is a good version to hack. I'll play with this a bit, though personally I'd have chosen something different from YIM since YIM is the only one I use, but so what! Shouldn't be too hard to hook up the front side profile to do the same thing. Just a rough guess here.... Open up skins/_profile.php OR skins/yourskin/_profile.php and find this:
form_text( 'newuser_yim', get_user_info( 'yim' ), 40, T_('Yahoo I.M.'), '', 50, 'bComment' );
Now make it be this:
form_text( 'newuser_yim', get_user_info( 'yim' ), 40, T_('Skype'), $fieldnote, 50, 'bComment' );
Bah! Not enough! You'd also have to add the bit that makes $fieldnote make sense, though you probably got a handle on that... Ah well. Maybe it'll help a bit?
BTW the first time a hack for pingomatic was introduced it took the place of pinging weblogs. Same interface and all that, plus pingomatic pinged weblogs. Didn't have any text corrections - just the end result changed. Someone came up with a 'proper' hack but it was pretty complicated and - to my mind - more effort than it was worth. It's *good* to take over a feature and use it betterer. :D
----------------
Have you considered simply shrinking the image to sort of match the general space alloted each line in the user profile? Maybe force it to pretend it's an 11 by 11 image instead of 14 by 14?
5 fsecchi Jun 11, 2006 12:58
I had a closer look at the front end user profile and there are two commands which need edited. I can gather that because the commands are coming from a public area and there for the security is slightly different the call command has to be edited.
If you are going to place the script in the front end just change the line above as suggested by Edb and change the skype function from
/*This is the Skype bit Begins*/
if( $edited_User->get('yim') != '' )
{
$fieldnote = '<a href="skype:'.$edited_User->get('yim').'?call"><img src="http://download.skype.com/share/skypebuttons/buttons/call_blue_transparent_34x34.png" style="border: none;" width="34" height="34" alt="Call me!" /></a>';
}
else $fieldnote = '';
if( $allowed_to_edit )
/*This is the Skype bit Ends*/
TO
/*This is the Skype bit Begins*/
if( $current_User->dget('yim') != '' )
{
$fieldnote = '<a href="skype:'.$current_User->dget('yim').'?call"><img src="http://download.skype.com/share/skypebuttons/buttons/call_blue_transparent_34x34.png" style="border: none;" width="34" height="34" alt="Call me!" /></a>';
}
else $fieldnote = '';
if( $allowed_to_edit )
/*This is the Skype bit Ends*/
As you can see it changes the edited_User->get to current_user->dget
I have also had a look at changing the formating but reducing the button to 14x14 leaves a little mark on the page...
What b2evolution version did you do this for? Knowing the version helps people know if they'll be able to use it themselves. Adding a new db field isn't all that hard, though adding ALL the bits to add it to a profile can be cumbersome. Lots easier to just swipe an existing one eh?
Oh and there are two visible profiles - one from the back office, and one from the front side of the web.
Anyway lemme know the version and I'll see what I can do about pointing out any other places you'd want to hack.
EDIT: Where did you put the initial code? What was before it and what comes after it is what I mean. I can figure out what the second change is all about but can't find the right home for the first bit.