Skip to:
Content
Pages
Categories
Search
Top
Bottom

Plugin: [REL] Signature

  • Hi,

    Heres my first plugin which was pretty much copied from the Avatar plugin, but hey, now I can contribute my 2 cents :) (Thanks to the guy who made that too)

    To install you must open functions.php (in bb-includes, line 1388) and add:

    'sig' => array(0, __('Signature'))

    to the end (before last closing bracket)

    This is the code:

    <?php

    /*

    Plugin Name: Signature

    Author: veb

    Version: 1.0

    */

    function post_sig() { // function to use in page php to get the sig

    if ( get_sig( get_post_author_id() ) )

    echo get_sig( get_post_author_id() );

    }

    function get_sig ( $id ) { //function to return sig lfrom database

    global $bbdb, $bb_current_user;

    $user = bb_get_user( $id );

    $profile_info_keys = get_profile_info_keys();

    if ( $id && false !== $user )

    if ( is_array( $profile_info_keys ) )

    foreach ( $profile_info_keys as $key => $label ) {

    if ( 'sig' == $key )

    return $user->$key;

    }

    }

    ?>

    Save as bb-signature.php in my-plugins.

    Have fun :D

Viewing 19 replies - 51 through 69 (of 69 total)

  • _ck_
    Participant

    @_ck_

    Oh weird. I wonder why I didn’t see that and thought it was after. Oh wait, I know what the problem was, I didn’t like how it was after the submit button and couldn’t think of a proper method to manipulate it with CSS.

    Oh well. After I get the polls plugin going I’ll go back to signatures. Signatures I’ll never use myself but I want polls…


    mazdakam
    Member

    @mazdakam

    it is really good thanks


    _ck_
    Participant

    @_ck_

    Testing working in the latest 912 trunk.


    ganzua
    Member

    @ganzua

    I can’t reduce signature table width. Is it defined in line 83 <table width=”100%”> ? I can reduce the form but not the table where it is included.


    _ck_
    Participant

    @_ck_

    Do you mean inside the edit profile page?

    You’d need to reduce the <table width="100%">

    but maybe also textarea style="width:90%;"

    Are you using a custom template? Seems to work fine in the few templates I’ve tried.

    If you still have trouble, post a screenshot image if you can.

    I am now removing width="100%" from the new/next version.


    ganzua
    Member

    @ganzua

    “Do you mean inside the edit profile page?”

    Yes, the edit profile page

    “You’d need to reduce the <table width=”100%”>

    but maybe also textarea style=”width:90%;” “

    -> it didn’t work. <table width=”30%”> only reduces the form area

    “Are you using a custom template?”

    -> yes a 800 x 600 two columns, narrow column right

    “I am now removing width=”100%” from the new/next version.”

    -> well, I’ll wait. Does it need a table? Perhaps a div plus some css would be better.


    _ck_
    Participant

    @_ck_

    I only used a table to match what is already being used on that page by default and there may be future structures that need a table.

    The svn doesn’t seem to be updating the versions on the extend page here so here’s a direct version:

    http://ckon.wordpress.com/files/2007/08/bb-signatures.txt?v011


    ganzua
    Member

    @ganzua

    “I only used a table to match what is already being used on that page by default and there may be future structures that need a table.”

    Yep, I guessed so

    “The svn doesn’t seem to be updating the versions on the extend page here so here’s a direct version:

    http://ckon.wordpress.com/files/2007/08/bb-signatures.txt?v

    I’m going to give it a try right now


    ganzua
    Member

    @ganzua

    It doesn’t work for me :) It is widening the whole table but I think the sproblem is tag <fieldset>. Removing this tag solved the problem.


    ganzua
    Member

    @ganzua

    and I just checked, fieldset is stylized in the style sheet and I fixed a width in pixels there.

    I don’t know if this is a problem with my custom theme or if anybody else is having the same thing. What I’m going to do is to create a class “forumsignature” in my style sheet, I’m going to define a width in pixels there and next I’ll change <fieldset> for <fieldset class=”forumsignature”> in the plugin.


    ganzua
    Member

    @ganzua

    this style

    ‘.signature {clear:both;border-top:1px solid #222; font-size:85%; color:#777;padding:1em;}’

    that appears in the plugin control panel is not working for me neither unless I copy it in the stylesheet


    ganzua
    Member

    @ganzua

    There is a couple of things that could be useful but I have no idea how to implement; a warning text displaying how many characters and lines are still available in the signature field and the possibility of moving the signature field to any other places.

    If I wanted to include signature in any other place is there any function I can call?


    _ck_
    Participant

    @_ck_

    I doubt I will add lines/characters countdown meters anytime soon but will keep them in mind. The Polls plugin is my top priority for now as I don’t even allow signatures on my own sites.

    I’ll look into the stylesheet bug though.

    To see a signature somewhere else you’d have to call

    echo add_signature_to_post('');

    which might work but won’t apply other bbpress filters to it. It also needs to know the post and user id from $bb_post so if it’s outside the loop it won’t work at all.

    I only worked on signatures for a day or two, it’s very very beta.


    ganzua
    Member

    @ganzua

    “I doubt I will add lines/characters countdown meters anytime soon but will keep them in mind. ”

    -> just a suggestion, don’t worry

    “To see a signature somewhere else you’d have to call

    echo add_signature_to_post(”);”

    -> I mean for example in profile.php

    “I only worked on signatures for a day or two, it’s very very beta.”

    -> well, it does its job!


    jolaedana
    Member

    @jolaedana

    Thanks for the plugin! My users will be happy.

    Unfortunately, I’m getting the following error:

    Warning: in_array() [function.in-array]: Wrong datatype for second argument in /path_to/my-plugins/bb-signatures.php on line 127

    Warning: Cannot modify header information – headers already sent by (output started at /path_to/my-plugins/bb-signatures.php:127) in /path_to/bb-includes/pluggable.php on line 168

    Any thoughts?


    _ck_
    Participant

    @_ck_

    Are you using php5? Server runs linux or windows?

    The second error is caused by the first.

    I’ll if I can do a quick fix, thanks for the report.

    Please try this version and see if it makes the error go away:

    http://ckon.files.wordpress.com/2007/08/bb-signatures.txt?v012a


    jolaedana
    Member

    @jolaedana

    I’m running PHP 4.4.7, and server is Linux- nothing too non standard.

    It seems like this new version you’ve done has fixed the issue- yaay. It was only occurring if I tried to post a second time in a thread I’d already posted in once with the signature. Seems to be solved.

    Thanks for all your great work on plugins around here lately.

    If I have any other bugs with this, I’ll be sure to let you know.


    Sam Bauers
    Participant

    @sambauers

    > The svn doesn’t seem to be updating the versions on the extend page

    You need to add tagged versions to bump up the version on the extend page.

    Just add a new sub-directory to the “tags” directory named the same as the version number, then copy your trunk files that match that version to it.


    citizenkeith
    Participant

    @citizenkeith

    Running the latest version of bbPress and the latest version of ck’s plugin.

    Signatures won’t update when you try to change them in Edit Profile. No error messages to be found.

Viewing 19 replies - 51 through 69 (of 69 total)

You must be logged in to reply to this topic.