vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.7 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=228)
-   -   Show Thread Enhancements - Graffiti: Anonymous Thread Commentary (https://vborg.vbsupport.ru/showthread.php?t=266150)

nerbert 07-01-2011 09:00 PM

Graffiti: Anonymous Thread Commentary
 
When I first enabled tagging I made the mistake of allowing any member to add tags. Well, it quickly turned into a feature for commentary on the thread and the original purpose was lost. Graffiti allows users to anonymously post short comments on threads and posts. Admins and moderators can see the names though. Control panel sets various limits, permissions and banning.

This was developed for vB 3.7.3. but I would think it would work in later vB3 versions. Let me know if it does.

Control panel:
  • On/off
  • Maximum Entries Per Thread
  • Maximum Characters per Entry
  • Excluded Forums
  • Usergroups Not Allowed To View Graffiti
  • Usergroups Not Allowed To Post In Graffiti
  • Show User Names
  • Groups Allowed To See Names
  • Banned Users

Installation: Download the xml file and upload to Products. In the SHOWTHREAD template locate <!-- social bookmarking links --> and just above it modify as shown:

HTML Code:

$spacer_close
</form>
$spacer_open
</if>
<!--######################### Graffiti ###########################-->
$graffiti
<if condition="$bookmarksites">
<!-- social bookmarking links -->

you can probably place it elsewhere but be sure it's not inside another form.

Curious Too 07-12-2011 12:00 PM

Doesn't quite work on 3.8.6. See the attachment. Also, the option to limit the number of graffiti per thread does not show in the admincp.

nerbert 07-13-2011 12:01 PM

Quote:

Originally Posted by Curious Too (Post 2219634)
Doesn't quite work on 3.8.6. See the attachment. Also, the option to limit the number of graffiti per thread does not show in the admincp.

OK, found the problem. Overwrite with the new file and it should work.

I can't promise this will work in vB3.8, I skipped over 3.8 and am upgrading to vB4.

Curious Too 07-16-2011 09:54 PM

I was able to add graffiti, thank you. But another problem popped up:

No thread specified. If you followed a valid link, please notify the administrator

This message started appearing when people tried to reply to or visit certain threads.

I have a 3.8 test server if that would help.

nerbert 07-17-2011 01:28 PM

It works in 3.7.3 and 4.1.4 with some changes, so I'm not sure why it wasn't working in 3.8.6.

I've modified the main plug-in and it still works in 3.7.3 and I think it should solve the problem.

Go to Plug-in Manager, find "Graffiti main", clear it out and paste in this:

PHP Code:

$vbulletin->input->clean_array_gpc('r', array(
    
'bit'                   => TYPE_NOHTML,
    
'threadid'              => TYPE_INT
));
//$threadid       = $vbulletin->GPC['threadid'];
$userid     $vbulletin->userinfo['userid'];
$username     $vbulletin->userinfo['username'];
$bitlimit     $vbulletin->options['graffiti_max_entries'];
$charlimit     $vbulletin->options['graffiti_max_chars'];
$show_name    $vbulletin->options['graffiti_showname'];
$showname_group explode(','$vbulletin->options['graffiti_showname_group']);
$bit        $vbulletin->GPC['bit'];
//$bit         = substr(convert_urlencoded_unicode($bit), 0, $charlimit);
$bit            htmlentities(substr(html_entity_decode($bit), 0$charlimit));
$bit            '<strong>' $username ': </strong>' $bit;
$bit         addslashes(convert_urlencoded_unicode($bit));

function 
select_graffiti()
{
    global 
$threadid$userid$username;
    global 
$userstr$countstr$graffiti_text;
    global 
$vbulletin;
    
$db $vbulletin->db;

    
$result =
    
$db->query_read  ("
                SELECT *
                FROM " 
TABLE_PREFIX "graffiti
                WHERE threadid = '
$threadid'    
            "
)or die(mysql_error());
    
$graffiti     $db->fetch_array($result);
    
$graffiti_text    $graffiti['string'];
    
$userstr    $graffiti['users'];
    
$countstr    $graffiti['counts'];

}
  
function 
insert_graffiti($bit)
{
    global 
$threadid$userid$username,  $bit;
    global 
$vbulletin;
    
$db $vbulletin->db;    
    
    
$db->query_write  ("
                INSERT INTO " 
TABLE_PREFIX "graffiti
                (
                    threadid, 
                    users, 
                    counts, 
                    string 
                )
                VALUES 
                (
                    '
$threadid',
                    '
$userid',
                    '1',
                    '
$bit'
                )
            "
)or die(mysql_error());
}

function 
update_graffiti()
{
    global 
$threadid$userid,  $username;
    global 
$userstr$countstr$graffiti_text;
    global 
$vbulletin;
    
$db $vbulletin->db;
    
$db->query_write  ("
                UPDATE " 
TABLE_PREFIX "graffiti
                SET  
                    users         = '
$userstr', 
                    counts         = '
$countstr', 
                    string         = '
$graffiti_text'
                WHERE 
                    threadid     = '
$threadid'
            "
)or die(mysql_error());
}
function 
add_graffiti()
{
    global 
$bitlimit$charlimit;
    global 
$userid$threadid$bit;
    global 
$userstr$countstr$graffiti_text$show_name$showname_group;
    global 
$vbulletin;
    
$db $vbulletin->db;
    
select_graffiti();
    
$userarray explode(","$userstr);
    
$count 0;
    
$ii = -1;
    for(
$i 0$i count($userarray); $i++)
    {
        if(
$userid == $userarray[$i]) $ii $i;
        
$count $countarray[$ii];
    }
    
$countarray explode(","$countstr);


    if(
$graffiti_text == NULL)
    {
        
insert_graffiti($bit);
        
$bit stripslashes($bit);
        
$return $bit;
    }
    else
    {
        
$graffiti_text $db->escape_string($graffiti_text); 
        
$graffiti_text .= ' ? ' $bit;
        if(
$ii == -1)
        { 
            
$countarray[] = 1;
            
$userarray[] = $userid;
        }
        else
        {
            
$countarray[$ii]++;
        }
        
$countstr     implode(','$countarray);
        
$userstr     implode(','$userarray);
        if(
$countarray[$ii] <= $bitlimitupdate_graffiti();
        
$return stripslashes($graffiti_text);    
    }
    
$showname1;
    if(!(
$show_name == OR in_array($vbulletin->userinfo['usergroupid'], $showname_group)))
    {
        
$return preg_replace('/<strong>[^>]+<\/strong>/'''$return);
        
$showname 0;
    }
    return 
$return;    
}
if(
$_REQUEST['do'] == 'addnew'
{
$threadid       $vbulletin->GPC['threadid'];
    
$return add_graffiti();
        die(
$return);
}
elseif(
$vbulletin->options['graffiti_onoff'] == 1
AND !in_array($vbulletin->userinfo['usergroupid'],explode(',',$vbulletin->options['graffiti_no_show']))
AND !
in_array($forumidexplode(','$vbulletin->options['graffiti_forum_noshow'])))
{
    
select_graffiti();
    
$showname 1;
    if(!(
$show_name == OR in_array($vbulletin->userinfo['usergroupid'], $showname_group)))
    {
        
$graffiti_text preg_replace('/<strong>[^>]+<\/strong>/'''$graffiti_text);
        
$showname 0;
    }
    
$usercounts array_combine(explode(','$userstr), explode(','$countstr));
    
$count 0;
    if(
$usercounts[$userid]) {$count $usercounts[$userid];}
    
$bitlimit $vbulletin->options['graffiti_max_entries'] - $count;
    
$inputdisplay '';
    if(
$bitlimit == 0
    
OR $vbulletin->userinfo['usergroupid'] == 1
    
OR in_array($vbulletin->userinfo['usergroupid'], explode(',',$vbulletin->options['graffiti_no_post']))
    OR 
in_array($vbulletin->userinfo['userid'],explode(',',$vbulletin->options['graffiti_banned'])))
    {
$inputdisplay 'none';}         
    eval(
'$graffiti = "' fetch_template('graffiti') . '";');


Let me know if it works and I will upload a cleaned up version and you can overwrite the present one.

nerbert 07-17-2011 01:57 PM

Curious Too, do you have any other modifications on the page? It's possible something else is interfering with Graffiti.

Curious Too 07-17-2011 03:26 PM

I copied and pasted the main plugin code and it seems to be working. Only think lacking at this point is the ability to edit/delete a users graffiti and maybe use html markup like the post thanks mod.

nerbert 07-17-2011 05:18 PM

Quote:

Originally Posted by Curious Too (Post 2221518)
I copied and pasted the main plugin code and it seems to be working. Only think lacking at this point is the ability to edit/delete a users graffiti and maybe use html markup like the post thanks mod.

I uploaded a tidied up version of the XML file so you can overwrite the earlier one.

Editing and deleting entries would require a complete overhaul. The entire content of the Graffiti box for each thread is stored as one long string. When a user adds another entry the whole string is fetched from the database, the new entry is added at the end and the string is put back in the database. To edit or delete, each entry would have to be stored separately and the content for each thread would have to be assembled each time a thread is viewed or a new Graffiti entry is posted. Way too complicated!

But anyway I thank you for your feedback and help with testing, and if you have any more problems let me know.


All times are GMT. The time now is 10:34 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.02388 seconds
  • Memory Usage 1,810KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_html_printable
  • (1)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete