Skip to:
Content
Pages
Categories
Search
Top
Bottom

First Plugin Attempt


  • Geezerjim
    Participant

    @actorjiml

    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?

Viewing 3 replies - 1 through 3 (of 3 total)

  • thomasklaiber
    Member

    @thomasklaiber

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


    Geezerjim
    Participant

    @actorjiml

    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}


    thomasklaiber
    Member

    @thomasklaiber

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

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
Skip to toolbar