Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
How can I format the output of a PHP element?
Old 01-24-2009, 11:14 PM How can I format the output of a PHP element?
Experienced Talker

Posts: 38
Name: carl
Trades: 0
I have the following script which allows people to log into my site. The script works well, no issues there, but after you login the script shows the login info and some links. It shows the link to the user profile as the username, I want simply to change the output to read "Profile" instead of reading the username. How can I do this without killing the link, etc?

This is in wordpress. I have set up a dummy account To see it in person go to www.ex-brief.com

Username: help
Password: help

SCRIPT:

Code:
<form name="login-form" id="login-form"
 action="<?php get_option('home') ?>/wp-login.php" method="post"><input
 size="15" name="log" id="user_login"
 value="Username"
 onfocus="if (this.value == 'Username') {this.value = '';}"
 onblur="if (this.value == '') {this.value = 'Username';}"><input
 size="15" name="pwd" id="user_pass" class="input"
 value="" type="password">
<!--<input name="rememberme" type="checkbox" id="rememberme" value="forever" />-->
  <p><input name="wp-submit" id="wp-submit"
 value="<?php _e( 'Log In', 'buddypress' ) ?>" type="submit"><input
 name="redirect_to"
 value="http://<?php echo $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'] ?>"
 type="hidden"><input name="testcookie" value="1"
 type="hidden">
  </p>
</form>
</div> </ul>
<p style="text-align: center;"><a href="/wp-signup.php?action=lostpassword">Sign Up</a> | <a href="/wp-login.php?action=lostpassword">Lost Password?</a><br>
    <?php else : ?>
        <br /><br /><br /><div id="logout-link">
            <div style="text-align: center;">
            <table
 style="width: 70%; text-align: center; margin-left: auto; margin-right: auto;"
 border="0" cellpadding="0" cellspacing="0">
  <tbody>
    <tr>
      <td style="vertical-align: middle; horizontal-align: center; text-align: center;"><div style="text-align: center;">
            <?php bp_loggedinuser_avatar_thumbnail( 50, 50 ) ?><br />
            <?php bp_loggedinuser_link() ?> </div></td>      <td style="text-align: center;"><img
 style="width: 2px; height: 50px;" alt=""
 src="http://www.ex-brief.com/wp-content/themes/default/images/line.png"></td>
      <td style="text-align: center;"><A href="/wp-admin/">Dashboard</a>
<br> <?php bp_loggedinuser_link() ?> </td>
    </tr>
  </tbody>
</table>
            
            <?php if ( function_exists('wp_logout_url') ) : ?>
                / <a href="<?php echo wp_logout_url(site_url()) ?>" alt="<?php _e( 'Log Out', 'buddypress' ) ?>"><?php _e( 'Log Out', 'buddypress' ) ?></a> </div>

            
            <?php else : ?>









                <br> <a href="<?php echo site_url() . '/wp-login.php?action=logout&amp;redirect_to=' . site_url() ?>"><?php _e( 'Log Out', 'buddypress' ) ?></a>
            <?php endif; ?>
        <br /><br /><br /></div>
    <?php endif; ?>
Exbrief is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 01-25-2009, 10:55 AM Re: How can I format the output of a PHP element?
rogem002's Avatar
PHP Chap

Posts: 843
Name: Mike
Location: United Kingdom
Trades: 0
You should ask for help from wordpress. Try this

PHP Code:
form name="login-form" id="login-form"
 action="<?php get_option('home'?>/wp-login.php" method="post"><input
 size="15" name="log" id="user_login"
 value="Username"
 onfocus="if (this.value == 'Username') {this.value = '';}"
 onblur="if (this.value == '') {this.value = 'Username';}"><input
 size="15" name="pwd" id="user_pass" class="input"
 value="" type="password">
<!--<input name="rememberme" type="checkbox" id="rememberme" value="forever" />-->
  <p><input name="wp-submit" id="wp-submit"
 value="<?php _e'Log In''buddypress' ?>" type="submit"><input
 name="redirect_to"
 value="http://<?php echo $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'?>"
 type="hidden"><input name="testcookie" value="1"
 type="hidden">
  </p>
</form>
</div> </ul>
<p style="text-align: center;"><a href="/wp-signup.php?action=lostpassword">Sign Up</a> | <a href="/wp-login.php?action=lostpassword">Lost Password?</a><br>
    <?php else : /* ?>
        <br /><br /><br /><div id="logout-link">
            <div style="text-align: center;">
            <table
 style="width: 70%; text-align: center; margin-left: auto; margin-right: auto;"
 border="0" cellpadding="0" cellspacing="0">
  <tbody>
    <tr>
      <td style="vertical-align: middle; horizontal-align: center; text-align: center;"><div style="text-align: center;">
            <?php bp_loggedinuser_avatar_thumbnail( 50, 50 ) ?><br />
            <?php bp_loggedinuser_link() ?> </div></td>      <td style="text-align: center;"><img
 style="width: 2px; height: 50px;" alt=""
 src="http://www.ex-brief.com/wp-content/themes/default/images/line.png"></td>
      <td style="text-align: center;"><A href="/wp-admin/">Dashboard</a>
<br> <?php bp_loggedinuser_link() ?> </td>
    </tr>
  </tbody>
</table>

            
            <?php if ( function_exists('wp_logout_url') ) : ?>
                / <a href="<?php echo wp_logout_url(site_url()) ?>" alt="<?php _e( 'Log Out', 'buddypress' ) ?>"><?php _e( 'Log Out', 'buddypress' ) ?></a> </div>
<?php */ 
?>

            <a href="#">Profile</a>
            <?php else : ?>









                <br> <a href="<?php echo site_url() . '/wp-login.php?action=logout&amp;redirect_to=' site_url() ?>"><?php _e'Log Out''buddypress' ?></a>
            <?php endif; ?>
        <br /><br /><br /></div>
    <?php endif; ?>
__________________
My Blog/Site:
Please login or register to view this content. Registration is FREE

Last edited by rogem002; 01-25-2009 at 10:56 AM..
rogem002 is offline
Reply With Quote
View Public Profile Visit rogem002's homepage!
 
Old 01-25-2009, 02:52 PM Re: How can I format the output of a PHP element?
Experienced Talker

Posts: 38
Name: carl
Trades: 0
this is the piece of code in the script that calls the username link up

<?php bp_loggedinuser_link() ?>

I want the function to be the exact same, but instead of it printing the username I just want it to print "Profile"

I asked all around wordpress, nobody has a clue.
Exbrief is offline
Reply With Quote
View Public Profile
 
Old 01-25-2009, 07:21 PM Re: How can I format the output of a PHP element?
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Find where the function is and edit it.

it's not a standard Wordpress function so it will be in whatever plugin you have installed
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 01-25-2009, 07:29 PM Re: How can I format the output of a PHP element?
Experienced Talker

Posts: 38
Name: carl
Trades: 0
I did not install any plugins, all I did was add that code to my page and it worked perfectly.
Exbrief is offline
Reply With Quote
View Public Profile
 
Old 01-25-2009, 07:38 PM Re: How can I format the output of a PHP element?
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Well somewhere along the way somebody installed BuddyPress, because that's where the "bp_" prefixed functions are from.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 01-25-2009, 07:42 PM Re: How can I format the output of a PHP element?
Experienced Talker

Posts: 38
Name: carl
Trades: 0
yes, my bad, i wasnt thinking of BP as a plugin, but it truly is. I tried the guys, including the author of Buddypress, Andy P. Nobody over there has the answer either. Was hoping there was some way to do it with html or something simple.
Exbrief is offline
Reply With Quote
View Public Profile
 
Old 01-25-2009, 07:42 PM Re: How can I format the output of a PHP element?
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
it's in bp-core/bp-core-templatetags.php BTW
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 01-25-2009, 07:51 PM Re: How can I format the output of a PHP element?
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
looking at the code and without too much dissecting

PHP Code:
function bp_loggedinuser_link() {
    global 
$bp$current_user;
    
    if ( 
$link bp_core_get_userlink$bp['loggedin_userid'] ) ) {
        echo 
apply_filters'bp_loggedinuser_link'$link );
    } else {
        
$ud get_userdata($current_user->ID);
        echo 
apply_filters'bp_loggedinuser_link'$ud->user_login );
    }

change $link for the text you want to display
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 02-19-2009, 09:47 PM Re: How can I format the output of a PHP element?
Experienced Talker

Posts: 38
Name: carl
Trades: 0
will that kill the link? I need the link to remain the same, just the text that the link says to be changed to Profile.
Exbrief is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to How can I format the output of a PHP element?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.31198 seconds with 12 queries