nerbert
07-01-2011, 10:00 PM
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:
$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, 01: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, 01:01 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.
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, 10: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, 02: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:
$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] <= $bitlimit) update_graffiti();
$return = stripslashes($graffiti_text);
}
$showname= 1;
if(!($show_name == 1 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($forumid, explode(',', $vbulletin->options['graffiti_forum_noshow'])))
{
select_graffiti();
$showname = 1;
if(!($show_name == 1 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, 02: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, 04: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, 06:18 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.
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.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.