Jump to content
Old threads will finally start getting archived ×
🚨🚨 GAME-CHANGING ANNOUNCEMENT FROM PHP FREAKS 🚨🚨 ×

Recommended Posts

Hi. I have written a small PHP Script, but for some reason it does not seem to work properly. Every page I include it on returns a blank page... Here is the code...

 

<link type="text/css" href="modules/mod_yoo_login/mod_yoo_login.css.php" rel="stylesheet" />
<?php
error_reporting(0);
$jspath = JPATH_BASE.DS.'components'.DS.'com_community';
include_once($jspath.DS.'libraries'.DS.'core.php');
$avatarUrl = $user->getThumbAvatar();
$user = CFactory::getUser( $userid );
$name = $user->getDisplayName();
?>
<table border="0" cellspacing="0">
<tr>
<td>
<img src="<? echo $avatarUrl; ?>"/>
</td>
<td style="padding:5px">
<strong>
<span><? echo $name; ?></span>
</strong>
<hr />
<form action="index.php" method="post" name="login">
<span class="niftydefault" style="display: block;">
<span class="yoo-login">
<span class="logout">
<span class="logout-button-icon">
<button value="Logout" name="Submit" type="submit" title="Logout">Logout</button>
</span>
<input type="hidden" name="option" value="com_user" />
<input type="hidden" name="task" value="logout" />
<input type="hidden" name="return" value="aHR0cDovL2NvbGRjYXN0LmNvLnVrL2luZGV4LnBocA==" />
</span></span></span>
</form>
</td>
</tr>
</table>

 

Any ideas? I was thinking I may have the syntax wrong, but if I have then I cannot see where. Any help here would be very much appreciated.

Link to comment
https://forums.phpfreaks.com/topic/149381-solved-php-error/
Share on other sites

No, I will try that now, but I did manage to refine the error location to these lines... as when they are removed the page loads, obviously without the data that they feed...

 

$avatarUrl = $user->getThumbAvatar();
$user = CFactory::getUser( $userid );
$name = $user->getDisplayName();

 

I will try the error report now, thanks. :)

Link to comment
https://forums.phpfreaks.com/topic/149381-solved-php-error/#findComment-784546
Share on other sites

Nevermind, I fixed it... here was the problem...

 

I was trying to load

$avatarUrl = $user->getThumbAvatar();

 

Before

$user = CFactory::getUser($userid);

 

When it needed to second one to be loaded ready to use the data from it. A novice mistake, but thanks for your help :)

Link to comment
https://forums.phpfreaks.com/topic/149381-solved-php-error/#findComment-784550
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.