Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 29,576 through 29,600 (of 32,499 total)
  • Author
    Search Results
  • #49627

    In reply to: Emoticons For bbPress?

    fel64
    Member

    Did 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.

    #49625

    In 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’,

    :D‘ => ‘icon_biggrin.gif’,

    :-D‘ => ‘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’,

    8)‘ => ‘icon_cool.gif’,

    8-)‘ => ‘icon_cool.gif’,

    ‘:cool:’ => ‘icon_cool.gif’,

    ‘:lol:’ => ‘icon_lol.gif’,

    ‘ :x’ => ‘icon_mad.gif’,

    ‘ :-x’ => ‘icon_mad.gif’,

    ‘:mad:’ => ‘icon_mad.gif’,

    :P‘ => ‘icon_razz.gif’,

    :-P‘ => ‘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’));

    ?>

    fel64
    Member

    Meh, 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.

    ganzua
    Member

    It didn’t work :) It reports errors whenever the template calls the signature.

    Perhaps this kind of stuff should be included in the core.

    fel64
    Member

    Code 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.

    ganzua
    Member

    Hi 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

    fel64
    Member

    I duno. Just use the filter get_profile_info_keys instead.

    #59431
    fel64
    Member

    Should 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.

    ganzua
    Member

    I 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.

    #2164
    _ck_
    Participant

    Ruh 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?

    #59418
    _ck_
    Participant

    Coming 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 reported

    #59417
    _ck_
    Participant

    And 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');

    ?>

    #59401

    In reply to: forum.wp-persian.com

    Trent Adams
    Member

    Great job! Will it have bbPress support as well! I hope so, or this is not the place to post it ;)

    http://forum.wp-persian.com

    Trent

    #59383

    In reply to: css help

    outchy
    Member

    awesome :D

    #59152
    kjted
    Member

    I’ve not forgotten about this. I will post up some code when i’ve finished. I’ve just written an insertion class too.

    #56739

    In reply to: Plugin: Avatar Upload

    LMD
    Participant

    Oh! I see, the sub-sub folders are empty, I just downloaded it from here myself to check.

    When I browsed bbPress’ Subversion repository, the files ARE there — I didn’t forget to commit them! — so somehow the bbPress Plugin Browser (the one on this site, NOT Sam’s plugin) has messed up the ZIP download.

    The question is, whether it is a one-off or a systematic problem? Admins? Coders? Any ideas?

    To solve your problem outchy (and yes, somehow the identicon section got deleted in your avatar.php file), you can download files directly from the Trac browser.

    Here is the avatar.php file (long url, sorry):

    https://plugins-dev.bbpress.org/browser/avatar-upload/trunk/additional-files/my-templates/avatar.php

    You can not save that page itself, but scroll right to the bottom of it and you’ll see “Download in other formats” – just click on “Original Format” and you’ll be prompted to save a PHP file.

    You can do it for any other files you’re missing.

    #2160
    mousehunter
    Member

    I would like to display the “tag” field in the widget, however, I’m not sure how to do it. I know where to put the code to make it display, but how do I actually get the value from the DB (which table/field). I thought $bbTopic might contain it, but i was wrong. Any help would be appreciated. Thanks.

    #53777
    mazdakam
    Member

    this is my coustom code in search-form:

    <form action="<?php bb_option('uri'); ?>search.php" method="get">
    <p><?php _e('Search:'); ?>
    <input type="text" size="70" maxlength="200" name="q" value="<?php echo attribute_escape( $q ); ?>" />
    <?php if( empty($q) ) : ?>
    <input type="submit" value="<?php echo attribute_escape( __('Search &raquo;') ); ?>" class="inputButton" />
    <?php else : ?>
    <input type="submit" value="<?php echo attribute_escape( __('Search again &raquo;') ); ?>" class="inputButton" />
    <?php endif; ?>
    </p>
    </form>

    #59393
    fel64
    Member

    In the right place in front-page.php? It has to be inside the loops that go foreach( $sumthin AS $topic ) { ... }

    I’ve just tried it myself and it seems to work. Comment _in_ that line about the span colour so you can test if it’s working at all.

    #59409
    fel64
    Member
    <?php
    /*
    Plugin Name: Page &raquo;
    Description: Adds &raquo; to the end of topic titles, linking to latest post.
    Author: fel64
    Version: 0.7
    */

    if (!function_exists('is_tags')) {
    function is_tags()
    {
    return is_tag();
    }
    }

    if (is_front() || is_forum() || is_tags()) {
    add_filter('topic_title', 'fel_addlatestlink', 101);
    }

    function fel_addlatestlink($title)
    {
    global $topic;
    $felgtlpl = get_topic_last_post_link($topic->topic_id);
    $title = $title . ' <a href="' . $felgtlpl . '">&nbsp;&raquo;&nbsp;</a>';

    return $title;
    }
    ?>

    That’ll add a little double arrow to the name of each topic which goes to the latest. :)

    #2159

    I’d like a link on each listed topic that takes you to the last post in the topic. Any help? :)

    #59392
    mikelothar
    Member

    I’m not sure i’m doing it right. The idea is good, but nothing seems to happen. Here’s what i have:

    In the plugin:

    function fel_indicatenew($title)
    {
    global $topic, $bb_current_user;
    if ( bb_is_user_logged_in() )
    {
    $feluser = bb_get_user($bb_current_user->ID);
    if( ($topic->topic_time > $feluser->last_visit) && ( $topic->topic_last_poster != $feluser->ID ) )
    {
    //$title = '<span style="color: #9d0a0e;">' . $title . '</span>';
    $topic->new = true;
    }
    }
    return($title);
    }

    .. and in the theme’s front-page.php:

    <?php if( $topic->new ) : ?>
    blah
    <?php endif; ?>

    I’ve also tried:

    <?php if( $topic->new ) { ?>
    blah
    <?php } ?>

    .. but none of these seem to do anything.

    #49622

    In reply to: Emoticons For bbPress?

    fel64
    Member

    It’s not a plugin. Add this to the top of the file, after the <?php:

    /*
    Plugin Name: Nerr
    */

    #56736

    In reply to: Plugin: Avatar Upload

    LMD
    Participant

    How are you installing the plugin? Are you downloading it directly or are you using the ‘Plugin browser for bbPress’ plugin? If the latter, then I think it’s not downloading properly, you need to do it manually by downloading the current ZIP file, unzipping it and follow the instructions in the readme.txt file.

    Here is the Avatar Upload plugin in the bbPRess Plugin Browser, the newest version of the code is always to be found on that page:

    https://bbpress.org/plugins/topic/46

    Click on the link “Download latest version” — or just click the following download link for now:

    https://bbpress.org/plugins/download/avatar-upload.0.7.zip

    fel64
    Member

    What do Tom and Jerry have to do with any of this?

    So replace the code that adds the <span class=””> to this:

    $topic->new = true;

    Then when you want to find out if it’s a new topic, you do this:

    if( $topic->new ) {
    //blah
    }

    Should work. Unless I misunderstood your wishes again.

Viewing 25 results - 29,576 through 29,600 (of 32,499 total)
Skip to toolbar