Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
Register FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 03-24-2006, 03:59 AM
gtsch's Avatar
gtsch gtsch is offline
 
Join Date: Feb 2006
Posts: 50
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default posts per day determining what you can see

I want to hide my shoutbox from people who aren't actively participating in the forums. I tried to do this with this code in the shoutbox template, but it didn't work.

PHP Code:
<if condition="$vbphrase[x_posts_per_day]>1"> ... </if> 
I added it at the beginning and end of this particular template, however it ended up making it disappear for everyone.

PHP Code:
<form action="vbshout.php?{$session['sessionurl']}" method="post" name="vbshoutform" onsubmit="return postShout(this)">
<input type='hidden' name='do' value='shout' />
<input type='hidden' name='color' />
<input type='hidden' name='fontFamily' />
<input type='hidden' name='fontWeight' />
<input type='hidden' name='textDecoration' />
<input type='hidden' name='fontStyle' />

<div id='shout_emo' style='display:none'>
        <table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
        <tr>
            <td class="tcat" align="center">
                Emoticons
            </td>
        </tr>
        <tr>
            <td class='alt2' width='100%' height='100%' align='center' valign='top'>
                $Smilie_Build
            </td>
        </tr>
        </table>
    <br />
</div>
        <table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
        <thead>
        <tr>
            <td class="tcat" align="center">
                <a style="float:$stylevar[right]" href="#top" onclick="return toggle_collapse('forumhome_vbshout')"><img id="collapseimg_forumhome_vbshout" src="$stylevar[imgdir_button]/collapse_tcat$vbcollapse[collapseimg_vbshout].gif" alt="" border="0" /></a>
                <a href='vbshout.php?{$session['sessionurl_q']}do=archive'>Shoutbox</a>
            </td>
        </tr>
        </thead>
        <tbody id="collapseobj_forumhome_vbshout" style="$vbcollapse[collapseobj_forumhome_vbshout]">
            <tr>
                <td class="alt1" align="left" width="100%">
                <if condition="!$vboptions[shout_editor_position]">
                    <if condition="$bbuserinfo[userid] > 0">
                    <table width='100%' border='0' cellpadding='0' cellspacing='0'>
                        <tr>
                        <td width='100%'>
                            <input type="text" name="shout" style="width: 90%" class="bginput" />
                        </td>
                        <td style='white-space:nowrap' width='1%'>
                            <input type="submit" value="Shout" class="button" />
                            <if condition="$vboptions[shout_extra_options]">
                            <input type='button' class='button' value='Clear' onclick='sb_Clear()' />
                            <input type='button' class='button' value='Smilies' onclick='sb_Smilies(this)' />
                            <input type='button' class='button' style='font-weight:bold' value='B' onclick='sb_PropChange_Button(this, "fontWeight")' />
                            <input type='button' class='button' style='text-decoration:underline' value='U' onclick='sb_PropChange_Button(this, "textDecoration")' />
                            <input type='button' class='button' style='font-style:italic' value='I' onclick='sb_PropChange_Button(this, "fontStyle")' />
                            <select name='font_color' onchange='sb_PropChange(this, "color")'>
                                {$DropDowns['color_selector']}
                            </select>
                            <select name='font_selector' onchange='sb_PropChange(this, "fontFamily")'>
                                {$DropDowns['font_selector']}
                            </select>
                            </if>
                        </td>
                    </tr>
                    </table>
                    <div style="height: 2px"></div>
                    </if>
                </if>
                    <div id="vbshout" style="overflow:auto;height:{$vboptions['shout_box_height']}px;width:100%;">
                        Loading...
                    </div>
                <if condition="$vboptions[shout_editor_position]">
                    <if condition="$bbuserinfo[userid] > 0">
                    <div style="height: 2px"></div>
                    <table width='100%' border='0' cellpadding='0' cellspacing='0'>
                    <tr>
                        <td width='100%'>
                            <input type="text" name="shout" style="width: 90%" class="bginput" />
                        </td>
                        <td style='white-space:nowrap' width='1%'>
                            <input type="submit" value="Shout" class="button" />
                            <if condition="$vboptions[shout_extra_options]">
                            <input type='button' class='button' value='Clear' onclick='sb_Clear()' />
                            <input type='button' class='button' value='Smilies' onclick='sb_Smilies(this)' />
                            <input type='button' class='button' style='font-weight:bold' value='B' onclick='sb_PropChange_Button(this, "fontWeight")' />
                            <input type='button' class='button' style='text-decoration:underline' value='U' onclick='sb_PropChange_Button(this, "textDecoration")' />
                            <input type='button' class='button' style='font-style:italic' value='I' onclick='sb_PropChange_Button(this, "fontStyle")' />
                            <select name='font_color' onchange='sb_PropChange(this, "color")'>
                                {$DropDowns['color_selector']}
                            </select>
                            <select name='font_selector' onchange='sb_PropChange(this, "fontFamily")'>
                                {$DropDowns['font_selector']}
                            </select>
                            </if>
                        </td>
                    </tr>
                    </table>
                    </if>
                </if>
                </td>
            </tr>
        </tbody>
        </table>


</form>
<br />

<script type='text/javascript'>
<!--

postingShout = false

function requestShouts()
{
    if (!postingShout)
    {
        ShoutRequest = new vB_AJAX_Handler(true)
        ShoutRequest.onreadystatechange(showShouts)
        ShoutRequest.send('vbshout.php', 'nocache=' + (5 * Math.random() * 1.33) )
    }
}

function showShouts()
{
    if (ShoutRequest)
    {
        if (ShoutRequest.handler.readyState == 4 && ShoutRequest.handler.status == 200 && ShoutRequest.handler.responseText)
        {
            Shouts           = fetch_object('vbshout')
            Shouts.innerHTML = '<table cellpadding="1" cellspacing="3" border="0" width="95%" align="left">' + ShoutRequest.handler.responseText + '</table>'
            setTimeout('requestShouts()', 10000)
            <if condition="$vboptions[shout_messages_order]">
            document.getElementById('vbshout').scrollTop = 99999;
            </if>
        }
    }
}

function sb_CollectHV(sbForm)
{
    rString = ''
    inputObjs = sbForm.getElementsByTagName('input')
    for (i = 0; i < inputObjs.length; i++)
    {
        if (inputObjs[i].type == 'hidden' && inputObjs[i].value != '')
        {
            rString += '&' + inputObjs[i].name + '=' + PHP.urlencode(inputObjs[i].value)
        }
    }

    return rString
}

function postShout(formObj)
{
    doShout = new vB_AJAX_Handler(true)
    doShout.onreadystatechange(postedShout)

    if (postingShout)
    {
        alert('Posting in progress..')
        return false
    }

    Shout = formObj.shout.value

    if (Shout.replace(/ /g, '') == '')
    {
        alert('You must enter a shout!')
        return false
    }

    doShout.send('vbshout.php', 'do=shout&shout=' + PHP.urlencode(Shout) + sb_CollectHV(document.forms['vbshoutform']))
    sb_Clear()
    postingShout = true

    return false
}

function postedShout()
{
    if (doShout.handler.readyState == 4 && doShout.handler.status == 200)
    {
        postingShout = false
        requestShouts()
    }
}

function sb_Input_SC(sProperty, setting)
{
    eval('document.forms["vbshoutform"].shout.style.' + sProperty + ' = "' + setting + '"')
    eval('document.forms["vbshoutform"].' + sProperty + '.value = "' + setting + '"')
}

function getSelectionValue(eSelector)
{
    return eSelector.options[eSelector.options.selectedIndex].value == 'Default' ? '' : eSelector.options[eSelector.options.selectedIndex].value
}

function sb_PropChange(eSelector, sProperty)
{
    sb_Input_SC(sProperty, getSelectionValue(eSelector))
}

function sb_PropChange_Button_Value(sProperty)
{
    trueValue = ''
    switch (sProperty)
    {
        case 'fontWeight':
        falseValue = 'bold'
        break;

        case 'textDecoration':
        falseValue = 'underline'
        break;

        case 'fontStyle':
        falseValue = 'italic'
        break;
    }

    return (eval('document.forms["vbshoutform"].' + sProperty + '.value'))? trueValue : falseValue
}

function sb_PropChange_Button(cButton, sProperty)
{
    if (cButton.value.match(/\*/))
    {
        cButton.value = cButton.value.replace(/\s+\*/, '')
    }
    else
    {
        cButton.value = cButton.value + ' *'
    }

    sb_Input_SC(sProperty, sb_PropChange_Button_Value(sProperty))
}

function sb_Smilie(code)
{
    document.forms["vbshoutform"].shout.value += ' ' + code
    return false
}

function sb_Clear()
{
    document.forms["vbshoutform"].shout.value = ''
    return true;
}

function sb_Smilies(cButton)
{
    if (cButton.value.match(/\*/))
    {
        cButton.value = cButton.value.replace(/\s+\*/, '')
    }
    else
    {
        cButton.value = cButton.value + ' *'
    }
    
    document.getElementById('shout_emo').style.display = (document.getElementById('shout_emo').style.display == 'none')? '' : 'none'
}

requestShouts()

-->
</script> 
Reply With Quote
  #2  
Old 03-24-2006, 10:03 AM
RS_Jelle RS_Jelle is offline
 
Join Date: Jul 2005
Posts: 1,276
Благодарил(а): 0 раз(а)
Поблагодарили: 1 раз в 1 сообщении
Default

Your conditional is wrong

This one should work:
Code:
<if condition="$bbuserinfo[posts]>1">
$vbphrase[x_posts_per_day] is a phrase, it's text: {1} posts per day.
Reply With Quote
  #3  
Old 03-24-2006, 10:06 AM
merk merk is offline
 
Join Date: Nov 2001
Location: Canberra, Australia
Posts: 601
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It is more complex than that - youll need to derive the number of days the user has been registered for in a plugin, and divide their posts by that number.

He wants activity, not number of posts.
Reply With Quote
  #4  
Old 03-24-2006, 12:55 PM
RS_Jelle RS_Jelle is offline
 
Join Date: Jul 2005
Posts: 1,276
Благодарил(а): 0 раз(а)
Поблагодарили: 1 раз в 1 сообщении
Default

Indeed, that's also my opinion, but I only solved his problem with the conditional, so one post is necessary for viewing the shout box.

If you really want something for activity, you can use this (without plugins):
Code:
<if condition="$headerstime - 1209600 < $bbuserinfo[lastpost]">
With this conditional, the shout box is hidden for people who haven't posted for 14 days.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 08:40 AM.


Powered by vBulletin® Version 3.9.0
Copyright ©2000 - 2017, vBulletin Solutions Inc.