*

Recent

Author Topic: [v1] Profile Page  (Read 9393 times)

Danny

  • Newbie
  • *
  • Posts: 41
  • Force: +5/-0
[v1] Profile Page
« on: January 26, 2009, 10:28:06 AM »
Just had a little time to finish doing the profile page.
Create a new file called "viewprofile.php" in your pages directory.

Add:
Code: [Select]
<?php
$ID 
abs((int) $_GET['ID']);
$q $db->query("SELECT * FROM dd_users WHERE userid='{$ID}'");
if(!
$db->num_rows($q)){
echo 'No user exists with that username and ID.';
exit;
}
$ir $db->fetch_row($q);
echo 
'<table width="80%" border="0" align="center">
<tr>
<td>Username</th>
<td>'
.$ir['username'].'</td>
</tr>
<tr>
<td>Plays</td>
<td>'
.$ir['plays'].'</td>
</tr>
<tr>
<td></td>
<td><a href="'
.$domain.'/index.php?action=messages&case=compose&ID='.$ir['userid'].'">Message User</a></td>
</tr>
</table>'
;

?>

Open index.php in your main directory.
Find:
Code: [Select]
case 'search':
include ('pages/search.php');
break;

After Add:
Code: [Select]
case 'viewprofile':
include ('pages/viewprofile.php');
break;

Open memberslist.php
Find:
Code: [Select]
<a href="#">View Profile</a>
Replace With:
Code: [Select]
<a href="'.$domain.'/profile/'.$ir['userid'].'-'.$ir['username'].'.html">View Profile</a>

Add to the .htaccess
Code: [Select]
RewriteRule ^profile/([^/]*)-([^/]*)\.html$ /index.php?action=viewprofile&ID=$1&name=$2 [L]I will eventually be adding more to the profile page such avatars, msn etc (suggestions are welcome:)).


Thanks,
Danny.

123-sale

  • Newbie
  • *
  • Posts: 1
  • Force: +0/-0
Re: [v1] Profile Page
« Reply #1 on: March 06, 2010, 06:15:30 PM »
Thanks great job

soulwebsites

  • Jr. Member
  • **
  • Posts: 71
  • Force: +0/-0
    • Jamsite
Re: [v1] Profile Page
« Reply #2 on: October 15, 2011, 10:06:05 AM »
I had a bit of trouble getting this working but managed to get around the errors now I have another problem which causes the profile to display at the top of the page rather than the centre of the page.

Example: http://jamsiteproject.comli.com/profile/0-Guest.html

Just to show this is the modified code:

viewprofile.php
Code: [Select]
<?php


function writebody() {
global 
$db$domain$sitename$domain$template$gamesfolder$thumbsfolder$limitboxgames$seo_on$blogentriesshown$enabledcode_on$comments_on$directorypath$autoapprovecomments$gamesonpage$abovegames$belowgames$showwebsitelimit$supportemail$showblog$blogentriesshown$blogcharactersshown$blogcommentpermissions$blogcommentsshown$blogfollowtags$blogcharactersrss$usrdata$userid;

}
$ID abs((int) $_GET['ID']);
$q $db->query("SELECT * FROM dd_users WHERE userid='{$ID}'");
if(!
$db->num_rows($q)){
echo 'No user exists with that username and ID.';
exit;
}
$ir $db->fetch_row($q);
echo 
'<table width="89%" align="center">
<tr>
<td colspan=\'4\' class=\'header\'>Profile</td>
</tr>
<tr>
<td>Username</td>
<td>'
.$ir['username'].'</td>
</tr>
<tr>
<td>Plays</td>
<td>'
.$ir['plays'].'</td>
</tr>
<tr>
<td></td>
<td><a href="'
.$domain.'/index.php?action=messages&case=compose&ID='.$ir['userid'].'">Message User</a></td>
</tr>
</table>'
;

?>

index.php
Code: [Select]
case 'viewprofile':
include ('templates/'.$template.'/viewprofile.php');
break;

memberlist.php
Code: [Select]
<a href="'.$domain.'/profile/'.$ir['userid'].'-'.$ir['username'].'.html">View Profile</a>
.htaccess
Code: [Select]
RewriteRule ^profile/([^/]*)-([^/]*)\.html$ /index.php?action=viewprofile&ID=$1&name=$2 [L]
I have moved it so it points to templates rather than pages.

Anyone able to help with this?

Dillon

  • Developer
  • Sr. Member
  • ******
  • Posts: 340
  • Force: +3/-0
    • Arcade Freak
Re: [v1] Profile Page
« Reply #3 on: October 15, 2011, 12:30:02 PM »
This is over 2 years old its probably for an older version of the script. I cant do any testing on this since im not home. Though if you get it working im sure others would appreciate.

kurt

  • Developer
  • Hero Member
  • ******
  • Posts: 634
  • Force: +16/-1
Re: [v1] Profile Page
« Reply #4 on: October 15, 2011, 05:56:43 PM »
Yes, this was written for version 1.0 I believe. I think that the script(2.0) now has more of a profile section than this, already coded in.

Frank

  • Sr. Member
  • ****
  • Posts: 257
  • Force: +4/-0
Re: [v1] Profile Page
« Reply #5 on: October 16, 2011, 12:21:14 AM »
Quote
Anyone able to help with this?

I've just finished coding "Guest" out of members, on-line and profiles.

And made it so that guests can't view profiles - - - - -

Maybe you would be better off practising doing something like that?

soulwebsites

  • Jr. Member
  • **
  • Posts: 71
  • Force: +0/-0
    • Jamsite
Re: [v1] Profile Page
« Reply #6 on: October 23, 2011, 02:54:08 PM »
Hi Kurt I can see the showprofile.php page but I cant see where it is called from and when I browse to it all I get is no profile selected (I tried to replace with the viewprofile but I still get the same) if you have any help on this it would be appreciated

Just so you know in the mean time I have managed to fix the profile script ish.... :-X

Replace everything in viewprofile.php with this >>>

Code: [Select]
<?php


function writebody() {
global 
$db$domain$sitename$domain$template$gamesfolder$thumbsfolder$limitboxgames$seo_on$blogentriesshown$enabledcode_on$comments_on$directorypath$autoapprovecomments$gamesonpage$abovegames$belowgames$showwebsitelimit$supportemail$showblog$blogentriesshown$blogcharactersshown$blogcommentpermissions$blogcommentsshown$blogfollowtags$blogcharactersrss$usrdata$userid;


$ID abs((int) $_GET['ID']);
$q $db->query("SELECT * FROM dd_users WHERE userid='{$ID}'");
if(!
$db->num_rows($q)){
echo 'No user exists with that username and ID.';
exit;
}

$userid $usrdata['userid'];
$ir $db->query(sprintf('SELECT * FROM dd_users WHERE userid=\'%u\''$userid));
$r2 $db->fetch_row($ir);
$username $r2['username'];
$email $r2['email'];
$plays $r2['plays'];
$newsletter $r2['newsletter'];
$aim $r2['aim'];
$icq $r2['icq'];
$msn $r2['msn'];
$yim $r2['yim'];
$location $r2['location'];
$job $r2['job'];
$website $r2['website'];
$link1 $r2['link1'];
$link2 $r2['link2'];
$link3 $r2['link3'];
$link4 $r2['link4'];
$link5 $r2['link5'];
$link6 $r2['link6'];
$link7 $r2['link7'];
$link8 $r2['link8'];
$sex $r2['sex'];
$interests $r2['interests'];
$bio $r2['bio'];
$avatar $r2['avatar'];
$avatarfile $r2['avatarfile'];
$ir $db->fetch_row($q);



if ( 
$newsletter == "yes" ) { $nsel "selected" ; } ;
if ( 
$sex == "m" ) { $msel "selected" ; } ;
if ( 
$sex == "f" ) { $fsel "selected" ; } ;
if (
$avatar == "1" ) { $avatarfileurl '<img src=\''.$domain.'/avatars/'.$avatarfile.'\' height=\'100\' width=\'100\'>'; } else { $avatarfileurl '<img src=\''.$domain.'/avatars/default.jpg\' height=\'100\' width=\'100\'>'; };
echo 
'
<table width="89%" align="center" class=\'content\'>
<tr>
<td colspan=\'4\' class=\'header\'>Profile</td>
</tr>
<tr>
<td colspan=\'4\' class=\'content\' style=\'padding:3px;\'>'
.$avatarfileurl.' </td>
</tr>
<tr>
<td>Username</td>
<td>'
.$ir['username'].'</td>
</tr>
<tr>
<td>Plays</td>
<td>'
.$ir['plays'].'</td>
</tr>
<tr>
<td>Website</td>
<td>'
.$ir['website'].'</td>
</tr>
<tr>
<td>Sex</td>
<td>'
.$ir['sex'].'</td>
</tr>
<tr>
<td>Interests</td>
<td>'
.$ir['interests'].'</td>
</tr>
<tr>
<td>Bio</td>
<td>'
.$ir['bio'].'</td>
</tr>
<tr>
<td></td>



<form action=\''
.$domain.'/index.php?action=messages&case=compose\' method=\'POST\'>
<tr>
<td class=\'content\' colspan=\'2\' align=\'center\'><input type=\'submit\' name=\'submit\' class=\'loginstyle\' value=\'Message User\'></td>
</tr>
</form>



</tr>
</table>'
;
}
?>


The only problem I have is when you click on Message user it brings up an error:
Quote
Warning: include() [function.include]: Failed opening '/includes/counter.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/a7508917/public_html/templates/default/footer.php on line 59

If you click compose it comes up fine but that's the page I thought it was calling in the first place so i'm really not sure.

kurt

  • Developer
  • Hero Member
  • ******
  • Posts: 634
  • Force: +16/-1
Re: [v1] Profile Page
« Reply #7 on: October 24, 2011, 12:48:07 AM »
The show profile page is brought up when you click to visit a specific member's profile in the member listing page(s). When you click on a specific member, it loads the member's ID number into the showprofil page and displays it.

The error you mention is usually one of a couple of things. Most offten it comes from the files /includes/counter.php and/or /includes/hitcounter.txt not being chmod to 777. The second most commen cause is server settings, which not all are things we can change. If you can not get it to work by setting the permissions to 777, then chances are you might need different hosting to make it work, or just remove that bit from the template.php file. Snything other than that, and I would need to see/play with the site to troubleshoot.