Info
- 4 posts
- 2 voices
- Started 5 years ago by actorjiml
- Latest reply from thomasklaiber
- This topic is not a support question
First Plugin Attempt
-
- Posted 5 years ago #
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 5 years ago #
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 5 years ago #
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 5 years ago #
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');
-
You must log in to post.