Search Results for 'code'
-
AuthorSearch Results
-
July 27, 2007 at 2:03 pm #2172
Topic: how can i define a .mo file for a plugin
in forum Troubleshootingmazdakam
Memberi translate some plugins and have mo files but i don’t know how to define them to work?!
i translate 22 bbpress plugins
should i insert them in to the include/language folder?
with which name or i must create one file and merge whole of them to he one file
July 27, 2007 at 12:04 pm #59335In reply to: super beginner :)
warmechoco
Memberand euhm.. “not even tried” .. That ‘s not true at all.. see my subject
, but ok thanks anyway
July 27, 2007 at 11:47 am #51051In reply to: can’t receive the password letter!!!!!!!!
jackhsieh
MemberHere below is the workable method for the purpose of trying bbpress. To hide the mail() function code and then add a echo() to show the password on-screen. Like below…
(registration-functions.php)
echo (‘Your Password:’ . “$pass”);
/*
mail( bb_get_user_email( $user->ID ), bb_get_option(‘name’) . ‘: ‘ . __(‘Password’),
sprintf( $message, “$user->user_login”, “$pass”, bb_get_option(‘uri’) ),
‘From: ‘ . bb_get_option(‘admin_email’)
*/
July 27, 2007 at 10:34 am #2170Topic: Plugins SVN Problem
in forum TroubleshootingLMD
ParticipantThere appears to be a problem with the SVN for plugins.
I’ve had a user who downloaded the latest version of Avatar Upload, only to find the contents of sub-folders to be empty — even though the files are present in the repository when I browsed source in Trac (in both the Trunk AND latest Tag). Somehow they are missing in the automated ZIP download.
The file structure is:
trunk/ (and also 'tags/0.7/')
additional-files/
avatars/ (contents missing in the ZIP)
my-templates/ (ditto)
.Is this a one-off blip or is it a bug? Either way, can it be fixed?
July 27, 2007 at 10:04 am #59239In reply to: Plugin: Plugin browser for bbPress
Sam Bauers
ParticipantGah! In 0.1.9 I changed all the version numbers but didn’t actually change the code!
0.1.10 is now committed, and *it* will fix your problem.
July 27, 2007 at 7:33 am #54080In reply to: Automatically add user topics to favorites
_ck_
ParticipantAutomatically adding a user’s new topic to their own favorites is as simple as this plugin. I’ve unhooked the notification plugin so users don’t get emailed for their own new topics starting.
<?php
/*
* Plugin Name: User Topics To Favorites
* Plugin Description: automatically adds new topics created by a user to their favorites
* Author: _ck_
* Author URI: http://CKon.wordpress.com
* Plugin URI: http://CKon.wordpress.com
* Version: 0.1
*/
function user_topics_to_favorites($topic_id) {
remove_action('bb_new_post', 'notification_new_post'); // don't email users about their new topic
$topic = get_topic( get_topic_id( $topic_id ) ); // fetch topic poster's id
bb_add_user_favorite( $topic->topic_poster, $topic_id );
}
add_action('bb_new_topic', 'user_topics_to_favorites');
?>July 27, 2007 at 4:15 am #59406In reply to: forum.wp-persian.com
mazdakam
MemberI noticed the “support forum” plugin was outputting english strings in your forum. I have just updated the plugin to use gettext on all the strings that weren’t using it. So if you want full translation it is now available (you will need to modify your language files to add the strings).
yes you are right. i was busy for configuring the plugins now i am free for translating plugins languages
so i have my bbpress full translating where can i upload it?
i eamil it to the mailing list but i got no reply
July 27, 2007 at 4:11 am #59405In reply to: forum.wp-persian.com
mazdakam
MemberWill it have bbPress support as well
not yet for bbpress we use bbpress for support wp persian.
but i am thinking to lunch support forum for bbpress
i need to consult with my friends in wp persian team
July 27, 2007 at 2:40 am #49631In reply to: Emoticons For bbPress?
mazdakam
MemberPlease stop pasting huge chunks of code on the forums. Use something like http://pastebin.ca/.
ok i will do
listen i want to tell you somthing important
i downloaded bbEmoticons-0.72 and unpacked it and then send it to my plugin then i go to my admin and try to active it but it show fattal error my bbpress is .8.2.1
so i tried to download 6th and every time it didnt active!
now i come and copy the code form here and open new file in php and save it then try to upload it and active it
it get active and work! what is wrong?
do you test bbEmoticons-0.72 from the original download address i think there is somthing wrong in the original file
please try it once for me
July 27, 2007 at 12:16 am #49630In reply to: Emoticons For bbPress?
fel64
MemberPlease stop pasting huge chunks of code on the forums. Use something like http://pastebin.ca/.
That code runs fine for me. What problem are you having?
It might be simplest to start off with the original plugin and fix that because you might have done quite a lot to it.
July 26, 2007 at 11:50 pm #49628In reply to: Emoticons For bbPress?
mazdakam
Member<?php
/*
Plugin Name: bbEmoticons
Plugin URI:
Description: A Clickable Smilies hack for bbPress. Thanks to kohaku and aka. Original WP Grins by Alex King.
Author: hiromasa
Author URI: http://hiromasa.zone.ne.jp/blog/
Version: 0.72
*/
/******************************************************************************
* bbEmoticons version 0.72
*
* A Clickable Smilies hack for bbPress.
*
* @Author hiromasa (http://hiromasa.zone.ne.jp/blog/)
* @Thanks kohaku (http://www.orioa.com/)
* aka (http://plasticdreams.org/)
* @Original WP Grins By Alex King
* (http://www.alexking.org/software/wordpress/)
* WordPress convert_smilies function and images
*****************************************************************************/
/* Copyright 2006 hiromasa (email : webmaster@hiromasa.zone.ne.jp)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/******************************************************************************
* bbEmoticons
*
* @author hiromasa
* @version 0.72
*
*****************************************************************************/
class bbEmoticons {
var $bb_grins;
var $bb_smiliessearch = array();
var $bb_smiliesreplace = array();
/**
* The Constructor
*
* @param none
* @return none
*/
function bbEmoticons() {
if (isset($_GET)) {
switch ($_GET) {
case “javascript”:
$this->outputGringJS();
}
exit(0);
}
$bb_smiliestrans = array(
‘
‘ => ‘icon_smile.gif’,
‘
‘ => ‘icon_biggrin.gif’,
‘
‘ => ‘icon_biggrin.gif’,
‘:grin:’ => ‘icon_biggrin.gif’,
‘
‘ => ‘icon_smile.gif’,
‘
‘ => ‘icon_smile.gif’,
‘:smile:’ => ‘icon_smile.gif’,
‘
‘ => ‘icon_sad.gif’,
‘
‘ => ‘icon_sad.gif’,
‘:sad:’ => ‘icon_sad.gif’,
‘ :o’ => ‘icon_surprised.gif’,
‘ :-o’ => ‘icon_surprised.gif’,
‘:eek:’ => ‘icon_surprised.gif’,
‘ 8O’ => ‘icon_eek.gif’,
‘ 8-O’ => ‘icon_eek.gif’,
‘:shock:’ => ‘icon_eek.gif’,
‘
‘ => ‘icon_confused.gif’,
‘
‘ => ‘icon_confused.gif’,
‘
??:’ => ‘icon_confused.gif’,
‘
‘ => ‘icon_cool.gif’,
‘
‘ => ‘icon_cool.gif’,
‘:cool:’ => ‘icon_cool.gif’,
‘:lol:’ => ‘icon_lol.gif’,
‘ :x’ => ‘icon_mad.gif’,
‘ :-x’ => ‘icon_mad.gif’,
‘:mad:’ => ‘icon_mad.gif’,
‘
‘ => ‘icon_razz.gif’,
‘
‘ => ‘icon_razz.gif’,
‘:razz:’ => ‘icon_razz.gif’,
‘:oops:’ => ‘icon_redface.gif’,
‘:cry:’ => ‘icon_cry.gif’,
‘:evil:’ => ‘icon_evil.gif’,
‘:twisted:’ => ‘icon_twisted.gif’,
‘:roll:’ => ‘icon_rolleyes.gif’,
‘:wink:’ => ‘icon_wink.gif’,
‘
‘ => ‘icon_wink.gif’,
‘
‘ => ‘icon_wink.gif’,
‘:!:’ => ‘icon_exclaim.gif’,
‘
:’ => ‘icon_question.gif’,
‘:idea:’ => ‘icon_idea.gif’,
‘:arrow:’ => ‘icon_arrow.gif’,
‘
‘ => ‘icon_neutral.gif’,
‘
‘ => ‘icon_neutral.gif’,
‘:neutral:’ => ‘icon_neutral.gif’,
‘:mrgreen:’ => ‘icon_mrgreen.gif’,
);
foreach($bb_smiliestrans as $smiley => $img) {
$this->bb_smiliessearch[] = $smiley;
$smiley_masked = htmlspecialchars(trim($smiley), ENT_QUOTES);
$this->bb_smiliesreplace[] =
” <img src='” . bb_get_option(‘uri’) .
“bb-images/smilies/$img’ alt=’$smiley_masked’ class=’wp-smiley’ /> “;
}
$this->grins = ”;
$smiled = array();
foreach ($bb_smiliestrans as $tag => $grin) {
if (!in_array($grin, $smiled)) {
$smiled[] = $grin;
$tag = str_replace(‘ ‘, ”, $tag);
$this->grins .=
‘<img src=”‘. bb_get_option(‘uri’) .
‘bb-images/smilies/’.$grin.'” alt=”‘ .$tag .
‘” onclick=”grin(‘ ‘.$tag.”);”/> ‘;
}
}
}
/**
* post_text filter
*
* @param $text
* @return $output
*/
function convert_smilies($text) {
$output = ”;
$textarr = preg_split(“/(<.*>)/U”, $text, -1, PREG_SPLIT_DELIM_CAPTURE);
$stop = count($textarr);
for($i=0; $i<$stop; $i++) {
$content = $textarr[$i];
if((strlen($content) > 0) && (‘<‘ != $content{0})) {
$content = str_replace(
$this->bb_smiliessearch,
$this->bb_smiliesreplace,
$content);
}
$output .= $content;
}
return $output;
}
/**
* bb_grins action
*
* @param none
* @return none
*/
function bb_grins() {
echo ‘<div id=”bb_grins”>’ . $this->grins . ‘</div>’;
}
/**
* bb_head action
*
* @param none
* @return none
*/
function bb_grins_head() {
echo
‘<script type=”text/javascript” src=”‘. bb_get_option(‘uri’) .
‘my-plugins/bb-emoticons.php?bb_grins_output=javascript”></script>’ .
“n”;
}
/**
* Output Grins JavaScript
*
* @param none
* @return none
*/
function outputGringJS() {
?>
function grin(tag) {
var myField;
if (document.getElementById(‘post_content’) && document.getElementById(‘post_content’).type == ‘textarea’) {
myField = document.getElementById(‘post_content’);
}
else if (document.getElementById(‘comment’) && document.getElementById(‘comment’).type == ‘textarea’) {
myField = document.getElementById(‘comment’);
}
else {
return false;
}
if (document.selection) {
myField.focus();
sel = document.selection.createRange();
sel.text = tag;
myField.focus();
}
else if (myField.selectionStart || myField.selectionStart == ‘0’) {
var startPos = myField.selectionStart;
var endPos = myField.selectionEnd;
var cursorPos = endPos;
myField.value = myField.value.substring(0, startPos)
+ tag
+ myField.value.substring(endPos, myField.value.length);
cursorPos += tag.length;
myField.focus();
myField.selectionStart = cursorPos;
myField.selectionEnd = cursorPos;
}
else {
myField.value += tag;
myField.focus();
}
}
<?php
}
}
/******************************************************************************
* – Define for bbPress interface
*****************************************************************************/
$bbemoticons = & new bbEmoticons();
bb_add_filter(‘post_text’, array(&$bbemoticons, ‘convert_smilies’));
//bb_head is not called always.
//bb_add_action(‘bb_head’, array(&$bbemoticons, ‘bb_grins_head’));
bb_add_action(‘bb_feed_head’, array(&$bbemoticons, ‘bb_grins_head’));
bb_add_action(‘bb_grins’, array(&$bbemoticons, ‘bb_grins’));
?>
July 26, 2007 at 10:48 pm #49627In reply to: Emoticons For bbPress?
fel64
MemberDid you modify the plugin? Insert a
?>
before line 202 and a<?php
before line 237.In Notepad you can go to a specific line by pressing Ctrl + G.
July 26, 2007 at 10:35 pm #49625In reply to: Emoticons For bbPress?
mazdakam
Member<?php
/*
Plugin Name: bbEmoticons
Plugin URI:
Description: A Clickable Smilies hack for bbPress. Thanks to kohaku and aka. Original WP Grins by Alex King.
Author: hiromasa
Author URI: http://hiromasa.zone.ne.jp/blog/
Version: 0.72
*/
/******************************************************************************
* bbEmoticons version 0.72
*
* A Clickable Smilies hack for bbPress.
*
* @Author hiromasa (http://hiromasa.zone.ne.jp/blog/)
* @Thanks kohaku (http://www.orioa.com/)
* aka (http://plasticdreams.org/)
* @Original WP Grins By Alex King
* (http://www.alexking.org/software/wordpress/)
* WordPress convert_smilies function and images
* (https://wordpress.org/)
*****************************************************************************/
/* Copyright 2006 hiromasa (email : webmaster@hiromasa.zone.ne.jp)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/******************************************************************************
* bbEmoticons
*
* @author hiromasa
* @version 0.72
*
*****************************************************************************/
class bbEmoticons {
var $bb_grins;
var $bb_smiliessearch = array();
var $bb_smiliesreplace = array();
/**
* The Constructor
*
* @param none
* @return none
*/
function bbEmoticons() {
if (isset($_GET)) {
switch ($_GET) {
case “javascript”:
$this->outputGringJS();
}
exit(0);
}
$bb_smiliestrans = array(
‘
‘ => ‘icon_smile.gif’,
‘
‘ => ‘icon_biggrin.gif’,
‘
‘ => ‘icon_biggrin.gif’,
‘:grin:’ => ‘icon_biggrin.gif’,
‘
‘ => ‘icon_smile.gif’,
‘
‘ => ‘icon_smile.gif’,
‘:smile:’ => ‘icon_smile.gif’,
‘
‘ => ‘icon_sad.gif’,
‘
‘ => ‘icon_sad.gif’,
‘:sad:’ => ‘icon_sad.gif’,
‘ :o’ => ‘icon_surprised.gif’,
‘ :-o’ => ‘icon_surprised.gif’,
‘:eek:’ => ‘icon_surprised.gif’,
‘ 8O’ => ‘icon_eek.gif’,
‘ 8-O’ => ‘icon_eek.gif’,
‘:shock:’ => ‘icon_eek.gif’,
‘
‘ => ‘icon_confused.gif’,
‘
‘ => ‘icon_confused.gif’,
‘
??:’ => ‘icon_confused.gif’,
‘
‘ => ‘icon_cool.gif’,
‘
‘ => ‘icon_cool.gif’,
‘:cool:’ => ‘icon_cool.gif’,
‘:lol:’ => ‘icon_lol.gif’,
‘ :x’ => ‘icon_mad.gif’,
‘ :-x’ => ‘icon_mad.gif’,
‘:mad:’ => ‘icon_mad.gif’,
‘
‘ => ‘icon_razz.gif’,
‘
‘ => ‘icon_razz.gif’,
‘:razz:’ => ‘icon_razz.gif’,
‘:oops:’ => ‘icon_redface.gif’,
‘:cry:’ => ‘icon_cry.gif’,
‘:evil:’ => ‘icon_evil.gif’,
‘:twisted:’ => ‘icon_twisted.gif’,
‘:roll:’ => ‘icon_rolleyes.gif’,
‘:wink:’ => ‘icon_wink.gif’,
‘
‘ => ‘icon_wink.gif’,
‘
‘ => ‘icon_wink.gif’,
‘:!:’ => ‘icon_exclaim.gif’,
‘
:’ => ‘icon_question.gif’,
‘:idea:’ => ‘icon_idea.gif’,
‘:arrow:’ => ‘icon_arrow.gif’,
‘
‘ => ‘icon_neutral.gif’,
‘
‘ => ‘icon_neutral.gif’,
‘:neutral:’ => ‘icon_neutral.gif’,
‘:mrgreen:’ => ‘icon_mrgreen.gif’,
);
foreach($bb_smiliestrans as $smiley => $img) {
$this->bb_smiliessearch[] = $smiley;
$smiley_masked = htmlspecialchars(trim($smiley), ENT_QUOTES);
$this->bb_smiliesreplace[] =
” <img src='” . bb_get_option(‘uri’) .
“bb-images/smilies/$img’ alt=’$smiley_masked’ class=’wp-smiley’ /> “;
}
$this->grins = ”;
$smiled = array();
foreach ($bb_smiliestrans as $tag => $grin) {
if (!in_array($grin, $smiled)) {
$smiled[] = $grin;
$tag = str_replace(‘ ‘, ”, $tag);
$this->grins .=
‘<img src=”‘. bb_get_option(‘uri’) .
‘bb-images/smilies/’.$grin.'” alt=”‘ .$tag .
‘” onclick=”grin(‘ ‘.$tag.”);”/> ‘;
}
}
}
/**
* post_text filter
*
* @param $text
* @return $output
*/
function convert_smilies($text) {
$output = ”;
$textarr = preg_split(“/(<.*>)/U”, $text, -1, PREG_SPLIT_DELIM_CAPTURE);
$stop = count($textarr);
for($i=0; $i<$stop; $i++) {
$content = $textarr[$i];
if((strlen($content) > 0) && (‘<‘ != $content{0})) {
$content = str_replace(
$this->bb_smiliessearch,
$this->bb_smiliesreplace,
$content);
}
$output .= $content;
}
return $output;
}
/**
* bb_grins action
*
* @param none
* @return none
*/
function bb_grins() {
echo ‘<div id=”bb_grins”>’ . $this->grins . ‘</div>’;
}
/**
* bb_head action
*
* @param none
* @return none
*/
function bb_grins_head() {
echo
‘<script type=”text/javascript” src=”‘. bb_get_option(‘uri’) .
‘my-plugins/bb-emoticons.php?bb_grins_output=javascript”></script>’ .
“n”;
}
/**
* Output Grins JavaScript
*
* @param none
* @return none
*/
function outputGringJS() {
function grin(tag) {
var myField;
if (document.getElementById(‘post_content’) && document.getElementById(‘post_content’).type == ‘textarea’) {
myField = document.getElementById(‘post_content’);
}
else if (document.getElementById(‘comment’) && document.getElementById(‘comment’).type == ‘textarea’) {
myField = document.getElementById(‘comment’);
}
else {
return false;
}
if (document.selection) {
myField.focus();
sel = document.selection.createRange();
sel.text = tag;
myField.focus();
}
else if (myField.selectionStart || myField.selectionStart == ‘0’) {
var startPos = myField.selectionStart;
var endPos = myField.selectionEnd;
var cursorPos = endPos;
myField.value = myField.value.substring(0, startPos)
+ tag
+ myField.value.substring(endPos, myField.value.length);
cursorPos += tag.length;
myField.focus();
myField.selectionStart = cursorPos;
myField.selectionEnd = cursorPos;
}
else {
myField.value += tag;
myField.focus();
}
}
}
}
/******************************************************************************
* – Define for bbPress interface
*****************************************************************************/
$bbemoticons = & new bbEmoticons();
bb_add_filter(‘post_text’, array(&$bbemoticons, ‘convert_smilies’));
//bb_head is not called always.
//bb_add_action(‘bb_head’, array(&$bbemoticons, ‘bb_grins_head’));
bb_add_action(‘bb_feed_head’, array(&$bbemoticons, ‘bb_grins_head’));
bb_add_action(‘bb_grins’, array(&$bbemoticons, ‘bb_grins’));
?>
July 26, 2007 at 7:50 pm #59437fel64
MemberMeh, even if that didn’t work, code like it can work. I don’t know how the signature plugin works but the capability to do it _is_ in the core.
July 26, 2007 at 7:29 pm #59436ganzua
MemberIt didn’t work
It reports errors whenever the template calls the signature.
Perhaps this kind of stuff should be included in the core.
July 26, 2007 at 6:52 pm #59435fel64
MemberCode like this:
add_filter('get_profile_info_keys', 'add_sig_key');
function add_sig_key( $keys ) {
$keys['sig'] = array(0, __('Signature'));
}Just add that to the plugin file. It should probably work, but it’s a bit of a guess.
Much better to do it this way with a plugin than editing core files, too.
July 26, 2007 at 6:39 pm #59434ganzua
MemberHi fel64!
(my computer died almost one month ago and now I am where I left then
)
“Just use the filter get_profile_info_keys instead.”
-> what do you mean? adding that function to functions.php?
In the previous bb press version and in order to make signature plugin to work, you needed to add this in functions.php;
“find the get_profile_info_keys() function, which should be on or around line 1761. In the line that starts with array(‘user_email’…, add the following code before the last “)” in the line. Note the comma.
, ‘sig’ => array(0, __(‘Signature’))
This will add the signature field to the profile edit page, enabling users to input their own signatures.”
Now there is no such function in functions.php
July 26, 2007 at 6:25 pm #59433fel64
MemberI duno. Just use the filter
get_profile_info_keys
instead.July 26, 2007 at 6:17 pm #59431In reply to: not getting pagination links on forum pages
fel64
MemberShould be interesting to see how they fix that.
Surely they’d just have to reset $forum at the end of the loop to the actual forum? Or if you’ve got the loop there yourself in the template just do
foreach( $forums AS $blugrlenardstkoasdentoedasnte ) { ... }
to avoid the variable name collision.
July 26, 2007 at 6:16 pm #2165ganzua
MemberI just installed 0.8.2.1 and it seems functions.php have changed a lot.
Where is get_profile_info_keys() function now? Signature plugin doesn’t work because you need to insert code in that line.
July 26, 2007 at 5:19 pm #2164Topic: not getting pagination links on forum pages
in forum Troubleshooting_ck_
ParticipantRuh roh, I think I broke something.
No pagination links on forum pages even though
<?php forum_pages(); ?>
is there – pagination shows up and works just fine on topic pages however.Seems to work here, any ideas how to debug this other than turning off two dozen plugins?
ps. also someone has to tell me oneday how to change the pagination number count and formatting without hacking the core – how do I alter that default settings array?
July 26, 2007 at 4:43 pm #59418In reply to: plugin idea: “report this post”
_ck_
ParticipantComing soon:
don't allow reports on moderators
don't allow reports from members less than x days old
security check if user is in the right topic for the post being reportedJuly 26, 2007 at 4:11 pm #59417In reply to: plugin idea: “report this post”
_ck_
ParticipantAnd a report post plugin is born – tested working!
Needs a few features but gets the job done for now:
<?php
/*
Plugin Name: report post
Description: allows members to report a post to admin/moderators
Plugin URI: http://CKon.wordpress.com
Author: _ck_
Author URI: http://CKon.wordpress.com
Version: 0.1
*/
/*
instructions: install, activate and put <? report_post_link(); ?> in your post.php template where you want the link to be seen
optional in stylesheet: a.report_post {color:red;}
todo:
1. don't let them report more than once on a post - or more than too many times per minute/hour
2. auto-delete post if more than x reports from different members
3. auto-post report into a specified moderator's forum #
4. maybe ajax xmlhttp call instead of real form post so there's no page movement
5. it's technically possible to alert a browing mod with a popup directing to the reported post, no email needed
*/
function report_post_link($post_id=0) {
if (bb_current_user_can('participate') ) :
$post_id= get_post_id( $post_id );
if (get_post_author_id($post_id) != bb_get_current_user_info( 'id' )) {
echo '<a class=report_post title="report post to moderator" href="#post-'.$post_id.'" onClick="report_post('.$post_id.');return false;">Report</a>';
}
endif;
}
function report_post_form() {
if (bb_current_user_can('participate')) :
if (isset($_POST['report_post_id']) && isset($_POST['report_post_reason'])) {
echo '<scr'.'ipt type="text/javascript">alert("Thank you for the report. A moderator has been notified.");</scr'.'ipt>';
$post_id=intval($_POST['report_post_id']);
// todo: custom response if invalid id, problem sending email - maybe flush output buffer so member gets alert faster
$to = bb_get_option('admin_email');
$subject = " reported post by member for moderation";
$headers = "From: ".bb_get_option('admin_email');
$message ="report by: ".bb_get_current_user_info( 'name' )." (".bb_get_current_user_info( 'id' ).") email: ".bb_get_current_user_info( 'email' )."rnrn";
$message.="report: ".wordwrap(strip_tags(substr($_POST['report_post_reason'],0,255)),70)."rnrn".get_post_link($post_id)."rn";
$message.="post by: ". get_post_author($post_id)."rn"; // add "member since", total posts, blah blah
$message.="rnrnReport Trace:rn";
$message.="IP: ".$_SERVER['REMOTE_ADDR']."rn";
$message.="Host: ".gethostbyaddr($_SERVER['REMOTE_ADDR'])."rn"; // useful but can add a few seconds
$message.="Agent: ".$_SERVER['HTTP_USER_AGENT']."rn";
$message.="Refer: ". $_REQUEST['refer']."rn";
$message.="URL: http://".$_SERVER['HTTP_HOST'].$GLOBALS["HTTP_SERVER_VARS"]["REQUEST_URI"]."rn";
mail( $to, $subject, $message,$headers);
}
echo '<form method="POST" name="report_post_form" id="report_post_form" style="display:none;visibility:hidden"><input type=hidden name="report_post_id"><input type=hidden name="report_post_reason"></form>';
echo '<scr'.'ipt type="text/javascript">
function report_post(post_id) {
var report_post_reason = prompt("Please enter a short but descriptive reason why a moderator needs to review this post:", "");
if (report_post_reason && report_post_reason.length>9) {
document.report_post_form.report_post_id.value=post_id;
document.report_post_form.action="#post-"+post_id;
document.report_post_form.report_post_reason.value=report_post_reason;
document.report_post_form.submit();
} else {alert("report cancelled, incomplete description"); }
}
</scr'.'ipt>';
endif;
}
add_action('bb_foot', 'report_post_form');
?>July 26, 2007 at 2:19 pm #59401In reply to: forum.wp-persian.com
Trent Adams
MemberGreat job! Will it have bbPress support as well! I hope so, or this is not the place to post it
Trent
outchy
Memberawesome
-
AuthorSearch Results