Your ultimate PunBB resource!
You are not logged in.
## ## ## Mod title: Elektra Profile with Labels ## ## Mod version: 1.0.0 ## Works on PunBB: 1.2.14 ## Release date: 2007-01-11 ## Author: artoodetoo <master@1wd.ru> ## ## Description: This mod add new fields into user profile. ## There are 'gender', 'date of birth', 'interests' and 'about me'. ## Optionally user can hide year of birth, then nobody can know his|hir age. ## Users can declare their interests in comma-separated list. ## Anybody can quick search all users with the same interest. ## Furthermore, there is a new item in user profile menu: Preview. ## So, user can view his own profile as another users. ## ## NOTE: If you already have installed 'Elektra Labels for Topic' mod, you need no ## change of functions.php ## ## Affected files: profile.php ## userlist.php ## include/functions.php ## lang/English/profile.php ## ## Affects DB: Yes ## users table ## ## Notes: As always, if you find problems with this mod, ## please e-mail them to me so I could get them fixed as soon as possible. ## ## DISCLAIMER: Please note that "mods" are not officially supported by ## PunBB. Installation of this modification is done at your ## own risk. Backup your forum database and any and all ## applicable files before proceeding. ## ##
Offline
Offline
nice work artoodetoo. can you disable certain new fields easily though or must they be mod'd out manually?
Offline
thank you naitkris! what are you want to disable and why? if you explain that, may be i'll complicate the mod ![]()
you can cut any field off manually, of course.
Last edited by artoodetoo (2007-02-11 11:25:12)
Offline
B.T.W. you can use "About me" to include photography to profile (via [ img] tag)!
Look in example
Offline
very nice modification art
thanks alot. I'm currently trying to make some adjustments to suit my needs.
Offline
artoodetoo wrote:
what are you want to disable and why?
just if some of the profile fields can be removed via the admin area easily or not? not all forums may want or need all the new fields you added you see.
Offline
Nice Mod, very usefull, keep up the good work
Last edited by Knib (2007-02-11 15:44:07)
Offline
FSX,
- to skip preview, do not execute steps 16-17 and 27-28 of my readme
- field 'skype' cannot disturb my mod. let it be!
- you have to remove birthday from my mod or from existing mod. as you wish...
a.f.a.i.k Calendar mod uses varchar data type to store birthday. I think it is not very good. So, it is not compatible with Elektra Profile.
Offline
naitkris wrote:
just if some of the profile fields can be removed via the admin area easily or not? not all forums may want or need all the new fields you added you see.
if so, delete this fields from install_mod & readme before instalation.
imho, administrative "disabler" for each field is heavy solution.
Offline
Birthday on main forum page
show list of user (optionally with age)
OPEN index.php
FIND (line: 196)
if ($num_users > 0)
echo "\t\t\t".'<dl id="onlinelist" class= "clearb">'."\n\t\t\t\t".'<dt><strong>'.$lang_index['Online'].': </strong></dt>'."\t\t\t\t".implode(',</dd> ', $users).'</dd>'."\n\t\t\t".'</dl>'."\n";
else
echo "\t\t\t".'<div class="clearer"></div>'."\n";AFTER ADD
//--- birthday begin ---/
$today = getdate();
$result = $db->query('SELECT username, id, YEAR(FROM_UNIXTIME(birthday)) AS year, hide_age from '.$db->prefix.'users WHERE DAYOFMONTH(FROM_UNIXTIME(birthday))=\''.$today['mday'].'\' AND MONTH(FROM_UNIXTIME(birthday))=\''.$today['mon'].'\' ORDER by username ASC') or error('Cannot retreive birthdays', __FILE__, __LINE__, $db->error());
$birthdays_today = array();
while ($row = $db->fetch_assoc($result))
$birthdays_today[] .= "\n\t\t\t\t".'<dd><a href="profile.php?id='.$row['id'].'">'.$row['username'].'</a>'.
((!$row['hide_age'])?'('.($today['year']-$row['year']).')':'');
if (count($birthdays_today) > 0) {
echo "\t\t\t".'<dl id="birthdayslist">'."\n\t\t\t\t".'<dt><strong>' . $lang_index['Birthday Today'] . ': </strong></dt>';
echo implode(',</dd> ', $birthdays_today) . '</dd>' . "\n\t\t\t" . '</dl>' . "\n";
}
//--- birthday end ---/OPEN lang/English/index.php
APPEND
'Birthday Today' => 'Birthday Today'
In style/imports/base.css section 8.1 must be
/* 8.1 Horizontal display of online list, main navigation menu and breadcrumbs */
#birthdayslist DD, #birthdayslist DT, #onlinelist DD, #onlinelist DT, #onlinetodaylist DD, #onlinetodaylist DT,
#brdmenu LI, DIV.linkst LI, DIV.linksb LI, DIV.postlinksb LI,
DIV.postfootright LI, UL.bblinks LI {
DISPLAY: inline;
HEIGHT: 0
}It is not an optimal SQL query. In future releases I'll add auto-refreshable cache for birthday list.
Offline
There is an error reported in mod:
in readme.txt find
$lang_prof_reg['Aboutme too long']
replace with
$lang_profile['Aboutme too long']
Offline
Just to let you know, the <label> wrapped around the gender field makes it impossible to change the value in Firefox. It also forces you to click and hold the selection boxes for the birthday field.
Offline
Thank you paingel5jpg! I have not tested on Firefox because I have not Firefox ![]()
Would you be so kind to show cross-browser version with similar look?
Offline
artoodetoo, did u get my email about the extra fields?
sex,height,weight?
Offline
quaker, yes I've email you just now.
Last edited by artoodetoo (2007-03-12 21:12:45)
Offline
artoodetoo wrote:
Thank you paingel5jpg! I have not tested on Firefox because I have not Firefox
Would you be so kind to show cross-browser version with similar look?
I actually just removed the label tag entirely and put in some linebreaks. It's not exactly the same, and probably breaks some xhtml standards, but it works.
This is from profile.php. I think the first and last lines are untouched, but I've modified the board so much I'm not even sure anymore.
<label><?php echo $lang_profile['Website'] ?><br /><input type="text" name="form[url]" value="<?php echo pun_htmlspecialchars($user['url']) ?>" size="50" maxlength="80" /><br /></label>
<br />
<?php echo $lang_profile['Gender'] ?><br />
<span><input type="radio" name="form[gender]" value="1"<?php if ($user['gender'] == '1') echo ' checked' ?> /><?php echo $lang_profile['Gender male'] ?></span><br />
<span><input type="radio" name="form[gender]" value="2"<?php if ($user['gender'] == '2') echo ' checked' ?> /><?php echo $lang_profile['Gender female'] ?></span><br />
<span><input type="radio" name="form[gender]" value="0"<?php if ($user['gender'] == '0') echo ' checked' ?> /><?php echo $lang_profile['Gender hidden'] ?></span><br />
<br />
<?php echo $lang_profile['Birthday'] ?><br />
<span>
<select name="form[birthday-day]" /><option value="0">--</option><?php for($i=1;$i<=31;$i++) {echo '<option value="'.$i.'"'.(($mday==$i)? ' selected="selected"':'').' >'.$i.'</option>';} ?> </select>
<select name="form[birthday-month]" /><option value="0">--</option><?php for($i=1;$i<=12;$i++) {echo '<option value="'.$i.'"'.(($month==$i)?' selected="selected"':'').' >'.$lang_profile['Birthday months'][$i].'</option>';} ?> </select>
<select name="form[birthday-year]" /><option value="0">--</option><?php for($i=2001;$i>=1931;$i--) {echo '<option value="'.$i.'"'.(($year==$i)? ' selected="selected"':'').' >'.$i.'</option>';} ?> </select>
</span>
<br />
<br />
<input type="checkbox" name="form[birthday-hide-age] ?>]" value="1"<?php echo (($user['hide_age']) ? ' checked="checked" />' : '/>').$lang_profile['Birthday hide age'] ?>
<label><?php echo $lang_profile['Interests'].' (<em>'.$lang_profile['Interests hint'].'</em>)' ?> <br />Offline
lovely mod...I have two problems however.
One:
I am getting this error on the redirect screen when I make changes to my signature: Warning: reset() [function.reset]: Passed variable is not an array or object in C:\Program Files\xampp\htdocs\forums\profile.php on line 661
Two:
The "preview" button that let's me see the profile from point of view of non admin doesn't show up when logged in as a normal member and editing my own profile. And I tried manually putting &view at the end and it works fine, just the button is missing when editing...the button shows when I am logged in as an admin.
And a little extra idea:
There should be a button that says: "Edit Profile" when you are previewing the profile (if you are allowed to edit the profile).
Offline
1. I wonder why $_POST['form'] may not be an array. But you can try this case (look at is_array):
// Extract allowed elements from $_POST['form']
function extract_elements($allowed_elements)
{
$form = array();
if (is_array($_POST['form']))
{
reset($_POST['form']);
while (list($key, $value) = @each($_POST['form']))
{
if (in_array($key, $allowed_elements))
$form[$key] = $value;
}
}
return $form;
}2. To show "Preview" button unconditionally, place it AFTER <?php endif; ?> but before </ul>. Look at functions.php near line 315 and you 'll understand what I've talking about.
3. I.M.H.O. it's no use to make "Edit profile" button, because it exists already. It is "Profile" in main menu ![]()
I'll consider your comments for future mod release. Thank you a lot!
Offline
may not be an array. But you can try this case (look at is_array):
Code:
// Extract allowed elements from $_POST['form'] function extract_elements($allowed_elements) { $form = array(); if (is_array($_POST['form'])) { reset($_POST['form']); while (list($key, $value) = @each($_POST['form'])) { if (in_array($key, $allowed_elements)) $form[$key] = $value; } } return $form; }
fix worked no error now, thanks
2. To show "Preview" button unconditionally, place it AFTER <?php endif; ?> but before </ul>. Look at functions.php near line 315 and you 'll understand what I've talking about.
works great thanks
3. I.M.H.O. it's no use to make "Edit profile" button, because it exists already. It is "Profile" in main menu
ah the reason I want this is I would like for users to see there profile from VIEW mode as default when clicking on profile. Then if they want to edit they just click on "Edit My profile"...I will have to mod punbb to always put a &view where there are links to profiles.
I'll consider your comments for future mod release. Thank you a lot!
hey thank you, it is a great mod ![]()
Offline
crusader, what do you mean?
Offline
The entire code below results in 267 warnings using HTMl Validator. I've tried for a very long time to correct it but had no success.
<label><?php echo $lang_profile['Birthday'] ?><br />
<span>
<select name="form[birthday-day]" /><option value="0">--</option><?php for($i=1;$i<=31;$i++) {echo '<option value="'.$i.'"'.(($mday==$i)? ' selected="selected"':'').' >'.$i.'</option>';} ?> </select>
<select name="form[birthday-month]" /><option value="0">--</option><?php for($i=1;$i<=12;$i++) {echo '<option value="'.$i.'"'.(($month==$i)?' selected="selected"':'').' >'.$lang_profile['Birthday months'][$i].'</option>';} ?> </select>
<select name="form[birthday-year]" /><option value="0">--</option><?php for($i=2001;$i>=1931;$i--) {echo '<option value="'.$i.'"'.(($year==$i)? ' selected="selected"':'').' >'.$i.'</option>';} ?> </select>
</span>
</label>If you use FF with HTML Validator you will see what I am referring to.
Crusader
Offline
i'm not sure that validating is so neccesary, for example <a target="_blank"...> or <td valign="middle"> isn't validating, but VERY useful!
specially for you i can "fix" this issue in a day or two ![]()
Last edited by artoodetoo (2007-06-22 06:00:30)
Offline