Skip to:
Content
Pages
Categories
Search
Top
Bottom

Arguments before and after a php tag


  • infected
    Participant

    @infected

    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?

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

  • deadlyhifi
    Participant

    @tomdebruin

    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 " | "; }.


    infected
    Participant

    @infected

    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:', ', ', ''); ?>


    deadlyhifi
    Participant

    @tomdebruin

    I figured it out.

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


    ootes
    Member

    @ootes

    thanx just what i needed

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