PunBB Resource

Your ultimate PunBB resource!

Keywords:

    (Extended)

You are not logged in.

#1 2007-02-11 18:35:39

artoodetoo
Member
Registered: 2006-11-07
Posts: 90
Website

Elektra Profile with Labels 1.0.0

Code:

##
##
##        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.
##
##

Download here

Offline

 

#2 2007-02-11 18:49:24

artoodetoo
Member
Registered: 2006-11-07
Posts: 90
Website

Re: Elektra Profile with Labels 1.0.0

Please look screenshots 1 and 2

Offline

 

#3 2007-02-11 19:51:57

naitkris
Member
From: Cork, Ireland
Registered: 2007-01-27
Posts: 77

Re: Elektra Profile with Labels 1.0.0

nice work artoodetoo. can you disable certain new fields easily though or must they be mod'd out manually?

Offline

 

#4 2007-02-11 20:22:59

artoodetoo
Member
Registered: 2006-11-07
Posts: 90
Website

Re: Elektra Profile with Labels 1.0.0

thank you naitkris! what are you want to disable and why? if you explain that, may be i'll complicate the mod smile
you can cut any field off manually, of course.

Last edited by artoodetoo (2007-02-11 20:25:12)

Offline

 

#5 2007-02-11 20:46:56

artoodetoo
Member
Registered: 2006-11-07
Posts: 90
Website

Re: Elektra Profile with Labels 1.0.0

B.T.W. you can use "About me" to include photography to profile (via [ img] tag)!
Look in example

Offline

 

#6 2007-02-12 00:11:19

xxtubbyxx
Member
Registered: 2005-12-15
Posts: 168

Re: Elektra Profile with Labels 1.0.0

very nice modification art smile thanks alot. I'm currently trying to make some adjustments to suit my needs.


Coming to you soon: FatalGamers

Offline

 

#7 2007-02-12 00:27:07

naitkris
Member
From: Cork, Ireland
Registered: 2007-01-27
Posts: 77

Re: Elektra Profile with Labels 1.0.0

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

 

#8 2007-02-12 00:42:56

Knib
Member
Registered: 2006-12-28
Posts: 41

Re: Elektra Profile with Labels 1.0.0

Nice Mod, very usefull, keep up the good work

Last edited by Knib (2007-02-12 00:44:07)

Offline

 

#9 2007-02-12 15:25:47

FSX
Member
Registered: 2006-09-14
Posts: 593
Website

Re: Elektra Profile with Labels 1.0.0

I have installed the calendar mod so I have already a birthday field. And I have added a skype field and a preview of the profile.

What would be the effect on this?

Offline

 

#10 2007-02-13 05:05:36

artoodetoo
Member
Registered: 2006-11-07
Posts: 90
Website

Re: Elektra Profile with Labels 1.0.0

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

 

#11 2007-02-13 14:13:06

artoodetoo
Member
Registered: 2006-11-07
Posts: 90
Website

Re: Elektra Profile with Labels 1.0.0

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

 

#12 2007-02-15 13:00:09

artoodetoo
Member
Registered: 2006-11-07
Posts: 90
Website

Re: Elektra Profile with Labels 1.0.0

Birthday on main forum page
show list of user (optionally with age)
http://master.1wd.ru/download/profile-4e.gif

OPEN index.php

FIND (line: 196)

Code:

    if ($num_users > 0)
        echo "\t\t\t".'<dl id="onlinelist" class= "clearb">'."\n\t\t\t\t".'<dt><strong>'.$lang_index['Online'].':&nbsp;</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

Code:

    //--- 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'] . ':&nbsp;</strong></dt>';
        echo implode(',</dd> ', $birthdays_today) . '</dd>' . "\n\t\t\t" . '</dl>' . "\n";
    }
    //--- birthday end ---/

OPEN lang/English/index.php

APPEND

Code:

'Birthday Today'               =>      'Birthday Today'

In style/imports/base.css section 8.1 must be

Code:

/* 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

 

#13 2007-02-21 16:53:57

artoodetoo
Member
Registered: 2006-11-07
Posts: 90
Website

Re: Elektra Profile with Labels 1.0.0

There is an error reported in mod:
in readme.txt find

Code:

$lang_prof_reg['Aboutme too long']

replace with

Code:

$lang_profile['Aboutme too long']

Offline

 

#14 2007-03-11 18:22:09

paingel5jpg
New member
From: Commack, NY
Registered: 2007-03-11
Posts: 2

Re: Elektra Profile with Labels 1.0.0

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

 

#15 2007-03-12 10:06:19

artoodetoo
Member
Registered: 2006-11-07
Posts: 90
Website

Re: Elektra Profile with Labels 1.0.0

Thank you paingel5jpg! I have not tested on Firefox because I have not Firefox smile
Would you be so kind to show cross-browser version with similar look?

Offline

 

#16 2007-03-13 04:23:23

quaker
Member
From: Bama,USA
Registered: 2006-02-23
Posts: 968
Website

Re: Elektra Profile with Labels 1.0.0

artoodetoo, did u get my email about the extra fields?
sex,height,weight?


My stuff or my style might sux, but atleast I'm willing to help when I can.
Don't be stupid and help ! We are the stupid one's !!!

Offline

 

#17 2007-03-13 05:11:50

artoodetoo
Member
Registered: 2006-11-07
Posts: 90
Website

Re: Elektra Profile with Labels 1.0.0

quaker, yes I've email you just now.

Last edited by artoodetoo (2007-03-13 05:12:45)

Offline

 

#18 2007-03-15 19:23:40

paingel5jpg
New member
From: Commack, NY
Registered: 2007-03-11
Posts: 2

Re: Elektra Profile with Labels 1.0.0

artoodetoo wrote:

Thank you paingel5jpg! I have not tested on Firefox because I have not Firefox smile
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.

Code:

<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'].'&nbsp;&nbsp;(<em>'.$lang_profile['Interests hint'].'</em>)' ?> <br />

Offline

 

#19 2007-05-11 22:58:31

nickfzx
Member
From: Oxford, England
Registered: 2006-05-18
Posts: 69
Website

Re: Elektra Profile with Labels 1.0.0

lovely mod...I have two problems however.

One:

Code:

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

 

#20 2007-05-12 04:24:42

artoodetoo
Member
Registered: 2006-11-07
Posts: 90
Website

Re: Elektra Profile with Labels 1.0.0

1. I wonder why $_POST['form'] 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;
    }

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 smile

I'll consider your comments for future mod release. Thank you a lot!

Offline

 

#21 2007-05-12 05:05:09

nickfzx
Member
From: Oxford, England
Registered: 2006-05-18
Posts: 69
Website

Re: Elektra Profile with Labels 1.0.0

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 smile

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 smile

Offline

 

#22 2007-06-22 03:46:47

crusader
Member
From: Canada
Registered: 2006-10-26
Posts: 219
Website

Re: Elektra Profile with Labels 1.0.0

This mod does not validate.

Offline

 

#23 2007-06-22 05:32:57

artoodetoo
Member
Registered: 2006-11-07
Posts: 90
Website

Re: Elektra Profile with Labels 1.0.0

crusader, what do you mean?

Offline

 

#24 2007-06-22 13:00:49

crusader
Member
From: Canada
Registered: 2006-10-26
Posts: 219
Website

Re: Elektra Profile with Labels 1.0.0

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.

Code:

                            <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

 

#25 2007-06-22 13:43:57

artoodetoo
Member
Registered: 2006-11-07
Posts: 90
Website

Re: Elektra Profile with Labels 1.0.0

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 smile

Last edited by artoodetoo (2007-06-22 14:00:30)

Offline

 

Board footer

Based on PunBB
© Copyright 2002–2005 Rickard Andersson

© Copyright 2004–2006 Kristoffer Jansson

User contributed files are property of their respective owners.