bbPress

Simple, Fast, Elegant

bbPress support forums » Plugins

First Plugin Attempt

(4 posts)
  • Started 1 year ago by actorjiml
  • Latest reply from thomasklaiber
  • This topic is not a support question

Tags:

  1. I am attempting to write my first plugin. The idea is to display a graphic image for the posters rank. I keep getting this error.

    Parse error: parse error, unexpected '=', expecting '}' in /home/brightan/public_html/bbPress/my-plugins/graphic-display-ranks.php on line 82

    Here is the function that includes line 82.

    function user_rank($id) {
    $special_rank = get_special_rank (get_post_author_id());
    if ($special_rank>0)
    {
    switch ($special_rank) {
    case 1 :
    $display_rank=$path_to_rank_images . $image_for_special_rank_1;
    break;
    case 2 :
    $display_rank=$path_to_rank_images . $image_for_special_rank_2;
    break;
    }
    }
    else
    {
    $rank_count=get_post_count(get_post_author_id());
    for ($i=1;$i<$num_ranks;$i++)
    {
    if ($rank_count<$rank_max[$i])
    {$display_rank=$path_to_rank_images . $rank_img[$i];
    }
    else
    {$display_rank="";}
    }
    }
    return $display_rank;
    }

    What am I not seeing?

    Posted 1 year ago #
  2. Hmm ... which of the lines is line 82? I just can't see any error, too.

    I also put it into my Code Analyzer, the only strange thing it said was that you dont't use the function variable $id.

    I have no idea -.-

    Posted 1 year ago #
  3. I found the error. It was way above the function quoted. (A missing close quote in a switch statement.)

    Now, I'm not sure where to place it in the code. What I want to do is place the graphic under the posters title. (ie. On this page a graphic would be displayed below the member's name and the title like this:

    thomasklaiber
    Member
    {GRAPHIC}

    Posted 1 year ago #
  4. I think you should use a function like:


    function apply_author_title_image( $r ) {
    $r .= '<br>Your Image';
    return $r;
    }
    add_filter('post_author_title', 'apply_author_title_image');

    Posted 1 year ago #

RSS feed for this topic

Reply

You must log in to post.

Code is Poetry.