This is a mod that is - so I hope - a nice example of how useful AJAX can be.
What it does is:
Upon registration, when the user enters a username and email address the AJAX interface checks immediately if the name is already taken and if the email address is free/semantically OK/not blocked.
If verification is enabled it also compares the two entered addresses.
Note that all this is done before the form is submitted.
When there is an error the user gets notified.
This saves new users of frequented boards from a lot of entering , waiting, reading "Sorry, this name is already taken" and so on... hope the point is clear.
The whole thing requires the xajax libraries which are included, and on the client side JavaScript must be enabled.
Well, doesn't hurt without.

You can get it at Punres or here
mod_registerPrecheck-1.0.tgz
mod_registerPrecheck-1.0.zip

Note for developers:
Yes, I had to reuse a lot of Rickards register functionality, no way round it smile

note for designers/CSS experts:
The notification is currently producing red bold text. I am aware that some of you would like to change that.
However, I'm not the big CSS expert so whoever is interested leave me a clue here. Thanks. smile

maxine wrote:

I use a new site that lets you upload up to 500MB of ANY type of file WITHOUT ANY QUESTIONS.

In which case you don't even need a mod, just a link to the file that you uploaded there.
I have the feeling that this is some free advertising for that service.
Otherwise I cannot make much sense out of it... smile

OK, let me put it like this:
Of course your pages should be indexed regardless if you advertise/link them or not.
However, if you don't they will not show up where you would like them to which again may lead to the idea that they are not indexed at all. Better?
That's what I actually meant, thought it would be clear but it wasn' apparently. Sorry.

But thank you for the friendly and verbose criticism anyway.

Connorhd wrote:

well everyone elses forum gets indexed fine.

Not everybody's I believe. Only those who made their homeworks as for advertising, linking, meta tags and the likes smile
None of which is PunBB specific....

Provided that the fields exist in the table you are calling (you'll have to take care of that yourself wink ) you have to use

if ($tid) {
                $db->query('UPDATE '.$low_prio.$db->prefix.'users SET xp='.intval($XP).', lvl='.intval($lvl).' WHERE id='.$pun_user['id']) or error('Unable to update user', __FILE__, __LINE__, $db->error());
                redirect('viewtopic.php?pid='.$new_pid.'#p'.$new_pid, $lang_post['Post redirect'].'<br />You have gained '.$cur_posting['cm_cpp'].'XP');
            } else if($fid) {
                $db->query('UPDATE '.$low_prio.$db->prefix.'users SET xp='.intval($XP).', lvl='.intval($lvl).' WHERE id='.$pun_user['id']) or error('Unable to update user', __FILE__, __LINE__, $db->error());
                process_uploaded_images($new_pid);
                redirect('viewtopic.php?pid='.$new_pid.'#p'.$new_pid, $lang_post['Post redirect'].'<br />You have gained '.$cur_posting['cm_cpt'].'XP');

            }

131

(121 replies, posted in PunBB 1.2 discussion)

Wow.

These hooks that I saw in the XML file - is this a line of code or so that the extensions expects to find in the source ?
Would that not cause trouble on systems that already have other extensions installed?

If not it looks like the solution to the nightmares of those with a few mods installed.... smile

It will not satisfy everybody but the vast majority will profit from that I think.
And those still stuck with php < 4.3. will have a good reason for a serious talk with their host smile

I don't know the cash mod but first of all remove most of the double "="
They are for comparison while the single ones are for assignments.

Like this:

cash = $pun_user['cm_cash'];
$lvl = $pun_user['lvl'];
$XP = $pun_user['XP'];
if ($cash<"20"){
    $lvl="1";
    $XP ="20"-$cash;
    }
    else if ($cash=="20"){
    $lvl=$lvl+1;
    $XP ="20"-$cash;
    }
    else if ($cash=="40"){
    $lvl=$lvl+1;
    $XP ="40"-$cash;
    }
    else if ($cash=="65"){
    $lvl=$lvl+1;
    $XP ="65"-$cash;
    }
    else if ($cash=="90"){
    $lvl=$lvl+1;
    $XP ="90"-$cash;
    }
    else if ($cash=="120"){
    $lvl=$lvl+1;
    $XP ="120"-$cash;
    }
    else if ($cash=="150"){
    $lvl=$lvl+1;
    $XP ="150"-$cash;
    }
    else if ($cash=="185"){
    $lvl=$lvl+1;
    $XP ="185"-$cash;
    }
    else if ($cash=="225"){
    $lvl=$lvl+1;
    $XP ="225"-$cash;
    }
    else if ($cash=="270"){
    $lvl=$lvl+1;
    $XP ="270"-$cash;
    }
    else if ($cash=="300"){
    $lvl=$lvl+1;
    $XP ="300"-$cash;
    }
    else if ($cash=="350"){
    $lvl=$lvl+1;
    $XP =="350"-$cash;
    }
    else if ($cash=="400"){
    $lvl=$lvl+1;
    $XP ="400"-$cash;
    }
    else if ($cash=="450"){
    $lvl=$lvl+1;
    $XP ="450"-$cash;
    }
    else if ($cash=="500"){
    $lvl=$lvl+1;
    $XP ="500"-$cash;
    }
    else if ($cash=="550"){
    $lvl=$lvl+1;
    $XP ="550"-$cash;
    }
    else if ($cash=="600"){
    $lvl=$lvl+1;
    $XP ="600"-$cash;
    }
    else if ($cash=="650"){
    $lvl=$lvl+1;
    $XP ="650"-$cash;
    }
    else if ($cash=="700"){
    $lvl=$lvl+1;
    $XP ="700"-$cash;
    }
    else if ($cash=="750"){
    $lvl=$lvl+1;
    $XP ="750"-$cash;
    }
    else if ($cash=="800"){
    $lvl=$lvl+1;
    $XP ="800"-$cash;
    }
    else if ($cash=="850"){
    $lvl=$lvl+1;
    $XP ="850"-$cash;
    }
    else if ($cash=="900"){
    $lvl=$lvl+1;
    $XP ="900"-$cash;
    }
    else if ($cash=="1000"){
    $lvl=$lvl+1;
    $XP ="1000"-$cash;
    }

Don't know if this is the only bug but it's the most obvious one  smile

But if you change your code to

cash = $pun_user['cm_cash'];
$lvl = $pun_user['lvl'];
$XP = $pun_user['XP'];

$levels = array(0,20,40,65,90,120,150,185,225,270,300,350,400,450,
  500,550,600,650,700,750,800,850,900,1000);

# Start level
$lvl = '1';
$XP = (20 - $cash);
foreach($levels as $level_count)  {
  if($cash >= $level_count) {
    $lvl++;
    }
  }
$XP = ($levels[($lvl - 1)] - $cash);

you not only save some dozens lines of code, it will also be much easier for you to change/add levels.

134

(11 replies, posted in Feature requests)

..and that's why I thought this was one as well....

Can you enable PUN_DEBUG in common.php and tell me what exactly it says there?
Can't find a mistake....

Did you update your database?
Does your table PREFIXgroups have the column g_invitations ?

137

(12 replies, posted in PunBB 1.2 discussion)

Connorhd wrote:

Middle clicking links with target="_blank" or with the javascript punbb uses opens them in a new tab fine in firefox wink

Do they? Havent' tested, but I prefer to avoid javaScript anyway because quite a few people have it switched off.

Connorhd wrote:

BTW, i highly recommend the targetalert extension for firefox, which puts icons next to links (it can be set to show them on hover which is awesome) and is really nice so you can see if its gonna do something funky when you click it wink

I'll give that a try. Sounds interesting. Any severe penalty on the page rendering time?

138

(11 replies, posted in Feature requests)

Your post did not mention only Rickard being addressed so I thought I spend a minute to help out.
Anyway, if he decides not to add it to the code I'm sure you can still do it yourself tongue

What is it that you want to have displayed?
You can have certain information displayed through extern.php (use the search, there are thousands of topics on that one here).

Slicky wrote:

Damn....That means that for it to work now, I would have to ask everyone who has ever logged in to delete cookies..

Guess so.... sad

There is only the alternative of setting up a redirect from your www.yoursite.com/index.php to something like forum.yoursite.com/content.php.
That way people will be in the "right" domain but it is neither very elegant nor search engine friendly.

141

(12 replies, posted in PunBB 1.2 discussion)

I always click links with my middle mouse button. using firefox this makes them appear in a new tab that loads in the background while I can continue to read the site I'm currently at. A lot of people I know do that.
Besides the fact that there is no JavaScript or HTML allowing to do this automatically - opening in a new tab works only with "normal" or targeted links. It often does not work with links tat open a new window with Javascript.
Therefore, I really appreciate links that do not open a window with JavaScript smile

142

(11 replies, posted in Feature requests)

Yes. Right. I did not see that one.
Ok, so we combine my wisdom with yours and we have the solution, right? smile

143

(11 replies, posted in Feature requests)

Yes. You could use num_replies for that as well. Of course with another kind of query.
But it wouldn't look half as important smile

144

(12 replies, posted in PunBB 1.2 discussion)

whereas the purists here say that this is not valid X- Y- or whatever-HTML.
Just to mention it wink

145

(11 replies, posted in Feature requests)

This should do the trick for you.
Not tested too heavily as usual wink (but works on the only board I have that has threads of that size...) , and since it is an extra request it might have a slight impact on the speed
Go to viewtopic.php and find around line 123:

    if ($is_admmod)
        $post_link .= ' / <a href="post.php?tid='.$id.'">'.$lang_topic['Post reply'].'</a>';
}

After this, add

//Determine the total number of posts in this topic
$result = $db->query('SELECT count(*) as CT  FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'users AS u ON u.id=p.poster_id INNER JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id LEFT JOIN '.$db->prefix.'online AS o ON (o.user_id=u.id AND o.user_id!=1 AND o.idle=0) WHERE p.topic_id='.$id) or error('Unable to fetch post count', __FILE__, __LINE__, $db->error());
$cur_post = $db->fetch_assoc($result);
if($cur_post['CT'] <= ($pun_user['disp_posts'] + 2)) $pun_user['disp_posts'] = $cur_post['CT'];

Now, if you also want to get rid of the post counts in viewforum.php, then go to line 264 (ca.)

Replace this

$num_pages_topic = ceil(($cur_topic['num_replies'] + 1) / $pun_user['disp_posts']);

with this

    if(($cur_topic['num_replies'] + 1) <= ($pun_user['disp_posts'] + 2))  $num_pages_topic = 1;
    else    $num_pages_topic = ceil(($cur_topic['num_replies'] + 1) / $pun_user['disp_posts']);

146

(51 replies, posted in Feature requests)

You can set the permision level for each forum separately in the administration.

You can have only members post in one forum and allow guests to post to the other, it all works through the forum administration.

As for the initial topic:
I really don't see the point.
You can have guests posting if you like, you just have comment out a line or two to even take out the email field when registering, it is very easy.
So, if this was a feature request here's how you do it:

First, open register.php

Now change this line (around line 82)

$email1 = strtolower(trim($_POST['req_email1']));

with

$email1 = "foo@bar.com";

next, comment out these lines starting around line 152:

    if (!is_valid_email($email1))
        message($lang_common['Invalid e-mail']);
    else if ($pun_config['o_regs_verify'] == '1' && $email1 != $email2)
        message($lang_register['E-mail not match']);

    // Check it it's a banned e-mail address
    if (is_banned_email($email1))
    {
        if ($pun_config['p_allow_banned_email'] == '0')
            message($lang_prof_reg['Banned e-mail']);

        $banned_email = true;    // Used later when we send an alert e-mail
    }
    else
        $banned_email = false;

    // Check if someone else already has registered with that e-mail address
    $dupe_list = array();

    $result = $db->query('SELECT username FROM '.$db->prefix.'users WHERE email=\''.$email1.'\'') or error('Unable to fetch user info', __FILE__, __LINE__, $db->error());
    if ($db->num_rows($result))
    {
        if ($pun_config['p_allow_dupe_email'] == '0')
            message($lang_prof_reg['Dupe e-mail']);

        while ($cur_dupe = $db->fetch_assoc($result))
            $dupe_list[] = $cur_dupe['username'];
    }

Then comment out this, starting around line 305

                <fieldset>
                    <legend><?php echo ($pun_config['o_regs_verify'] == '1') ? $lang_prof_reg['E-mail legend 2'] : $lang_prof_reg['E-mail legend'] ?></legend>
                    <div class="infldset">
<?php if ($pun_config['o_regs_verify'] == '1'): ?>            <p><?php echo $lang_register['E-mail info'] ?></p>
<?php endif; ?>                    <label><strong><?php echo $lang_common['E-mail'] ?></strong><br />
                        <input type="text" name="req_email1" size="50" maxlength="50" /><br /></label>
<?php if ($pun_config['o_regs_verify'] == '1'): ?>                        <label><strong><?php echo $lang_register['Confirm e-mail'] ?></strong><br />
                        <input type="text" name="req_email2" size="50" maxlength="50" /><br /></label>
<?php endif; ?>                    </div>
                </fieldset>

And finally, comment out this (around 398)

            <div class="inform">
                <fieldset>
                    <legend><?php echo $lang_prof_reg['Privacy options legend'] ?></legend>
                    <div class="infldset">
                        <p><?php echo $lang_prof_reg['E-mail setting info'] ?></p>
                        <div class="rbox">
                            <label><input type="radio" name="email_setting" value="0" /><?php echo $lang_prof_reg['E-mail setting 1'] ?><br /></label>
                            <label><input type="radio" name="email_setting" value="1" checked="checked" /><?php echo $lang_prof_reg['E-mail setting 2'] ?><br /></label>
                            <label><input type="radio" name="email_setting" value="2" /><?php echo $lang_prof_reg['E-mail setting 3'] ?><br /></label>
                        </div>
                        <p><?php echo $lang_prof_reg['Save user/pass info'] ?></p>
                        <div class="rbox">
                            <label><input type="checkbox" name="save_pass" value="1" checked="checked" /><?php echo $lang_prof_reg['Save user/pass'] ?><br /></label>
                        </div>
                    </div>
                </fieldset>
            </div>

That should do the trick.

And fo the rest of us, the really paranoid bunch, there is the excellent captcha mod or the email verification method or even a combination of both. tongue

147

(5 replies, posted in Programming)

The <div> called "postfootleft" is actually below the "postleft"

Basically what you do is:
1. Enter your div "division one"
2. Enter your div with the content
3. Enter the clearer div
4. Enter your div "division two"
5. Enter some other div on the right

Oh, I see.
But actualy it should work if the cookie is set correctly.
This could be a mistake in my previous posting.

The line in config.php must be

$cookie_domain = '.yourhost.com';

not

$cookie_domain = 'yourhost.com';

(Note the leading dot)
Delete your current cookie and try that one.

It is not an easy thing to do, maybe that's why wink
You could set all new users on hold until you have reviewed their avatars.
After that you'll have to trust them I think smile

So, *where* you logged in when you tested then?
Because when it showed the other users I see no reason why it didn't show you - unless you hadn't logged in.