PDA

View Full Version : Please Help: Trying to modify recent post hack to add post previews on front page


thecrazycanuck
03-16-2011, 04:32 AM
I am using this mod (https://vborg.vbsupport.ru/showthread.php?t=247814) to add a list of the most recently posted threads at my forum ebeaver (http://www.eBeaver.ca).

I am trying to add a preview of the thread's first post under the given titles, but I am having a hard time figuring out how to query? this out of vbulletin.

<td class="alt2">
<vb:if condition="$getposts_thread[newpost]">
<a href="showthread.php?{vb:raw session.sessionurl}goto=newpost&amp;t={vb:raw getposts_thread.threadid}" id="thread_gotonew_{vb:raw getposts_thread.realthreadid}"><img class="inlineimg" src="images/statusicon/post_new.gif" alt="{vb:rawphrase go_to_first_new_post}" border="0" /></a></vb:if>
{vb:raw getposts_thread.prefix_rich}
<a href="showthread.php?{vb:raw session.sessionurl}t={vb:raw getposts_thread.threadid}{vb:raw getposts_thread.highlight}" id="thread_title_{vb:raw getposts_thread.realthreadid}"<vb:if condition="$getposts_thread[newpost]"> style="font-weight:bold"</vb:if> title="{vb:raw getposts_thread.titletrimmed}">{vb:raw getposts_thread.titletrimmed}</a>

<div style="clear:both; border:1px dashed #c4c4c4; padding:10px; margin:10px 5px 5px 5px; background-color:#fefdf2;">
{vb:raw getposts_thread.pagetext}
</div>

</td>
<td align="center" class="alt1"><a href="forumdisplay.php?{vb:raw session.sessionurl}f={vb:raw getposts_thread.forumid}">{vb:raw getposts_thread.forumtitle}</a>
</td>
<td class="alt2" align="center">
{vb:raw getposts_thread.lastpostdate}
<vb:if condition="!$show['detailedtime']">
{vb:raw getposts_thread.lastposttime}</vb:if>
</td>
<td class="alt1" align="center">
<a href="misc.php?do=whoposted&amp;t={vb:raw getposts_thread.threadid}" onclick="who({vb:raw getposts_thread.threadid}); return false;">
{vb:raw getposts_thread.replycount}</a>
</td>
<td class="alt2" align="center">
{vb:raw getposts_thread.views}
</td>
</tr>



The bold div is in the right place to put the preview where I want, the part that I have no idea about is the {vb:raw getposts_thread.pagetext} I have also tried {vb:raw post.pagetext}

Can anyone point me in the right direction?

Lynne
03-16-2011, 04:54 PM
What is your Query? Are you even getting the pagetext in your query? And, after you do so, you need to format it and sometimes the coder changes the name of the field at that point. So, you'll have to look at your query and the code under it to figure out the correct variable to call.

thecrazycanuck
03-16-2011, 05:17 PM
no I am certainly not getting the pagetext. I get zip from that code My problem is that I really have no idea what variable I have to call. I know that for displaying this the thread display template the variable is post.pagetext.

So I know that this may not be possible with only one variable call but I know I need to call the pagetext from the first post of the thread. (I hope that made sense) My difficulty is that the hack doesn't call any of the vbulletin native variables for posts that can be called but I can't find any relevant documentation on the native variables that would let me call posts or posts pagetext.

I hope I made sense here, I am a bit of a code noob.

Lynne
03-16-2011, 06:10 PM
There are no 'native' variables to be used there. The only variables you may use are ones that you define. So, you need to go look at your php code and see what variables are defined. You can't just throw variables names out and hope they give you something. Well, I suppose you can do that, but you shouldn't be surprised if they give you nothing.

thecrazycanuck
03-16-2011, 06:27 PM
ok, then, I suppose my problem is that I don't know for instance if there is a db query that would let me id the first post in a thread.

I am looking for information on how vbulletin stores all the thread and post data in the database so I can call it. or am I just showing my ignorance of php and sql?

Lynne
03-16-2011, 07:44 PM
The query is in the mod. You said you were using a mod and trying to modify the output. Well, the output comes from the code in the mod. So, you need to look at the modification code to see what the query is and what he is actually selecting and if the post text is one of the things being selected (probably not). If not, then you need to add it.

thecrazycanuck
03-18-2011, 04:56 AM
ok, so the mod selects variables from the thread table so I added in a query for firstpostid, and I am adding in a query of the post table to select for the post's pagetext.

My problem now is how to use the firstpostid from the thread table query to properly select the pagetext from the post table query

Lynne
03-18-2011, 04:26 PM
SELECT pagetext FROM post WHERE postid = $firstpostid

You will need to format that correctly. You could probably just use a JOIN in your original query to grab that depending on what the query looks like.