I will begin by saying this is unfinished, and I am new to web programming. That being said, I am trying to create a javascript slide show that remembers the last slide a Wordpress (loggedin user) was viewing.
I have hand entered one record into a new Wordpress table called wp_slideshow. The columns in that table are user and last_slide. The current data is one record, user = admin, last_slide = 3.
I just want to get the current userid that is logged in from wordpress and then get the last_slide number. Once I get it I need to integrate the last slide into my javascript code and begin displaying the last slide. Any suggestions on why my current code (just for getting one record from my wp_slideshow table does not work?
Here is my code:
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="post">
<div class="entry">
<?php the_content(); ?>
<?php edit_post_link('Edit.', '<p>', '</p>');?>
<?php global $current_user;?>
<?php get_currentuserinfo();?>
<?php $user_id = $current_user->ID;?>
<?php global $wpdb;?>
<?php
$thenbr = $wpdb->get_row( $wpdb->slideshow( "SELECT * FROM $wpdb->slideshow WHERE user = "admin"" ) );
echo $thenbr->last_slide;
?>
</div>
<SCRIPT LANGUAGE="JavaScript">
var num=1
img1 = new Image ()
img1.src = "http://localhost/wp-content/uploads/2011/11/nervous.gif"
img2 = new Image ()
img2.src = "interference.gif"
img3 = new Image ()
img3.src = "message.gif"
img4 = new Image ()
img4.src = "nervous.gif"
text1 = "Text for Picture One"
text2 = "Text for Picture Two"
text3 = "Text for Picture Three"
text4 = "Text for Picture Four"
function slideshowUp()
{
num=num+1
if (num==5)
{num=1}
document.mypic.src=eval("img"+num+".src")
document.joe.burns.value=eval("text"+num)
}
function slideshowBack()
{
num=num-1
if (num==0)
{num=4}
document.mypic.src=eval("img"+num+".src")
document.joe.burns.value=eval("text"+num)
}
</SCRIPT>
<!-- The Image and Form Codes are Below -->
<CENTER>
<IMG SRC="information.gif" NAME="mypic" BORDER=0 HEIGHT="300" WIDTH="300">
<p>
<FORM NAME="joe">
<INPUT TYPE="text" WIDTH="300" NAME="burns" VALUE="Text For Picture One">
</FORM>
<A HREF="JavaScript:slideshowBack()"> Back</A>
<A HREF="JavaScript:slideshowUp()"> Next</A>
</div>
<?php endwhile; endif; ?>
