Webmastersite.net
Register Log In

Variables not working properly

Comments on Variables not working properly

Synozeer
Forum Regular

Usergroup: Customer
Joined: Jun 02, 2004

Total Topics: 32
Total Comments: 142
Posted Jan 21, 2006 - 1:05 AM:

I'm creating a custom page, but some of the variables that should work aren't.

First, I created a file called submissions.php that looks like this:


<?php
$custom = 'yes';
$TID = 'custom/submissions';
require 'index.php';
?>


Then in a custom template called submissions.tpl I have this toplist:


<CONFIG>links,time,10,descending,validated='no' and ownerid={MEMBERID},,,1,0,0,0</CONFIG>


WSN Links doesn't like the MEMBERID variable though. If I try to access that page, I get this error:


Warning: mysql_result(): supplied argument is not a valid MySQL result resource in /var/www/vhosts/gamelinks.com/httpdocs/classes/database.php on line 226

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /var/www/vhosts/gamelinks.com/httpdocs/classes/database.php on line 82


But when I place that toplist into a pre-existing template, like profile.tpl, the toplist works fine. Also, when I replace {MEMBERID} with a number, it also works correctly and creates a toplist of that member's ID. Therefore it doesn't seem like any variables are working properly in these custom pages the way I'm using them. Is this a bug, or is it supposed to not work this way, or am I doing something wrong? How do I work around this?

Ultimately, my goal is to have a page that'll show a member all his submitted links that are NOT validated yet - basically a pending submissions page.

Adam
Paul
developer

Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California

Total Topics: 61
Total Comments: 7868
Paul
Posted Jan 22, 2006 - 5:26 PM:

The toplist of submitted links in the 'view profile' template uses {MEMBERID} and appears to be working fine. Are you perhaps outside the scope of the member?
Synozeer
Forum Regular

Usergroup: Customer
Joined: Jun 02, 2004

Total Topics: 32
Total Comments: 142
Posted Jan 22, 2006 - 6:05 PM:

Yes, I have already seen that MEMBERID works in the View Profile template. However, as per my post above, I created a new template and php file that has nothing to do with View Profile. Would that be out of the scope of the member, and if so, how to rememdy that?

What it seems is that if one makes a custom new page, you can't use variables like MEMBERID on that page.

Adam
Paul
developer

Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California

Total Topics: 61
Total Comments: 7868
Paul
Posted Jan 23, 2006 - 9:14 PM:

Overlay the custom template onto the view profile page... or some other one where members apply. What member are you trying filter to, anyhow? If it's the viewer of the page, {MEMBER is not a proper way to refererence them, they're {THISMEMBER.
Synozeer
Forum Regular

Usergroup: Customer
Joined: Jun 02, 2004

Total Topics: 32
Total Comments: 142
Posted Jan 23, 2006 - 9:37 PM:

I had previously tried:


<?php
$custom = 'yes';
$TID = 'custom/submissions';
require 'profile.php';
?>


but it also didn't work.

I'm just trying to create a page that a logged in member can go to to see their unvalidated links. I don't want this listed in the profile page or any other page, just in its own page.

I have the php file listed above (submissions.php) and a template called submissions.tpl that is:


<table width="95%" border="0" cellpadding="1" cellspacing="1" bgcolor="#0099FF" class="maintext">
<tr bgcolor="#FFFFFF">
<td valign="top">
<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#2498C1" class="maintext">
<tr>
<td bgcolor="#2498C1" class="footertext" height="17"> <a href="https://www.webmastersite.net/forums/"><strong>{LANG_NAVORIGIN}</a> > <font color="#E1E6E6">Pending Submissions</font></strong></td>
</tr>
<tr bgcolor="#FFFFFF">
<td class="boxcolor">
<table width="210" cellpadding="3" cellspacing="0" border="0" class="maintext" align="center">
<!-- BEGIN TOPLIST 7 -->
<CONFIG>links,time,10,descending,validated='no' and ownerid={MEMBERID},,,1,0,0,0</CONFIG>
<tr>
<td><a href="link.php?action=detail&id={LINKID}"><b>{LINKTITLE}</b></a></td>
</tr>
<!-- END TOPLIST 7 -->
</table>
</td>
</tr>
</table>
</td></tr>
</table>
<div align=center>
<IF {TOPLIST7MULTIPAGE}>
Page: {TOPLIST7PREVIOUS} <b>{TOPLIST7CURRENTPAGE}</b> {TOPLIST7NEXT}
</IF>
</div>


The weird thing is, in the template that I make, if I just print the value of {MEMBERID}, it prints it fine, but when I try to use it in my toplist, that's where I get the error. Maybe it's userid that's not working rather than {MEMBERID}.

Adam
Paul
developer

Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California

Total Topics: 61
Total Comments: 7868
Paul
Posted Jan 25, 2006 - 8:07 PM:

If it's the logged in member, {MEMBER is not appropriate, only {THISMEMBER is.
Synozeer
Forum Regular

Usergroup: Customer
Joined: Jun 02, 2004

Total Topics: 32
Total Comments: 142
Posted Jan 27, 2006 - 3:39 PM:

I got it to work. I saw {THISMEMBER and thought it was a typo there it just left the "}" off. Didn't know that variable was supposed to read {THISMEMBERID}.

Adam
Search thread for
Download thread as
  • 0/5
  • 1
  • 2
  • 3
  • 4
  • 5



This thread is closed, so you cannot post a reply.