Forums

Join
bbPress Support ForumsThemesArguments before and after a php tag

Info

Tags

Arguments before and after a php tag

  1. Hi!

    First of all, sorry for my bad english... I try to explain my intention as good as i can.

    I tried to show this " | " before or after a php tag in my own template. For example my post.php contains this code
    <div class="poststuff"><?php printf( __('Posted %s ago'), bb_get_post_time() ); ?> <a href="<?php post_anchor_link(); ?>">Permalink</a> <?php post_ip_link(); ?> <?php post_edit_link(); ?> <?php post_delete_link(); ?></div>

    What i want is that e.g. before <?php post_ip_link(); ?> is displayed the above mentioned character. If i insert it before the php tag it also displayed to "normal users". Normally the ip link is only displayed for admins. And so i´d like to see the | only as admin.

    The output for normal users should look like this: Posted 38 minutes ago | Permalink
    The output for admins should look like this: Posted 38 minutes ago | Permalink | 127.0.0.1 | Edit | Delete

    If i add this "|" manually before the tags, for normal users it looks like this: Posted 38 minutes ago | Permalink | | |

    Any ideas how this can be done?

  2. functions.bb-template.php line 1866 shows the arguments that this functions can accept, including a before and after character. But it also states $args = null. You could add the | on line 1868 but this is editing the core :(

    Alternatively use an if ( bb_current_user_can( 'view_by_ip' ) ) { echo " | "; }.

  3. Hm... That might be work. But there´s no way to handle this like in wordpress? For example you can pass arguments before and after the tag and also define a separator. Like this: <php the_tags('Tags:', ', ', ''); ?>

  4. I figured it out.

    <?php post_ip_link( array( 'before' => ' | ', 'after' => ' | ' ) ); ?>

  5. thanx just what i needed

  6. You must log in to post.