Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.7 > vBulletin 3.7 Add-ons
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Graffiti: Anonymous Thread Commentary Details »»
Graffiti: Anonymous Thread Commentary
Version: 1.00, by nerbert nerbert is offline
Developer Last Online: Aug 2017 Show Printable Version Email this Page

Category: Show Thread Enhancements - Version: 3.7.3 Rating:
Released: 07-01-2011 Last Update: 07-16-2011 Installs: 2
Uses Plugins Template Edits
Translations  
No support by the author.

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.

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.
Благодарность от:
Sayid

Comments
  #2  
Old 07-12-2011, 01:00 PM
Curious Too Curious Too is offline
 
Join Date: Jun 2006
Posts: 29
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #3  
Old 07-13-2011, 01:01 PM
nerbert nerbert is offline
 
Join Date: May 2008
Posts: 784
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Curious Too View Post
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.
Reply With Quote
  #4  
Old 07-16-2011, 10:54 PM
Curious Too Curious Too is offline
 
Join Date: Jun 2006
Posts: 29
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #5  
Old 07-17-2011, 02:28 PM
nerbert nerbert is offline
 
Join Date: May 2008
Posts: 784
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #6  
Old 07-17-2011, 02:57 PM
nerbert nerbert is offline
 
Join Date: May 2008
Posts: 784
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Curious Too, do you have any other modifications on the page? It's possible something else is interfering with Graffiti.
Reply With Quote
  #7  
Old 07-17-2011, 04:26 PM
Curious Too Curious Too is offline
 
Join Date: Jun 2006
Posts: 29
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #8  
Old 07-17-2011, 06:18 PM
nerbert nerbert is offline
 
Join Date: May 2008
Posts: 784
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Curious Too View Post
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.
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 07:07 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.08744 seconds
  • Memory Usage 2,350KB
  • Queries Executed 23 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)bbcode_html
  • (1)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (1)post_thanks_box_bit
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (8)post_thanks_postbit_info
  • (7)postbit
  • (8)postbit_onlinestatus
  • (8)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete