26

Re: Ranks w/ stars ?

sham wrote:

i have this error. please help me resolve it... thanks in advance

Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in C:\Xitami\xxx\_forums\viewtopic.php on line 363

First, see if there is maybe a ";" missing at the end of a php line where there should be one.

If that doesn't help paste here the code around your line 363 (say, 320 to 365, please not all viewtopic smile )

The German PunBB Site:
PunBB-forum.de

27

Re: Ranks w/ stars ?

Tobi wrote:
sham wrote:

i have this error. please help me resolve it... thanks in advance

Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in C:\Xitami\xxx\_forums\viewtopic.php on line 363

First, see if there is maybe a ";" missing at the end of a php line where there should be one.

If that doesn't help paste here the code around your line 363 (say, 320 to 365, please not all viewtopic smile )

thanks a lot... I already solve the problem smile

Re: Ranks w/ stars ?

Hmm just say I wanted to assign a certain number of rank pips to a certain user group instead of it being effected by the post count. Anyone got any ideas.

29

Re: Ranks w/ stars ?

Do you mean "Group" or "Title"?

The latter would be quite easy.
There is a function get_title() that extracts the Titlle name and displays it.
It sits in include/functions.php around line 441.
All you'd have to do is change he titles from, say, "Newbie" to "*" and from "Expert" to "***" and so on.
Then, in the function you replace the asterisks with the pip IMG tags.

If you mean "Group" then it's an extra to display because currently the group is not displayed everywhere.
It can be done but it's a lot more complicated

The German PunBB Site:
PunBB-forum.de

Re: Ranks w/ stars ?

what i mean is

Administrators  5 pips
Mods 4 pips
Vets 3 pips
members 2 pips


and so on

31 (edited by Tobi 2005-10-13 13:59)

Re: Ranks w/ stars ?

That is tricky.
You could do the following:

open viewtopic.php and in line 29 enter

function GroupPips($groupid)  {
  $group2pip = array("1"=>6,
                     "2"=>3,
                     "3"=>2,
                     "4"=>1,
                     "5"=>4,
                     "6"=>5);
  if(!array_key_exists($group2pip,$groupid))  return '';
  else  {
    for($i = 1;$i <= $group2pip[$groupid];$i++) {
      $outpips .= '<img src="img/pip.gif" alt="" />';
      }
    return $outpips;
    }
  }

Then, find around line 216

        $username = '<a href="profile.php?id='.$cur_post['poster_id'].'">'.pun_htmlspecialchars($cur_post['username']).'</a>';

and after that, add

    $username .= '<br/>'.GroupPips($pun_user['g_id']);

Note:
In the function GroupPips you have an array group2pip.
The keys represent the group id of your groups, the values the number of pips you want to show for it.

Note 2 I haven't tested all this so take it as an idea, not a complete recipe. wink

The German PunBB Site:
PunBB-forum.de

32

Re: Ranks w/ stars ?

there is functions.php especially for functions, for what put this code into viewtopic.php?

Hm... every pixel has it's own destiny

33

Re: Ranks w/ stars ?

Because you will not need it outside viewtopic.php.
functions.php is for common functions used by all or at least most scripts.
If you stuff everything in there then all scripts have to load an overweight include file which will be bad for performance if you are not careful.
That's one reason.

The other one is:

Tobi wrote:

so take it as an idea, not a complete recipe

wink

The German PunBB Site:
PunBB-forum.de

34 (edited by hnstmn 2006-03-01 09:49)

Re: Ranks w/ stars ?

shaul26 wrote:

I talked with the mod creator (Ju) very nice person!

and he told me what to do..

this is the mod:

open "viewtopic.php"

find:

    $post_count++;
    $user_avatar = '';
    $user_info = array();
    $user_contacts = array();
    $post_actions = array();
    $is_online = '';
    $signature = '';

    // If the poster is a registered user.
    if ($cur_post['poster_id'] > 1)
    {

after add:

        $rank_pips = "";
        if($cur_post['num_posts'] > 5000) { $num_pips = 10; }
        elseif($cur_post['num_posts'] > 3000) { $num_pips = 9; }
        elseif($cur_post['num_posts'] > 2000) { $num_pips = 8; }
        elseif($cur_post['num_posts'] > 1000) { $num_pips = 7; }
        elseif($cur_post['num_posts'] > 500) { $num_pips = 6; }
        elseif($cur_post['num_posts'] > 300) { $num_pips = 5; }
        elseif($cur_post['num_posts'] > 100) { $num_pips = 4; }
        elseif($cur_post['num_posts'] > 50) { $num_pips = 3; }
        elseif($cur_post['num_posts'] > 10) { $num_pips = 2; }
        else { $num_pips = 1; }

        for($pip=0; $pip<$num_pips; $pip++) {
            $rank_pips .= '<img src="img/pip.gif" alt="" />';
        }

Find:

           <dl>
                    <dt><strong><?php echo $username ?></strong></dt>
                    <dd class="usertitle"><strong><?php echo $user_title ?></strong></dd>

After, add :

                    <?php echo "<dd class=\"usertitle\">".$rank_pips."</dd>\n"; ?>

Save viewtopic.php and upload (overwrite)

I didn't creat this mod... all the credit goes to "Ju" !

I just did the pip Mod per your instructions, and it works great on my 1.2.6!! Thanks "shaul26" and especially to the (Ju) man!

Cheers!

35 (edited by Kane 2006-08-02 03:43)

Re: Ranks w/ stars ?

How do i get a unique administrators rank ?
And i can't find:

  $post_count++;
    $user_avatar = '';
    $user_info = array();
    $user_contacts = array();
    $post_actions = array();
    $is_online = '';
    $signature = '';

    // If the poster is a registered user.
    if ($cur_post['poster_id'] > 1)
    {

36 (edited by pogenwurst 2009-03-09 01:55)

Re: Ranks w/ stars ?

is there anything like this for mypunbb?

You can only use mods on MyPunBB if its owner (Connorhd) installs them.

Looking for a certain modification for your forum? Please take a look here before posting.

37 (edited by mello757 2009-07-27 02:37)

Re: Ranks w/ stars ?

Is there any way to specify what pip.gif to be used based on the users style? I can't find a color that makes everyone happy. lol

example Cobalt = pip.gif (blue image), Sadness = pip.gif (yellow image) and so on.